CircleCI Webhooks Review
CircleCI is a continuous integration platform that helps engineering teams automate deployments.
When we look at webhook solutions, we’re generally looking for 7 things: signature verification, retries, manual retries, exponential backoff, visibility/logs, event types, and multiple endpoint support. For signature verification, our reference point is the Standard Webhooks specification, which defines the standard headers and signing scheme.
TL;DR:
✅ Signature Verification
⬜ Retries
⬜ Exponential Backoff
⬜ Manual Retries
✅ Visibility into Logs
✅ Event Types
✅ Multiple Endpoints Support
Signature Verification ✅
Signature Verification is a critical security feature of webhooks. It lets users verify that a webhook was actually sent from the expected source.
CircleCI can add a signature to the webhook request to allow their users to verify the origin of the webhook.
If you set a secret token on a webhook, each request carries a circleci-signature header with a v1= value: the HMAC-SHA256 digest of the request body, keyed with that secret (docs). The secret token is optional, so make sure you set one.
They even have a code example of how users can verify the signature, making this one of the best implementations of signature verification we’ve seen.
Retries
Webhook messages often fail. Without retries, users may miss many notifications which results in a bad user experience.
The CircleCI documentation says that if a delivery gets a non-2xx response, or no response within 10 seconds, CircleCI will retry at a later time. It doesn’t say how many times or on what schedule, so there’s no retry policy to plan around and no checkmark.
Looking to send webhooks at scale?
Schedule a CallExponential Backoff
Exponential backoff is an algorithm that increases the delay between retries exponentially. This ensures that your system won’t get bottleneck from having to re-queue failed webhooks while also giving users time to fix broken endpoints before they burn through all their retry attempts.
There is no mention of the delay between retries.
Manual Retries
In the event that a user’s endpoint is failing, its nice to give the developer tasked with debugging the endpoint, the option to initiate a retry manually instead of having to wait for the next scheduled retry (this could be several hours of waiting if they’re close to the end of the retry schedule).
We could not find any mention of redelivering a webhook manually. There is a Test Ping Event button, but it sends a test event, not a replay of a failed delivery.
Visibility into Logs ✅
Giving users visibility into the delivery logs is critical for troubleshooting/debugging.
CircleCI now has a Deliveries tab for each webhook. It lists every delivery with its time, event type, result, HTTP status, number of attempts, and duration. A failed attempt shows the reason, such as a timeout, a failed TLS certificate check, or the status code your endpoint returned. CircleCI keeps deliveries for 14 days.
Event Types ✅
Event types are identifiers denoting the type of message being sent and are the primary way for webhook consumers to configure what events they are interested in receiving.
CircleCI only offers two event types: workflow-completed and job-completed. Each webhook payload contains information about the project, organization, job, workflow, pipeline, and trigger associated with the webhook. You can find some sample webhook payloads in their documentation.
Multiple Endpoint Support ✅
Many webhook solutions only allow one endpoint URL to be specified where all messages will be received. By enabling your users to create multiple endpoints, they’ll be able to choose which endpoints receive which messages. Multiple endpoint support and event types go hand in hand.
CircleCI allows creating multiple endpoints through the webhooks section in the project settings as well as via their public API. However, there is a limit of 5 webhooks per project.
Summary
CircleCI has added delivery logs since our first review, which makes debugging a failing endpoint a lot easier, and we’re still very impressed with their treatment of signature verification. We’d like to see the retry policy clearly stated in their documentation, along with a way to redeliver a failed webhook manually.
If you’re looking to implement world class webhooks, consider trying Svix, the enterprise ready webhooks service. Svix makes it super easy to build a secure, reliable, and scalable webhook solution via API.