Events are Buttondown's way of telling you that something interesting has happened to your newsletter, and webhooks are Buttondown's way of letting you react to various incoming events. For example, when a new subscriber signs up for your newsletter, Buttondown creates and emits a subscriber.created event; when that subscriber unsubscribes, Buttondown creates a subscriber.unsubscribed event. If you wanted to, say, create a Slack notification or run some application code whenever something in Buttondown happens, you'd create a webhook for the concomitant event and point it towards your application.
The payload of most events are fairly simple, and look something like this:
Webhook security with HMAC signing
For additional security, you can enable HMAC signing on your webhooks to verify that requests are genuinely coming from Buttondown. When you set a signing key on a webhook, Buttondown will include an X-Buttondown-Signature header with each request.
Setting up HMAC signing
To enable HMAC signing for a webhook:
- Go to your webhook settings
- Add a signing key in the "Signing key" field
- Save the webhook
The signing key can be any string you choose—make it long and random for best security.
Verifying the signature
When Buttondown sends a webhook with a signing key enabled, it includes an X-Buttondown-Signature header in the format:
To verify the signature on your end:
Example verification in different languages
Node.js:
Ruby:
The signature is computed using HMAC-SHA256 over the raw request body (before JSON parsing), so make sure to verify the signature using the original bytes you received.
Using signing keys in automation actions
You can also use signing keys when sending post requests via automation actions. Simply add a signing_key field to your action's metadata:
Retries
We retry up to 3 times if a webhook fails.
Creating webhooks
Step 1: Navigate to integrations
- Log into your Buttondown account
- Go to Settings
- Click the Create webhook button:
Step 2: Configure webhook settings
You'll need to provide the following information:
Webhook URL
Enter the URL where Buttondown should send event data. This URL is typically provided by:
- Third-party services (Discord, Slack, etc.)
- Automation platforms (Zapier, Make, n8n)
- Your own application endpoint
Events to trigger
Select which events should trigger your webhook. Common event types include:
| Event Type | Description |
|---|---|
| subscriber.created | When someone subscribes to your newsletter |
| subscriber.confirmed | When a subscriber confirms their email |
| subscriber.unsubscribed | When someone unsubscribes |
| email.sent | When you send a newsletter |
| email.delivered | When an email is successfully delivered |
| comment.created | When someone comments on your newsletter |
You can select multiple events for a single webhook.
Step 3: Test your webhook
Once you've configured your webhook, it's recommended to test it:
- Click the Test webhook button
- Buttondown will send a test payload to your URL
- Verify that your receiving service gets the test data