๐ฑ WhatsApp Cloud API
WhatsApp is connected via Meta's Cloud API โ the official, free-tier-available API that lets you send and receive WhatsApp messages from your own server. No third-party BSP (Business Solution Provider) is required.
Prerequisitesโ
- A Meta Developer account at developers.facebook.com
- A Meta Business Account (a.k.a. Business Manager)
- A phone number for WhatsApp that is not already registered on personal WhatsApp (you can use a SIM, a virtual number, or a landline)
Setup Stepsโ
1. Create a Meta Appโ
- Go to developers.facebook.com/apps
- Click Create App
- Choose Business type
- Fill in a name and connect your Business Account
2. Add the WhatsApp Productโ
- In your app's dashboard, scroll to Add Products to Your App
- Click Set Up on WhatsApp
- Select your Business Account
3. Get Your Credentialsโ
Navigate to WhatsApp โ API Setup in your app dashboard:
| Credential | Where to Find It |
|---|---|
| Phone Number ID | Listed under "From" section โ a numeric ID like 123456789012345 |
| Access Token | The temporary token shown on this page. For production, generate a permanent token via System Users. |
| App Secret | App Dashboard โ Settings โ Basic โ App Secret |
| Verify Token | A string you make up yourself โ any random string, e.g. my_secret_verify_token_2024 |
4. Add the Channel in PulseHubโ
- Go to Channels โ Add Channel
- Select WhatsApp
- Fill in all four fields
- Click Save Channel
- Copy the Webhook URL shown on the channel card
5. Configure the Webhook in Metaโ
- In your Meta app, go to WhatsApp โ Configuration
- Click Edit next to the Webhook section
- Callback URL: paste your PulseHub webhook URL
- Verify Token: enter the same string you put in PulseHub
- Click Verify and Save
Meta will make a GET request to your webhook URL with ?hub.mode=subscribe&hub.verify_token=...&hub.challenge=.... PulseHub checks the verify token and echoes back the challenge.
- Under Webhook Fields, subscribe to: messages
6. Testโ
Send a WhatsApp message to your business number. It should appear as a new conversation in PulseHub's inbox within seconds.
Signature Verificationโ
Meta includes an X-Hub-Signature-256 header on every webhook:
X-Hub-Signature-256: sha256=abc123...
PulseHub verifies it using HMAC-SHA256 with your App Secret. If verification fails, the webhook returns 401 Signature mismatch.
Sending Messagesโ
When an agent sends a reply from the inbox, PulseHub calls the WhatsApp Cloud API:
POST https://graph.facebook.com/v18.0/{phone_number_id}/messages
Authorization: Bearer {access_token}
{
"messaging_product": "whatsapp",
"to": "{recipient_phone}",
"type": "text",
"text": {"body": "Your reply here"}
}
Production Accessโ
The default Meta app is in Development mode โ it can only message numbers added as test numbers. To go live:
- Complete the Business Verification in Meta Business Manager
- Submit your WhatsApp use case for Meta's review
- Once approved, your app gains access to message all WhatsApp users
Common Issuesโ
| Symptom | Likely Cause |
|---|---|
| Verification fails during webhook setup | verify_token in PulseHub doesn't match what you entered in Meta |
| Signature mismatch error in logs | Wrong app_secret โ copy it from App Settings โ Basic, not from API Setup |
| Messages not arriving | Webhook field messages not subscribed in Meta dashboard |
Invalid phone number when sending | Number format must be E.164 without + (e.g. 15551234567) |
| App in Development mode error | Only verified test numbers can receive messages in dev mode |