How do I add and manage a webhook endpoint?
Go to Settings > Webhooks and select Add an endpoint, then enter an address on your server and choose the events it hears about. Every delivery is signed with the endpoint's signing secret, which is shown once, and the endpoint's page logs each delivery.
A webhook tells your own server when something changes on your account, such as an agent stopping, a server going offline or an invoice being paid. You add an endpoint, an address on your server that takes a POST with JSON, and we send it each event you chose.
Add an endpoint
- Go to Settings > Webhooks in your dashboard and select Add an endpoint.
- Enter the Endpoint address, starting with https://. Add a Name of up to 60 characters if you like, or leave it out and the endpoint is named after its host. Select Continue.
- Tick the events it should hear about, or Every event, then select Add endpoint. You can change them later.
- Copy the signing secret with Copy and keep it with your code, then select Open endpoint.
The signing secret is shown only this once. We keep only its last four characters, so it can't be shown again. If you lose it, make a new one on the endpoint's page.
An address can be up to 500 characters and can't hold a user name or a password. While you're building, an address on your own computer that starts with http://localhost is accepted too.
Choose events
The events are grouped under Agents, Servers, Billing and Referrals, and each one says when it's sent. A new endpoint starts with agent.started, agent.stopped and server.offline ticked, and it needs at least one.
Check the signature
Every delivery carries a Rarity-Signature header made with the endpoint's signing secret, which starts with whsec_. Check it in your code before you trust a delivery, as Webhooks in the developer docs shows.
Test, pause or change an endpoint
Select an endpoint in Settings > Webhooks to open its page.
- Send a test sends a signed test event, whatever events the endpoint listens for, and opens it in the log.
- Pause stops events going to the endpoint, and Resume starts them again. An event that happens while it's paused isn't sent later.
- Under Listens for, select Change, tick or untick events, then select Save.
- Under Signing secret, select New secret and confirm. The new one is shown once at the top of the page, and the old one stops signing at once, so update your code with it.
- Endpoint ID shows the id the API knows the endpoint by, which starts with whk_.
The page doesn't change an endpoint's address or its name. To send events somewhere new, add another endpoint and delete the old one, or change the address with Update an endpoint in the API.
Read the delivery log
Under Deliveries, the endpoint's page lists each event sent to it, newest first, with when it was sent and the status your server answered with. The status is marked OK when it's in the 200s, and Failed for any other.
Select View on a delivery to see it as it was sent, with its Rarity-Signature header and its JSON body, and what your server answered. Show older deliveries loads earlier ones. The log keeps only your account's most recent deliveries, so the oldest drop off as new ones arrive.
Delete an endpoint
On the endpoint's page, select Delete in the Delete endpoint row, type the endpoint's name to confirm, then select Delete. We stop sending to it, its delivery log goes with it, and this can't be undone.