From fc1e1cb7e0cd9b75b8f9fe9abfa5fcf8b2a83d3d Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Tue, 28 Jun 2022 14:22:57 +0100 Subject: [PATCH 1/2] Update webhooks.phtml --- app/views/docs/webhooks.phtml | 88 +++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/app/views/docs/webhooks.phtml b/app/views/docs/webhooks.phtml index a18a58908..e95c59bb3 100644 --- a/app/views/docs/webhooks.phtml +++ b/app/views/docs/webhooks.phtml @@ -54,6 +54,13 @@ $events = $this->getParam('events', []); The ID of the project who owns the Webhook and API call. + + + X-Appwrite-Webhook-Signature +

version >= 0.15.0

+ + The HMAC-SHA1 signature of the payload. This is used to verify the authenticity of the payload. + User-Agent Each request made by Appwrite will be 'Appwrite-Server'. @@ -61,6 +68,87 @@ $events = $this->getParam('events', []); +

Verification

+ +

Webhooks can be verfied by using the X-Appwrite-Webhook-Signature header. This is a HMAC-SHA1 +signature of the payload. You can find the signature key in your webhooks properties in the dashboard. To generate this hash you append +the payload to the webhook URL and then use the HMAC-SHA1 algorithm to generate the signature. + +After you've generated the signature, compare it to the one in the header. If they match, the payload is valid and you can trust it came from +your Appwrite instance.

+ + + + +

Events

A list of all currently available events you can hook to:

From 50749aa0777d8095b30037e67649a2afa86ad5a1 Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Tue, 28 Jun 2022 14:32:16 +0100 Subject: [PATCH 2/2] Update webhooks.phtml --- app/views/docs/webhooks.phtml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/docs/webhooks.phtml b/app/views/docs/webhooks.phtml index e95c59bb3..38dbe2f80 100644 --- a/app/views/docs/webhooks.phtml +++ b/app/views/docs/webhooks.phtml @@ -70,11 +70,11 @@ $events = $this->getParam('events', []);

Verification

-

Webhooks can be verfied by using the X-Appwrite-Webhook-Signature header. This is a HMAC-SHA1 +

Webhooks can be verfied by using the X-Appwrite-Webhook-Signature header. This is the HMAC-SHA1 signature of the payload. You can find the signature key in your webhooks properties in the dashboard. To generate this hash you append -the payload to the webhook URL and then use the HMAC-SHA1 algorithm to generate the signature. +the payload to the end of webhook URL (make sure there are no spaces in between) and then use the HMAC-SHA1 algorithm to generate the signature. -After you've generated the signature, compare it to the one in the header. If they match, the payload is valid and you can trust it came from +After you've generated the signature, compare it to the "X-Appwrite-Webhook-Signature" header value. If they match, the payload is valid and you can trust it came from your Appwrite instance.