Events and Webhooks
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:
{"event_type": "subscriber.confirmed","data": {"subscriber": "ac79483b-cd28-49c1-982e-8a88e846d7e7"}}
Events
Event type | description |
---|---|
subscriber.created | Whenever a new subscriber is created |
subscriber.unsubscribed | When a subscriber has manually unsubscribed from your newsletter |
subscriber.confirmed | When a subscriber has confirmed that they are enrolled in your newsletter. (For newsletters without double opt-in, this event is created immediately after `subscriber.created`.) |
subscriber.trial_started | When the trial has started for a subscriber. (For newsletters with automatic free trials, this will be created immediately after `subscriber.confirmed`.) |
subscriber.trial_ended | When the trial has ended for a subscriber. |
subscriber.paid | When a subscriber has enrolled in your newsletter's paid offering |
subscriber.churned | When a subscriber has unenrolled from your newsletter's paid offering |
subscriber.clicked | When a subscriber has clicked a link in one of your emails |
subscriber.updated | When a subscriber's notes or metadata has changed |
email.created | Whenever a new email is created and begins delivery. Note that event happens immediately before the emails themselves are sent. |
email.sent | Whenever an email has finished its delivery. Note that event happens immediately after all emails have been sent, but some email events may not have finished processing. |
email.deleted | Whenever an email has been deleted |
email.status.changed | Whenever an email's status has changed (e.g. from 'draft' to 'sent'.) The `metadata` field will contain the previous and new statii in 'old_value' and 'new_value' respectively. |