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-Event | Name of the event 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. |
User-Agent | Each request made by Appwrite will be 'Appwrite-Server'. |
Events
A list of all currently available events you can hook to:
Name | Payload | Description |
---|---|---|
account.create | User Object | This event triggers when the account is created. |
account.update.email | User Object | This event triggers when the account email address is updated. |
account.update.name | User Object | This event triggers when the account name is updated. |
account.update.password | User Object | This event triggers when the account password is updated. |
account.update.prefs | User Object | This event triggers when the account preferences are updated. |
account.recovery.create version >= 0.7 | Token Object | This event triggers when the account recovery token is created. |
account.recovery.update version >= 0.7 | Token Object | This event triggers when the account recovery token is validated. |
account.verification.create version >= 0.7 | Token Object | This event triggers when the account verification token is created. |
account.verification.update version >= 0.7 | Token Object | This event triggers when the account verification token is validated. |
account.delete | User Object | This event triggers when the account is deleted. |
account.sessions.create | Session Object | This event triggers when the account session is created. |
account.sessions.delete | Session Object | This event triggers when the account session is deleted. |
database.collections.create | Collection Object | This event triggers when a database collection is created. |
database.collections.update | Collection Object | This event triggers when a database collection is updated. |
database.collections.delete | Collection Object | This event triggers when a database collection is deleted. |
database.documents.create | Any Object | This event triggers when a database document is created. |
database.documents.update | Any Object | This event triggers when a database document is updated. |
database.documents.delete | Any Object | This event triggers when a database document is deleted. |
storage.files.create | File Object | This event triggers when a storage file is created. |
storage.files.update | File Object | This event triggers when a storage file is updated. |
storage.files.delete | File Object | This event triggers when a storage file is deleted. |
users.create version >= 0.7 | User Object | This event triggers when a user is created from the users API. |
users.update.status version >= 0.7 | User Object | This event triggers when a user status is updated from the users API. |
users.delete version >= 0.7 | User Object | This event triggers when a user is deleted from users API. |
users.sessions.delete version >= 0.7 | Session Object | This event triggers when a user session is deleted from users API. |
teams.create version >= 0.7 | Team Object | This event triggers when a team is created. |
teams.update version >= 0.7 | Team Object | This event triggers when a team is updated. |
teams.delete version >= 0.7 | Team Object | This event triggers when a team is deleted. |
teams.memberships.create version >= 0.7 | Membership Object | This event triggers when a team memberships is created. |
teams.memberships.update.status version >= 0.7 | Membership Object | This event triggers when a team memberships status is updated. |
teams.memberships.delete version >= 0.7 | Membership Object | This event triggers when a team memberships is deleted. |