Enabling Webhooks
There are two ways to enable the webhook:- In the
.envfile with global events - By calling the
/webhook/instanceendpoint
Instance Webhook Events
Most users will prefer instance-based activation, as it makes it easier to control the received events. However, in some cases, a global webhook is necessary. This can be done using the global webhook variable. Here is an example with some common events being listened to:/webhook/instance
Parameters
It is extremely necessary that the payload follows the rules to create a JSON file, considering the correct arrangement of items, formatting, brackets, braces, commas, etc.
Before consuming the endpoint, if you have doubts about the JSON formatting, go to https://jsonlint.com/ and validate.
Global Webhook Events
Each instance’s Webhook URL and events will be requested when they are created. Set up a global webhook that will listen to enabled events from all instances..env
Supported Events
These are the available and supported webhook events:Webhook by Events
When enabling the WEBHOOK_BY_EVENTS options in both global and local webhooks, the following paths will be appended to the end of the webhook URL.Add the event name at the end of the URL with a hyphen (-) between the words that make up the event.
Example
Suppose your webhook URL ishttps://sub.domain.com/webhook/. Evolution will automatically add the event name to the end of the URL when webhook_by_events is set to true.
Locating Webhook
If necessary, there is an option to locate any active webhook on the specific instance.Data returned from the request:
Calling the endpoint will return all information about the webhook being used by the instance.Result