Webhook Guide (Baileys Personal WhatsApp)

Automate replies and process incoming WhatsApp messages using your own webhook.

πŸ”§ How It Works

When a WhatsApp message is received, and your device has a webhook URL configured:

πŸ“¬ Webhook Payload (POST)

Here’s what will be sent to your webhook URL:

{
  "user_id": 123,
  "device_id": "abc123",
  "whatsapp_id": "60123456789@s.whatsapp.net",
  "from": "60123456789",
  "message": "Hello, I need help",
  "message_id": "ABCDEF123456",
  "timestamp": 1722337200
}

Field Reference:

πŸ’‘ Example Webhook Handler (PHP)

Use this sample PHP script to process incoming messages and optionally reply:

<?php
$input = file_get_contents('php://input');
$data = json_decode($input, true);

// Log to file (for development)
file_put_contents('personal_incoming.txt', date('c') . " | " . print_r($data, true), FILE_APPEND);

// Return dynamic reply
$reply = "Thanks! You said: " . $data['message'];
header('Content-Type: application/json');
echo json_encode(['reply' => $reply]);
?>

Expected Webhook Response:

{
  "reply": "Thanks! Your appointment has been scheduled."
}

βœ… Benefits of Using a Webhook

πŸ”’ Security Best Practices

Ready to Connect Your Webhook?

Set your webhook URL under your device settings in your WMS Personal Dashboard.

Create Account