Pulumi Webhook Handler
This example creates a Pulumi
cloud.HttpEndpoint that will receive webhook events delivered
by the Pulumi Service. It then echos the event to Slack.
After cloning this repo, run these commands from the working directory:
Create a new Pulumi stack, which is an isolated deployment target for this example:
pulumi stack init
Create a Slack App:
Give your app the
Add your Slack app to the Slack channel in which you want to post webhook events.
Set the region for this program:
pulumi config set aws:region <your-region>
Set the Slack webhook for your app. You can find yours by going to
Features -> Incoming Webhooksfrom your Slack app’s API page.
pulumi config set slackWebhook --secret <webhook-url>
Set the Slack channel for your app. This should be the same channel in which you added your Slack app. For example,
pulumi config set slackChannel <your-channel>
(Optional) Set the shared secret for your app. Webhook deliveries can optionally be signed with a shared secret token. The shared secret is given to Pulumi, and will be used to verify the contents of the message. You can find yours by going to
Settings -> Basic Information -> Signing Secretfrom your Slack app’s API page.
pulumi config set sharedSecret --secret <your-secret>
Execute the Pulumi program:
Retrieve our new URL:
pulumi stack output url
Create a Pulumi webhook. Use the output from the previous step as the
Ping our webhook by clicking
Deliveriesfrom your webhook’s page. You should see the message
Just a friendly ping from Pulumiin your Slack channel.
From there, feel free to experiment. Simply making edits and running
pulumi upwill update your program.
Afterwards, destroy your stack and remove it:
pulumi destroy --yes pulumi stack rm --yes
If you aren’t seeing webhook deliveries in Slack, there are several places to look for more information.
- The Pulumi Service. If you go to the webhook’s page within the Pulumi Service, you can navigate to recent webhook deliveries. If the Pulumi Service has any trouble contacting your webhook handler, you will see the error there.
- The Pulumi Stack’s logs. If the webhooks are being delivered, but aren’t showing up in Slack for some
reason, you can view the webhook handler’s runtime logs by running the