Gareth Wilson Gareth Wilson

How to Test and Replay Slack Webhooks Locally with Hookdeck

Published


Slack is the dominant workplace messaging platform, used by millions of teams to coordinate work and manage integrations. Its Events API delivers real-time workspace events — messages, reactions, file uploads, channel changes, and more — to your application via HTTP callbacks. For a comprehensive overview, see our guide to Slack webhooks features and best practices.

Testing Slack Events API webhooks during development requires exposing a local endpoint to the internet, since Slack needs to send HTTP POST requests to a publicly accessible URL. Slack also enforces a strict 3-second response deadline — if your endpoint doesn't respond in time, Slack retries and can eventually disable your event subscriptions.

Hookdeck provides an event gateway that can be used to manage inbound webhooks, including monitoring and replaying webhook events. The Hookdeck CLI creates a tunnel from your localhost to a stable public URL, making it easy to receive, inspect, and replay Slack events during development.

Relaying your Slack webhooks through Hookdeck gives you full visibility into every event delivery, with the ability to inspect payloads, retry failed deliveries, and replay events without re-triggering them in Slack.

This guide walks you through connecting Slack Events API webhooks through Hookdeck to an application running on localhost:

  1. Set up a local webhook endpoint
  2. Create a Hookdeck connection
  3. Configure a Slack Events API subscription
  4. Test and replay webhook events using the Hookdeck Console

Set up a local webhook endpoint

For this example, we will use the sample Node.js code from Hookdeck's repository. Feel free to follow along with any application or code you might have.

  1. Open up your terminal and clone the repository by running:
git clone https://github.com/hookdeck/nodejs-webhook-server-example.git
  1. Navigate into the cloned directory and install the dependencies:
cd nodejs-webhook-server-example
npm install
  1. Start the server by executing:
npm run dev

The Node.js server starts on http://localhost:1337. See the list of endpoints in the src/routes.ts file.

We will make use of the /slack-webhooks-endpoint.

Create a Hookdeck connection

There are several ways of creating a Hookdeck connection. For this guide, we're using the Hookdeck CLI without a Hookdeck account, so the CLI will dynamically create a connection.

Create Hookdeck connection with Hookdeck CLI

  npm install hookdeck-cli -g
  
  
  yarn global add hookdeck-cli
  
  
    brew install hookdeck/hookdeck/hookdeck
    
    
  1.     scoop bucket add hookdeck https://github.com/hookdeck/scoop-hookdeck-cli.git
        
        
  2.   scoop install hookdeck
      
      
  1. Download the latest release's tar.gz file.

  2.     tar -xvf hookdeck_X.X.X_linux_x86_64.tar.gz
        
        
  3.   ./hookdeck
      
      
  • Open up your terminal and expose the localhost port with:
hookdeck listen 1337
  • The Hookdeck CLI initiates the creation of a guest account that will be used.
  • You get prompted to do some basic setup:
    • Create a new source label (ex. slack)
    • Set the path to be forwarded as /slack-webhooks-endpoint
    • Name the connection label (ex. my-application)
  • The connection is created, and you are given:
    1. A unique URL for the Hookdeck Console
    2. The webhook URL needed

The same connection can be seen on your Hookdeck guest console after following the link. Copy the Slack Source webhook URL for the next step.

You can create a Hookdeck account to make the URL permanent and enjoy other features.

Configure a Slack Events API subscription

To set up Slack to deliver events to your Hookdeck URL:

  1. Go to api.slack.com/apps and create a new app (or select an existing one).
  2. Navigate to Event Subscriptions in the left sidebar.
  3. Toggle Enable Events to on.
  4. In the Request URL field, paste the Hookdeck Source URL copied from the step above.
  5. Slack will send a url_verification challenge to verify the endpoint. Your local application must respond with the challenge value.
  6. Once verified, scroll to Subscribe to bot events and add the events you want to listen for — common choices include message.channels, reaction_added, app_mention, and member_joined_channel.
  7. Click Save Changes.

If your Slack app doesn't yet have the necessary bot token scopes for the events you're subscribing to, you'll need to add them under OAuth & Permissions and reinstall the app to your workspace.

Now, when the specified events occur in your Slack workspace, Slack sends a POST request to the Hookdeck URL, which gets relayed to your localhost application.

Slack includes several useful headers with each event delivery: X-Slack-Signature (the HMAC-SHA256 signature for verification), X-Slack-Request-Timestamp (the request timestamp), and on retries, x-slack-retry-num and x-slack-retry-reason indicating why the delivery is being retried.

Testing Slack webhook events

After setting up your local server, configuring the Hookdeck connection, and subscribing to Slack events, it's time to test the integration.

Trigger an event in your Slack workspace that matches your subscription. For example, if you subscribed to message.channels:

  • Go to any public channel your app has been added to
  • Post a message in the channel

This triggers a message event, which Slack delivers to Hookdeck, which relays it to your localhost application.

  • Check the Hookdeck Console for a successful request with a 200 status code.
  • Back in your terminal, the event payload is printed by your local server.

Slack enforces a strict 3-second response deadline. If your local server takes longer to respond, Slack marks the delivery as failed and retries (up to 3 times). Hookdeck helps here by acknowledging Slack immediately and delivering to your localhost with more lenient timeouts.

Retrying error or failed events

In case there are any failed events that don't make it to your destination, Hookdeck provides you with the ability to retry and attempt to deliver any failed or error event.

To retry a failed event:

  • Click on the Retry icon by the right of the failed event in the Hookdeck Console

For more details on managing Hookdeck events, refer to the Hookdeck documentation.

Conclusion

In this tutorial, you learned how to receive Slack Events API webhook events to an application running on localhost using the Hookdeck CLI and Hookdeck Console.

If you found this helpful, try out the Hookdeck platform that helps you safely consume, monitor, and troubleshoot your Slack webhooks in development and production. Hookdeck absorbs Slack's 3-second timeout requirement, provides a dead letter queue for failed deliveries, and gives you complete visibility into every event — solving the key pain points of working with Slack's Events API.


Gareth Wilson

Gareth Wilson

Product Marketing

Multi-time founding marketer, Gareth is PMM at Hookdeck and author of the newsletter, Community Inc.