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 | 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 | 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 | The ID of the project who owns the Webhook and API call. |
X-Appwrite-Webhook-Signature | 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 verified 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
Appwrite has events that fire when a resource changes. These events cover all Appwrite resources and can reflect create, update, and delete actions. You can specify one or many events to subscribe to with webhooks.
Authentication events
Name Description teams.* This event triggers on any teams event. Returns Team Object teams.*.create This event triggers when a team is created. Returns Team Object teams.*.delete This event triggers when a team is deleted. Returns Team Object teams.*.memberships.* This event triggers on any team memberships event. Returns Membership Object teams.*.memberships.*.create This event triggers when a membership is created. Returns Membership Object teams.*.memberships.*.delete This event triggers when a membership is deleted. Returns Membership Object teams.*.memberships.*.update This event triggers when a membership is updated. Returns Membership Object teams.*.memberships.*.update.status This event triggers when a team memberships status is updated. Returns Membership Object teams.*.update This event triggers when a team is updated. Returns Team Object teams.*.update.prefs This event triggers when a team's preferences are updated. Returns Team Object users.* This event triggers on any user's event. Returns User Object users.*.create This event triggers when a user is created. Returns User Object users.*.delete This event triggers when a user is deleted. Returns User Object users.*.recovery.* This event triggers on any user's recovery token event. Returns Token Object users.*.recovery.*.create This event triggers when a recovery token for a user is created. Returns Token Object users.*.recovery.*.update This event triggers when a recovery token for a user is validated. Returns Token Object users.*.sessions.* This event triggers on any user's sessions event. Returns Session Object users.*.sessions.*.create This event triggers when a session for a user is created. Returns Session Object users.*.sessions.*.delete This event triggers when a session for a user is deleted. Returns Session Object users.*.update This event triggers when a user is updated. Returns User Object users.*.update.email This event triggers when a user's email address is updated. Returns User Object users.*.update.name This event triggers when a user's name is updated. Returns User Object users.*.update.password This event triggers when a user's password is updated. Returns User Object users.*.update.prefs This event triggers when a user's preferences is updated. Returns User Object users.*.update.status This event triggers when a user's status is updated. Returns User Object users.*.verification.* This event triggers on any user's verification token event. Returns Token Object users.*.verification.*.create This event triggers when a verification token for a user is created. Returns Token Object users.*.verification.*.update This event triggers when a verification token for a user is validated. Returns Token Object Databases events
Name Description databases.* This event triggers on any database event. Returns Database Object databases.*.collections.* This event triggers on any collection event. Returns Collection Object databases.*.collections.*.attributes.* This event triggers on any attributes event. Returns Attribute Object databases.*.collections.*.attributes.*.create This event triggers when an attribute is created. Returns Attribute Object databases.*.collections.*.attributes.*.delete This event triggers when an attribute is deleted. Returns Attribute Object databases.*.collections.*.create This event triggers when a collection is created. Returns Collection Object databases.*.collections.*.delete This event triggers when a collection is deleted. Returns Collection Object databases.*.collections.*.documents.* This event triggers on any documents event. Returns Document Object databases.*.collections.*.documents.*.create This event triggers when a document is created. Returns Document Object databases.*.collections.*.documents.*.delete This event triggers when a document is deleted. Returns Document Object databases.*.collections.*.documents.*.update This event triggers when a document is updated. Returns Document Object databases.*.collections.*.indexes.* This event triggers on any indexes event. Returns Index Object databases.*.collections.*.indexes.*.create This event triggers when an index is created. Returns Index Object databases.*.collections.*.indexes.*.delete This event triggers when an index is deleted. Returns Index Object databases.*.collections.*.update This event triggers when a collection is updated. Returns Collection Object databases.*.create This event triggers when a database is created. Returns Database Object databases.*.delete This event triggers when a database is deleted. Returns Database Object databases.*.update This event triggers when a database is updated. Returns Database Object Storage events
Name Description buckets.* This event triggers on any buckets event. Returns Bucket Object buckets.*.create This event triggers when a bucket is created. Returns Bucket Object buckets.*.delete This event triggers when a bucket is deleted. Returns Bucket Object buckets.*.files.* This event triggers on any files event. Returns File Object buckets.*.files.*.create Since the Appwrite SDK chunks files in 5MB increments, this event will trigger for each 5MB chunk. A file is fully uploaded when chunksTotal equals chunksUploaded. Returns File Object buckets.*.files.*.delete This event triggers when a file is deleted. Returns File Object buckets.*.files.*.update This event triggers when a file is updated. Returns File Object buckets.*.update This event triggers when a bucket is updated. Returns Bucket Object Functions events
Name Description functions.* This event triggers on any functions event. Returns Function Object functions.*.create This event triggers when a function is created. Returns Function Object functions.*.delete This event triggers when a function is deleted. Returns Function Object functions.*.deployments.* This event triggers on any deployments event. Returns Deployment Object functions.*.deployments.*.create This event triggers when a deployment is created. Returns Deployment Object functions.*.deployments.*.delete This event triggers when a deployment is deleted. Returns Deployment Object functions.*.deployments.*.update This event triggers when a deployment is updated. Returns Deployment Object functions.*.executions.* This event triggers on any executions event. Returns Execution Object functions.*.executions.*.create This event triggers when an execution is created. Returns Execution Object functions.*.executions.*.delete This event triggers when an execution is deleted. Returns Execution Object functions.*.executions.*.update This event triggers when an execution is updated. Returns Execution Object functions.*.update This event triggers when a function is updated. Returns Function Object Messaging events
Name Description providers.* This event triggers on any providers event. Returns Provider Object providers.*.create This event triggers when a provider is created. Returns Provider Object providers.*.delete This event triggers when a provider is deleted. Returns Provider Object providers.*.update This event triggers when a provider is updated. Returns Provider Object topics.* This event triggers on any topic event. Returns Topic Object topics.*.create This event triggers when a topic is created. Returns Topic Object topics.*.delete This event triggers when a topic is deleted. Returns Topic Object topics.*.update This event triggers when a topic is updated. Returns Topic Object topics.*.subscribers.*.create This event triggers when a subscriber to a topic is created. Returns Topic Object topics.*.subscribers.*.delete This event triggers when a subscriber to a topic is deleted. Returns Topic Object messages.* This event triggers on any message event. Returns Message Object messages.*.create This event triggers when a message is created. Returns Message Object messages.*.delete This event triggers when a message is deleted. Returns Message Object messages.*.update This event triggers when a message is updated. Returns Message Object