To prevent undesired requests to your webhooks, you can verify the webhook signature with a unique secret for your team. This secret can always be used to verify that the webhook sender is valid.
A webhook is an HTTP POST request from an API service to a URL you control. You might want to verify these requests to ensure they’re from pyannoteAI and not from a malicious actor.
Each webhook request includes 2 HTTP headers that you can use to verify the request:
X-Signature
: The base64 encoded signature of the webhook request.X-Request-Timestamp
: The timestamp of the webhook request in seconds since the Unix epoch.As the webhook receiver, you need to create the signed content by concatenating the timestamp
and the raw body
of the request with a colon (:
) and prefixing the result with v0:
.
In code, this looks like:
Make sure to use the raw body of the request (without headers or other metadata) before serializing to JSON or any other format.
You can find your webhook secret in the pyannoteAI dashboard.
On the webhook page, you can also rotate your webhook secret. This is useful if you think your secret has been compromised.
pyannoteAI uses the HMAC-SHA256 algorithm to sign webhook requests. To determine the expected signature, you need to:
timestamp
from the HTTP header and the raw body
with a colon (:
), then prefix the result with v0:
.In code, this looks like:
Then, simply compare the computed signature with the signature you received in the X-Signature
header.
Here’s an example of how you can verify a webhook request in a FastAPI server:
To prevent undesired requests to your webhooks, you can verify the webhook signature with a unique secret for your team. This secret can always be used to verify that the webhook sender is valid.
A webhook is an HTTP POST request from an API service to a URL you control. You might want to verify these requests to ensure they’re from pyannoteAI and not from a malicious actor.
Each webhook request includes 2 HTTP headers that you can use to verify the request:
X-Signature
: The base64 encoded signature of the webhook request.X-Request-Timestamp
: The timestamp of the webhook request in seconds since the Unix epoch.As the webhook receiver, you need to create the signed content by concatenating the timestamp
and the raw body
of the request with a colon (:
) and prefixing the result with v0:
.
In code, this looks like:
Make sure to use the raw body of the request (without headers or other metadata) before serializing to JSON or any other format.
You can find your webhook secret in the pyannoteAI dashboard.
On the webhook page, you can also rotate your webhook secret. This is useful if you think your secret has been compromised.
pyannoteAI uses the HMAC-SHA256 algorithm to sign webhook requests. To determine the expected signature, you need to:
timestamp
from the HTTP header and the raw body
with a colon (:
), then prefix the result with v0:
.In code, this looks like:
Then, simply compare the computed signature with the signature you received in the X-Signature
header.
Here’s an example of how you can verify a webhook request in a FastAPI server: