Author picture Rodriq Jaro

How to Receive and Replay External Webhooks in Slack with Hookdeck

Published


Webhooks play a very important role in enabling seamless communication between applications and platforms. Slack, the popular team collaboration tool, supports incoming webhooks, which allow external services to post messages into Slack channels.

Hookdeck is a robust webhook and event management platform designed to simplify the process of receiving, replaying, and monitoring webhook events. By using Hookdeck, you can ensure the reliability of your external webhook events in Slack and streamline the management of webhook interactions with various platforms.

In this guide, we'll walk you through the process of setting up a Slack app to receive incoming webhooks and integrate with Hookdeck.

Set up Incoming Webhooks in Slack

We want to be able to receive Incoming Webhooks in Slack so that we can post messages into Slack. This can either be done using the Slack Workflow Builder or using a Slack app.

For this guide, we are going to demonstrate using a Slack app. Follow the steps below.

  1. Visit the Slack API website and click Create App to create a new app. Choose a name and associate your app with your Slack workspace.

    Create Slack app

  2. After creating your app, you are presented with the app's settings page. Locate the Incoming Webhooks feature then click and activate it by toggling the switch On.

  3. Once Incoming Webhooks are enabled, you'll notice additional options. Click on Add New Webhook to Workspace. This guides you through a simplified installation process where you'll choose a channel for the app to post messages.

    Add new Slack webhook

  4. After authorizing your app, Slack generates a unique webhook URL to be used. Note this URL as it is needed in other steps below.

Ensure that you keep your webhook URL secret, as it contains sensitive information. Never share it online or in public repositories.

The endpoint expects a body object with text parameter which contains a message that will be posted in the channel as explained in the Slack docs. See the example below:

POST https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
Content-type: application/json
{
    "text": "Hello, world."
}

Learn more about webhooks in Slack here.

Integrate Hookdeck with Slack Incoming Webhooks

Hookdeck enhances the reliability and management of webhook events. To integrate Hookdeck with Slack Incoming Webhooks, follow these steps:

  • Sign in to your Hookdeck dashboard.
  • Go to the Connections section and click on the + Create Connection to create a new connection.
  • Configure the connection and Save.
    • Source: Specify the platform or application that sends the webhook.
    • Destination: Enter the URL of your Slack Incoming Webhook.

Enter Slack webhook URL

  • Adding a transformer: Since Slack requires a payload body with a text property, we can use Hookdeck Transformers to craft our message within Hookdeck before it reaches Slack.

    • Click on Transform to add a new Transformation:

      Add a Hookdeck Transformer

    • In the transformer panel, just add a line of code to create a custom message text that will be displayed in Slack and Confirm. See below:

      Confirm Hookdeck Transformer

You can customize your transformation to define the structure of the payload that gets received in Slack.

After creating the connection, copy the source URL from Hookdeck to use on the source platform where the webhook is to come from.

Hookdeck acts as an intermediary between the source platform and Slack relaying the webhook events.

Receive and replay webhook events

You can use the Hookdeck Console to simulate example webhooks from popular webhook sources.

Imagine your webhook source is HubSpot. When an event is triggered on HubSpot (the source platform), Hookdeck receives the webhook event and forwards it to the Slack app webhook endpoint which then sends a message into the desired channel.

You can monitor the events within the Hookdeck dashboard and track their delivery status.

  • To monitor incoming webhook events, switch to the Events tab from the side panel on your Hookdeck dashboard. Filter the events based on the connection created, and see the activities of events on that connection.

    Monitor incoming Slack webhooks

  • Additionally, you can check your Slack channels to verify that the message is posted successfully.

    Check Slack channel for webhook

Replay error or failed webhooks

One of Hookdeck's valuable features is the ability to replay webhook events. This comes in handy when a webhook event fails to execute correctly in Slack or during transmission.

To replay a failed webhook event:

  • In the Hookdeck Events panel, locate the failed event and click on the kebab menu (three vertical dots) next to it.

  • Select the Retry option from the menu. This action resends the event to the Slack webhook endpoint, giving it another opportunity to process the event successfully.

    Replay Slack webhook

By integrating Hookdeck with Slack Incoming Webhooks, you can efficiently manage and replay external webhook events. This combination ensures that your Slack channels receive critical information reliably and consistently. Whether you're using Slack for team communication or building integrations, Hookdeck enhances the webhook experience, making it a powerful tool for your workflow.

For more information on Hookdeck's capabilities and best practices, explore the Hookdeck documentation.