Appwrite is now available as a DigitalOcean 1-click app! Click to install! 🚀
Docs

Webhooks

Webhooks allow you to build or set up integrations which subscribe to certain events on Appwrite. When one of those events is triggered, we'll send an HTTP POST payload to the webhook's configured URL. Webhooks can be used to purge cache from CDN, calculate data or send a Slack notification. You're only limited by your imagination.

Add Your Webhook

You can set your webhook by adding it from your Appwrite project dashboard. You can access your webhooks settings from your project dashboard or on the left navigation panel. Click the 'Add Webhook' button and choose your webhook name and the events that should trigger it. You can also set an optional basic HTTP authentication username and password to protect your endpoint from unauthorized access.

Payload

Each event type has a specific payload format with the relevant event information. All event payloads mirror the payloads for the API payload which parallel to the event types.

Headers

HTTP requests made to your webhook's configured URL endpoint will contain several special headers:

Header Description
X-Appwrite-Webhook-Id

version >= 0.7

The ID of the Webhook who triggered the event.
X-Appwrite-Webhook-Events Names of the events that triggered this delivery.
X-Appwrite-Webhook-Name Name of the webhook as specified in your app settings and events list.
X-Appwrite-Webhook-User-Id

version >= 0.7

The user ID of the user who triggered the event. Returns an empty string if an API key triggered the event.

Note that events like `account.create` or `account.sessions.create` are performed by guest users and will not return any user ID. If you still need the user ID for these events, you can find it in the event payload.
X-Appwrite-Webhook-Project-Id

version >= 0.7

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'.

Verification

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 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 "X-Appwrite-Webhook-Signature" header value. 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:

Name Payload Description
buckets.* Bucket Object This event triggers on any buckets event.
buckets.*.create Bucket Object This event triggers when a bucket is created.
buckets.*.delete Bucket Object This event triggers when a bucket is deleted.
buckets.*.files.* File Object This event triggers on any files event.
buckets.*.files.*.create File Object This event triggers when a file is created.
buckets.*.files.*.delete File Object This event triggers when a file is deleted.
buckets.*.files.*.update File Object This event triggers when a file is updated.
buckets.*.update Bucket Object This event triggers when a bucket is updated.
databases.* Database Object This event triggers on any database event.
databases.*.collections.* Collection Object This event triggers on any collection event.
databases.*.collections.*.attributes Attribute Object This event triggers on any attributes event.
databases.*.collections.*.attributes.create Attribute Object This event triggers when an attribute is created.
databases.*.collections.*.attributes.delete Attribute Object This event triggers when an attribute is deleted.
databases.*.collections.*.create Collection Object This event triggers when a collection is created.
databases.*.collections.*.delete Collection Object This event triggers when a collection is deleted.
databases.*.collections.*.documents Document Object This event triggers on any documents event.
databases.*.collections.*.documents.create Document Object This event triggers when a document is created.
databases.*.collections.*.documents.delete Document Object This event triggers when a document is deleted.
databases.*.collections.*.documents.update Document Object This event triggers when a document is updated.
databases.*.collections.*.indexes Index Object This event triggers on any indexes event.
databases.*.collections.*.indexes.create Index Object This event triggers when an index is created.
databases.*.collections.*.indexes.delete Index Object This event triggers when an index is deleted.
databases.*.collections.*.update Collection Object This event triggers when a collection is updated.
databases.*.create Database Object This event triggers when a database is created.
databases.*.delete Database Object This event triggers when a database is deleted.
databases.*.update Database Object This event triggers when a database is updated.
functions.* Function Object This event triggers on any functions event.
functions.*.create Function Object This event triggers when a function is created.
functions.*.delete Function Object This event triggers when a function is deleted.
functions.*.deployments.* Deployment Object This event triggers on any deployments event.
functions.*.deployments.*.create Deployment Object This event triggers when a deployment is created.
functions.*.deployments.*.delete Deployment Object This event triggers when a deployment is deleted.
functions.*.deployments.*.update Deployment Object This event triggers when a deployment is updated.
functions.*.executions.* Execution Object This event triggers on any executions event.
functions.*.executions.*.create Execution Object This event triggers when an execution is created.
functions.*.executions.*.delete Execution Object This event triggers when an execution is deleted.
functions.*.executions.*.update Execution Object This event triggers when an execution is updated.
functions.*.update Function Object This event triggers when a function is updated.
teams.* Team Object This event triggers on any teams event.
teams.*.create Team Object This event triggers when a bucket is created.
teams.*.delete Team Object This event triggers when a bucket is deleted.
teams.*.memberships.* Membership Object This event triggers on any team memberships event.
teams.*.memberships.*.create Membership Object This event triggers when a membership is created.
teams.*.memberships.*.delete Membership Object This event triggers when a membership is deleted.
teams.*.memberships.*.update Membership Object This event triggers when a membership is updated.
teams.*.memberships.*.update.status Membership Object This event triggers when a team memberships status is updated.
teams.*.update Team Object This event triggers when a bucket is updated.
users.* User Object This event triggers on any user's event.
users.*.create User Object This event triggers when a user is created.
users.*.delete User Object This event triggers when a user is deleted.
users.*.recovery.* Token Object This event triggers on any user's recovery token event.
users.*.recovery.*.create Token Object This event triggers when a recovery token for a user is created.
users.*.recovery.*.update Token Object This event triggers when a recovery token for a user is validated.
users.*.sessions.* Session Object This event triggers on any user's sessions event.
users.*.sessions.*.create Session Object This event triggers when a session for a user is created.
users.*.sessions.*.delete Session Object This event triggers when a session for a user is deleted.
users.*.update User Object This event triggers when a user is updated.
users.*.update.*.email User Object This event triggers when a user's email address is updated.
users.*.update.*.name User Object This event triggers when a user's name is updated.
users.*.update.*.password User Object This event triggers when a user's password is updated.
users.*.update.*.prefs User Object This event triggers when a user's preferences is updated.
users.*.update.*.status User Object This event triggers when a user's status is updated.
users.*.verification.* Token Object This event triggers on any user's verification token event.
users.*.verification.*.create Token Object This event triggers when a verification token for a user is created.
users.*.verification.*.update Token Object This event triggers when a verification token for a user is validated.