Use the REST API to send messages and receive events via webhooks. Simple endpoints, clear responses, and secure authentication.
1) Create an instance and connect WhatsApp.
2) Generate your API token from /settings.
3) Send your first message using the endpoint below.
http://wapbrigde.com
Use the token generated in Settings. Include it as a bearer token.
Authorization: token <API_KEY>:<API_SECRET>
POST /api/method/wap_bridge.api.whatsapp.send_api_message
Body
from_number – WhatsApp number connected to your instanceto_number – destination number (with country code)message – text contentcurl -X POST http://wapbrigde.com/api/method/wap_bridge.api.whatsapp.send_api_message \
-H "Authorization: token {{ api_key }}:{{ api_secret }}" \
-H "Content-Type: application/json" \
-d '{"from_number":"+255700000000","to_number":"+255755123456","message":"Hello from WapBridge"}'
POST /api/method/wap_bridge.api.whatsapp.send_api_message
Body
from_number – WhatsApp number connected to your instanceto_number – destination number (with country code)media_data – base64 file content (no data URL prefix)mime_type – e.g. image/jpegfilename – original file namecaption – optional text captioncurl -X POST http://wapbrigde.com/api/method/wap_bridge.api.whatsapp.send_api_message \
-H "Authorization: token {{ api_key }}:{{ api_secret }}" \
-H "Content-Type: application/json" \
-d '{"from_number":"+255700000000","to_number":"+255755123456","caption":"Invoice attached","media_data":"<base64>","mime_type":"application/pdf","filename":"invoice.pdf"}'
Use campaigns for throttled bulk sends. You can also manage this in /campaigns UI.
POST /api/method/wap_bridge.api.campaigns.create_and_start_campaignPOST /api/method/wap_bridge.api.campaigns.add_campaign_recipientsPOST /api/method/wap_bridge.api.campaigns.campaign_statusPOST /api/method/wap_bridge.api.campaigns.pause_campaignPOST /api/method/wap_bridge.api.campaigns.resume_campaignPOST /api/method/wap_bridge.api.campaigns.create_and_start_campaign
Body
instance_id – connected instance id (e.g. INST-04-0000186)campaign_name – optional custom namemessage – message textrecipients – dynamic numbers arraycurl -X POST http://wapbrigde.com/api/method/wap_bridge.api.campaigns.create_and_start_campaign \
-H "Authorization: token {{ api_key }}:{{ api_secret }}" \
-H "Content-Type: application/json" \
-d '{"instance_id":"INST-04-0000186","campaign_name":"Promo Batch A","message":"Hello from WapBridge","recipients":["255757111111","255757222222"]}'
POST /api/method/wap_bridge.api.campaigns.add_campaign_recipients
curl -X POST http://wapbrigde.com/api/method/wap_bridge.api.campaigns.add_campaign_recipients \
-H "Authorization: token {{ api_key }}:{{ api_secret }}" \
-H "Content-Type: application/json" \
-d '{"campaign":"WAP-CAM-0001","recipients":[{"phone_number":"255757333333"},{"to_number":"255757444444"}]}'
Status
curl -X POST http://wapbrigde.com/api/method/wap_bridge.api.campaigns.campaign_status \
-H "Authorization: token {{ api_key }}:{{ api_secret }}" \
-H "Content-Type: application/json" \
-d '{"campaign":"WAP-CAM-0001"}'
Pause
curl -X POST http://wapbrigde.com/api/method/wap_bridge.api.campaigns.pause_campaign \
-H "Authorization: token {{ api_key }}:{{ api_secret }}" \
-H "Content-Type: application/json" \
-d '{"campaign":"WAP-CAM-0001"}'
Resume
curl -X POST http://wapbrigde.com/api/method/wap_bridge.api.campaigns.resume_campaign \
-H "Authorization: token {{ api_key }}:{{ api_secret }}" \
-H "Content-Type: application/json" \
-d '{"campaign":"WAP-CAM-0001"}'
Send ERPNext/Frappe Notification Channel = SMS through WapBridge WhatsApp gateway.
SMS Settings
SMS Gateway URL:
http://wapbrigde.com/api/method/wap_bridge.api.whatsapp.erpnext_notification_gateway
Message Parameter: messageReceiver Parameter: to_numberUse POST: enabledStatic Parameters (SMS Settings)
Authorization (Header = 1): token <API_KEY>:<API_SECRET>
instance_id (Header = 0): INST-XX-XXXXXXXX (optional, recommended)Notification
Channel = SMS{{ doc.name }}{
"ok": true,
"service": {
"ok": true,
"id": "true_1234567890"
}
}
Configure your webhook URL in Settings. WapBridge will send inbound messages to your endpoint.
Header (optional)
X-Wapbridge-Secret: <your-secret>
{
"instance_id": "INST-01-0000142",
"customer": "CUST-0143",
"phone_number": "255757197676",
"message": {
"id": "false_120542636048510@lid_A586DC71E697153420998E09871EA237",
"from": "120542636048510@lid",
"to": "255757197676@c.us",
"body": "Sawa",
"fromMe": false,
"timestamp": 1767791640,
"type": "image",
"hasMedia": true,
"caption": "Sawa",
"media": {
"mimetype": "image/jpeg",
"filename": "photo.jpg",
"data": "<base64>"
}
}
}