Slack Incoming Webhooks
Create a Slack webhook, save it as a relay target, and test delivery.
2 min read
Use this guide to send endpoint traffic to Slack.
Purpose#
Use this guide to:
- Create a Slack incoming webhook.
- Save Slack as a relay target.
- Attach the target to an endpoint destination.
- Test delivery.
Before you start#
- Make sure that you have permission in the Slack workspace to create an incoming webhook.
- Select the Slack channel that receives the messages.
- Make sure that you can access
Relay targetsandEndpoints.
Procedure#
1. Create webhook URL in Slack#
- In the Slack app settings, enable
Incoming Webhooks. - Create a webhook for the channel.
- Copy the URL. Use
https://hooks.slack.com/services/...for Slack. GovSlack useshttps://hooks.slack-gov.com/services/....
2. Add Slack relay target#
- Open
Relay targets. - Select
Add target. - Select
Slack webhook. - Paste the Slack URL into
Slack webhook URLand save.
The URL must use the Slack incoming webhook format on hooks.slack.com or hooks.slack-gov.com.
3. Attach Slack target to endpoint#
- Open the endpoint create page or the endpoint edit page.
- In
Outputs, select the Slack target. - If the generated Slack text or the template body sections need Markdown, set
Slack Markdown. - Save the endpoint.
4. Send test delivery#
- On
Relay targets, selectSend testfor the Slack target. - Make sure that the message appears in the Slack channel.
- To see the test result, look for
Test accepted(TEST_ACCEPTED) in Activity.
Expected result#
- The Slack target is listed, and you can select it as an endpoint destination.
- The test traffic and the live endpoint traffic go to the selected channel.
- Without a custom message template, PayloadRelay sends the incoming payload as Slack text. With a custom message template, PayloadRelay sends Slack attachment blocks with a top-level text fallback.
Common issues and fixes#
- URL rejected: make sure that the URL uses
hooks.slack.com/services/...orhooks.slack-gov.com/services/.... - No message in Slack: make sure that the target is attached to the endpoint, and that the webhook is active.
- Formatting issues: change the Slack Markdown toggle for a generated message. Slack-native
blocksorattachmentsin the incoming payload control their own formatting.