Skip to main content

Webhooks

Webhooks allow you to receive real-time notifications when events happen in your WhatsApp account.

Setting up a Webhook

  1. Navigate to the Webhooks page.
  2. Switch the toggle to "Active" globally to enable processing.
  3. Click Add Webhook.
  4. Name: Give your webhook a descriptive name.
  5. URL: The valid HTTPS endpoint where WhatsSpot will send POST requests.
  6. Toggle Active: Turn on "Active" to start receiving events immediately.

Supported Events

WhatsSpot currently supports the following events:

Event NameDescription
message.receivedTriggered when a new message arrives.
message.ackTriggered when a message status changes (sent, delivered, read).
device.disconnectedTriggered when a WhatsApp session is logged out.

Payload Examples

1. Message Received

{
"event": "message.received",
"data": {
"id": "false_1234567890@c.us_3EB0...",
"from": "1234567890",
"to": "YOUR_DEVICE_NUMBER",
"body": "Hello world",
"type": "chat",
"timestamp": 1678900000,
"hasMedia": false
}
}

2. Message Status Update (Ack)

{
"event": "message.ack",
"data": {
"id": "false_1234567890@c.us_3EB0...",
"status": "READ", // SENT, DELIVERED, READ
"ack": 3
}
}

Security & Verification

To ensure requests are coming from WhatsSpot, we include a X-Hub-Signature header if you configured a secret.

// Node.js Example to verify signature
const crypto = require('crypto');
const signature = req.headers['x-hub-signature'];
const expected = crypto.createHmac('sha256', YOUR_SECRET).update(JSON.stringify(req.body)).digest('hex');
if (signature === expected) {
// Verified!
}