Skip to main content

Local Development

When developing webhook handlers, you may want to test them before deploying to production. Hookstack provides several tools to make local testing easy and reliable.

Using the Test Scripts

The Hookstack SDK includes example applications and test scripts to help you get started. These scripts generate properly signed payloads and send them to your local webhook handler.
This will:
  1. Generate a sample webhook payload
  2. Sign it with your provided test secret
  3. Send it to your local webhook endpoint (default: http://localhost:3000/api/webhooks )
The test script is particularly useful for initial integration testing as it ensures your signature verification is working correctly.

Example Applications

The SDK includes several example applications that demonstrate proper webhook handling:

Testing with Real Events

Dashboard Replay

Once you’ve received webhooks in production, you can replay them to your development environment:
  1. Log into your Hookstack Dashboard
  2. Navigate to the Destinations or Routes section
  3. Find the webhook event you want to replay
  4. Click the “Replay” icon to have HookStack re-send the event to your development environment
This allows you to:
  • Test your handler with real production data
  • Debug issues with specific webhook payloads
  • Verify your handler works across different event types
Make sure your development environment is accessible from the internet when using the replay feature. Tools like ngrok or cloudflared can help expose your local server.

Best Practices

Local Development Setup

  1. Use environment variables for configuration:
  1. Set up proper error handling:
  1. Use TypeScript for better development experience:

Troubleshooting

  1. Check that your HOOKSTACK_SIGNING_SECRET matches the one used in the test script
  2. Ensure you’re not modifying the request body before verification
  3. Check the request headers match exactly (case-sensitive)
You can modify the test script to send different event types:
test/send-webhook.ts

Next Steps

View Examples

Browse our collection of example applications

Production Deployment

Learn how to deploy your webhook handler to production