Skip to main content

Webhooks

Webhooks are a way for an app to send automated real-time notifications to another app when a specific event occurs. In Manifest, there are 8 predefined events where you can hook HTTP requests.

Webhooks are useful to connect other applications or to trigger a micro-service like notifying someone or update a file.

Syntax

manifest/backend.yml
entities:
# You can attach one or several webhooks to each entity event.
Cat 😺:
properties:
- name
hooks:
beforeCreate:
- { url: 'https://my-webhook.com' }

Dog 🐶:
properties:
- name
hooks:
afterDelete:
# Pass .env variables with ${} interpolation.
- {
url: 'https://another-webhook.com',
headers: { authorization: 'Bearer ${API_KEY}' }
}
# Specific HTTP method.
- { url: 'https://another-one.com', method: 'PATCH' }

Webhook params

You can pass arguments using the long syntax:

OptionDefaultTypeDescription
url*-stringThe URL of your webhook
methodPOSTHTTP MethodThe HTTP method of the request
headers{}objectOptional headers of the request. Use ${MY_DOTENV_VAR} syntax to use dotenv variables

Available HTTP Methods are GET, POST, PUT, PATCH and DELETE.

note

Manifest does not enforce HTTP request success or failure; the lifecycle process continues regardless.

Webhook body

Manifest attaches a JSON body with key information about the record concerned to the webhook HTTP request.

The main structure of the body of the triggered HTTP requests will remain the same and only the record value will change: on before events the record will contain your payload, whereas in after requests, the record value will reflect the item after the operation.

This is the structure of the body:

HTTP request body (content-type is application/json)
{
"event": "beforeUpdate",
"createdAt": "2025-01-22T13:38:48.399Z",
"entity": "posts",
"record": {
"title": "my title",
"content": "my content"
}
}

Hook events

This is the list and description of the 8 hook events available. All of them are related to an entity

NameDescription
beforeCreateBefore creating a record
afterCreateAfter creating a record
beforeUpdateBefore updating a record
afterUpdateAfter updating a record
beforeDeleteBefore deleting a record
afterDeleteAfter deleting a record