Webhooks
Webhooks let you receive real-time HTTP callbacks when events occur on your WhatsApp instances. Instead of polling the API, Wappfy pushes events to your server as they happen.Supported Events
Wappfy supports 12 webhook event types:Message Events
Message Events
| Event | Description |
|---|---|
message.received | A new inbound message was received. |
message.sent | An outbound message was successfully sent. |
message.delivered | A sent message was delivered to the recipient’s device (double check mark). |
message.read | A sent message was read by the recipient (blue check marks). |
message.failed | An outbound message failed to send. |
message.reaction | Someone reacted to a message with an emoji. |
Instance Events
Instance Events
| Event | Description |
|---|---|
instance.connected | An instance successfully connected to WhatsApp. |
instance.disconnected | An instance lost its WhatsApp connection. |
instance.qr | A new QR code is available for scanning. |
Group & Contact Events
Group & Contact Events
| Event | Description |
|---|---|
group.joined | A participant joined a group (including the bot itself). |
group.left | A participant left a group. |
contact.created | A new contact was saved or detected. |
Create a Webhook
Register a webhook endpoint to start receiving events.Configuration Options
| Field | Type | Default | Description |
|---|---|---|---|
url | string | required | The HTTPS URL that will receive webhook POST requests. |
events | string[] | required | Array of event types to subscribe to. |
instance_id | string | null | Scope the webhook to a specific instance. If null, receives events from all instances. |
secret | string | null | Secret used to generate HMAC signatures for payload verification. |
retry_count | number | 3 | Number of retry attempts on delivery failure (0-5). |
timeout_ms | number | 10000 | Request timeout in milliseconds (1000-30000). |
The
instance_id field is optional. If omitted, the webhook will receive events from all instances in your account.List Webhooks
Update a Webhook
Update the URL, events, or configuration of an existing webhook.Delete a Webhook
Delivery Payload Format
When an event occurs, Wappfy sends a POST request to your webhook URL with the following structure:Payload Fields
| Field | Description |
|---|---|
id | Unique delivery ID. Use this for deduplication. |
event | The event type that triggered this delivery. |
instance_id | The instance that generated the event. |
timestamp | ISO 8601 timestamp of when the event occurred. |
data | Event-specific payload. Contents vary by event type. |
HMAC Signature Verification
If you provide asecret when creating a webhook, every delivery will include an X-Wappfy-Signature header containing an HMAC-SHA256 signature of the request body.
Always verify this signature to ensure the request came from Wappfy and was not tampered with.
Verification Examples
Retry Behavior
If your server does not respond with a2xx status code within the configured timeout_ms, Wappfy will retry the delivery.
| Attempt | Delay |
|---|---|
| 1st retry | 10 seconds |
| 2nd retry | 60 seconds |
| 3rd retry | 5 minutes |
| 4th retry | 30 minutes |
| 5th retry | 2 hours |
Retries stop when a
2xx response is received or the retry_count is exhausted. The default retry count is 3.Viewing Delivery History
Check the delivery log for a webhook to see past delivery attempts and their results.Event Payload Examples
message.received
message.received
message.delivered
message.delivered
message.read
message.read
message.reaction
message.reaction
instance.connected
instance.connected
instance.qr
instance.qr
group.joined
group.joined
Best Practices
Respond quickly
Return a
200 status within 5 seconds. Process the event asynchronously to avoid timeouts.Deduplicate
Use the delivery
id to detect and skip duplicate deliveries caused by retries.Verify signatures
Always validate the
X-Wappfy-Signature header if you configured a secret.Use HTTPS
Webhook URLs must use HTTPS. HTTP endpoints will be rejected.