POST request to that address describing the event. Each
request is signed so you can check it really came from Fibre, it is retried until your server accepts it, and
every delivery is recorded.
Events
These are the events Fibre can send you:
Every request has a JSON body with the same shape:
body
Verify the signature
Your endpoint is reachable from the internet, so anyone could send it a request that looks like a Fibre event. Always check the signature before trusting a webhook. Here is how it works. When you create the webhook, Fibre gives you a secret that only you and Fibre know. For each request, Fibre computes an HMAC-SHA256 of the timestamp, a dot, and the raw body ("<t>.<body>"),
using that secret as the key, and puts the result in the Fibre-Signature header. Your server computes the same
value with its copy of the secret. If the two match, the request is genuine. Checking the timestamp too protects
you against someone replaying an old request.
Here is a complete handler in TypeScript and in Python:
TypeScript (Express)
Python (Flask)
Try it end to end
You can see real deliveries without deploying anything, because a sandbox has a public address and can act as your receiver. This small receiver checks each request’s signature and writes down what arrived.1
Start a receiver
curl: the receiver program
2
Register the webhook
Now tell Fibre where to send events.
The real answer also includes
events chooses which events you want; leave it out to receive all of them.
The answer includes the secret, and this is the only time you will see it, so store it where your server can
read it. Here, it is written to a file in the receiver.Response
Response
response
secret, which is left out above.3
Send a test, and cause a real event
A test sends a
Every delivery arrived, and every signature was valid.
ping event to your endpoint straight away. To see real events as well, start a sandbox and then
delete it: that sends sandbox.ready and then sandbox.deleted.Output
Output
output
Retries
Your endpoint must answer with a2xx status within 10 seconds. Anything else counts as a failure: an error
status, no answer in time, or a refused connection. After a failure, Fibre tries again, waiting longer each time:
Every attempt for the same event carries the same
Fibre-Event-Id. Fibre guarantees that each event arrives
at least once, but occasionally it may arrive twice, for example if your 200 answer was lost on its way back. So
remember the IDs you have handled, and skip an event you have already processed.
See what was delivered
When something goes wrong, it helps to see what Fibre sent and how your server replied. You can list an endpoint’s last 50 deliveries, newest first:Response
Response
response
status is pending (waiting for its next attempt), succeeded, or failed (every attempt has been
used). last_error says what went wrong, such as HTTP 500 or a timeout.
Rotate the secret
If you think a secret may have leaked, replace it with a new one. The old secret keeps working for 24 hours alongside the new one, so you have time to update your server without missing a single event. During those 24 hours,Fibre-Signature carries two v1= values, one for each secret, and a match with either one is enough.
Delete
To stop receiving events at an endpoint, delete it:Good to know
A few limits and rules:Related
Sleep and wake
Understand what
sandbox.ready with restored, and sandbox.stopped, tell you.Images and builds
build.succeeded tells you an image is ready to run.