REST API · v1.0

WaBot API Documentation

Send WhatsApp messages, manage contacts, and trigger campaigns from any system — your PAS, ERP, CRM, or custom application. All endpoints use REST with JSON.

Authentication

All API requests require your API key. Find it in Settings → API & Integrations after signing in.

Send your key as an HTTP header:

# As a request header (recommended) X-API-KEY: your_api_key_here # Or as a query parameter GET https://wabot.co.za/api/send?api_key=your_api_key_here
Keep your API key secret. Never expose it in front-end JavaScript or commit it to public repositories. You can regenerate it at any time from Settings → API.

Base URL

https://wabot.co.za/api

All endpoints return Content-Type: application/json. Request bodies must also be JSON with Content-Type: application/json.

Error Handling

The API uses standard HTTP status codes. All error responses follow this structure:

{ "success": false, "error": "Human-readable error message", "code": "ERROR_CODE" }
StatusMeaning
200Success
400Bad request — missing or invalid parameters
401Unauthorized — invalid or missing API key
403Forbidden — IP not whitelisted or plan limit reached
404Not found
429Rate limit exceeded
500Server error

Rate Limits

PlanRequests / minuteMessages / month
Free10500
Starter60100,000
Pro120999,999
Agency300Unlimited

Send Message

POST /api/send

Send a WhatsApp text message to any phone number. The number must be in international format.

Request Body
ParameterTypeRequiredDescription
phonestringRequiredRecipient phone in international format: 27821234567
messagestringRequiredText message content. Supports WhatsApp formatting (*bold*, _italic_, ~strikethrough~)
account_idintegerOptionalWhatsApp account ID to send from. Defaults to your primary connected account.
Code Examples
<?php $apiKey = 'your_api_key_here'; $baseUrl = 'https://wabot.co.za/api'; $payload = [ 'phone' => '27821234567', 'message' => 'Welcome to Acme Insurance! Your new policy #POL-001 is now active. Reply HELP for assistance.', ]; $ch = curl_init($baseUrl . '/send'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => json_encode($payload), CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'X-API-KEY: ' . $apiKey, ], ]); $response = json_decode(curl_exec($ch), true); curl_close($ch); if ($response['success']) { echo "Message sent! ID: " . $response['message_id']; } else { echo "Error: " . $response['error']; }
import requests api_key = 'your_api_key_here' base_url = 'https://wabot.co.za/api' payload = { 'phone': '27821234567', 'message': 'Welcome to Acme Insurance! Your new policy #POL-001 is now active.', } response = requests.post( f'{base_url}/send', json=payload, headers={ 'X-API-KEY': api_key, 'Content-Type': 'application/json', } ) data = response.json() if data['success']: print(f"Message sent! ID: {data['message_id']}") else: print(f"Error: {data['error']}")
import java.net.http.*; import java.net.URI; import org.json.JSONObject; public class WaBotClient { private static final String API_KEY = "your_api_key_here"; private static final String BASE_URL = "https://wabot.co.za/api"; public static void sendMessage(String phone, String message) throws Exception { JSONObject payload = new JSONObject() .put("phone", phone) .put("message", message); HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(BASE_URL + "/send")) .header("Content-Type", "application/json") .header("X-API-KEY", API_KEY) .POST(HttpRequest.BodyPublishers.ofString(payload.toString())) .build(); HttpResponse<String> response = client.send( request, HttpResponse.BodyHandlers.ofString()); JSONObject result = new JSONObject(response.body()); if (result.getBoolean("success")) { System.out.println("Sent! ID: " + result.getString("message_id")); } else { System.out.println("Error: " + result.getString("error")); } } public static void main(String[] args) throws Exception { sendMessage("27821234567", "Welcome! Your policy #POL-001 is now active."); } }
// Node.js (built-in fetch, v18+) or browser const API_KEY = 'your_api_key_here'; const BASE_URL = 'https://wabot.co.za/api'; async function sendWhatsApp(phone, message) { const response = await fetch(`${BASE_URL}/send`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-API-KEY': API_KEY, }, body: JSON.stringify({ phone, message }), }); const data = await response.json(); if (data.success) { console.log('Sent! ID:', data.message_id); } else { throw new Error(data.error); } return data; } // Usage sendWhatsApp('27821234567', 'Welcome! Your policy is now active.') .then(console.log) .catch(console.error);
curl -X POST https://wabot.co.za/api/send \ -H "Content-Type: application/json" \ -H "X-API-KEY: your_api_key_here" \ -d '{ "phone": "27821234567", "message": "Welcome! Your policy #POL-001 is now active." }'
Response
{ "success": true, "message_id": "msg_a1b2c3d4e5f6", "phone": "27821234567", "status": "sent" }

Create Contact

POST /api/contacts

Add a contact to your WaBot account. If the phone number already exists, the contact is updated.

Request Body
ParameterTypeRequiredDescription
phonestringRequiredPhone in international format: 27821234567
namestringRequiredContact full name
emailstringOptionalEmail address
companystringOptionalCompany or employer name
tagsstringOptionalComma-separated tags: member,policy,active
notesstringOptionalInternal notes (e.g. policy number, member ID)
Code Examples
<?php $payload = [ 'phone' => '27821234567', 'name' => 'John Smith', 'email' => 'john.smith@email.co.za', 'company' => 'ABC Holdings', 'tags' => 'member,active,medical-aid', 'notes' => 'Policy: POL-001 | Member ID: MEM-4521', ]; $ch = curl_init('https://wabot.co.za/api/contacts'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => json_encode($payload), CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'X-API-KEY: your_api_key_here', ], ]); $response = json_decode(curl_exec($ch), true); curl_close($ch); if ($response['success']) { echo "Contact saved. ID: " . $response['contact_id']; }
import requests response = requests.post( 'https://wabot.co.za/api/contacts', json={ 'phone': '27821234567', 'name': 'John Smith', 'email': 'john.smith@email.co.za', 'company': 'ABC Holdings', 'tags': 'member,active', 'notes': 'Policy: POL-001 | Member ID: MEM-4521', }, headers={'X-API-KEY': 'your_api_key_here'} ) data = response.json() print('Contact ID:', data['contact_id'])
JSONObject payload = new JSONObject() .put("phone", "27821234567") .put("name", "John Smith") .put("email", "john.smith@email.co.za") .put("company", "ABC Holdings") .put("tags", "member,active") .put("notes", "Policy: POL-001 | Member ID: MEM-4521"); // Same HTTP request pattern as Send Message above
await fetch('https://wabot.co.za/api/contacts', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-API-KEY': 'your_api_key_here', }, body: JSON.stringify({ phone: '27821234567', name: 'John Smith', email: 'john.smith@email.co.za', company: 'ABC Holdings', tags: 'member,active', notes: 'Policy: POL-001 | Member ID: MEM-4521', }), });

List Contacts

GET /api/contacts

Returns a paginated list of contacts.

Query Parameters
ParameterDefaultDescription
page1Page number
limit25Results per page (max 100)
searchSearch by name or phone
tagsFilter by tag (comma-separated)
curl -H "X-API-KEY: your_api_key_here" \ "https://wabot.co.za/api/contacts?search=john&tags=member&page=1"

PAS System Integration

Policy Administration System (PAS) Integration
This guide shows how to send automatic WhatsApp welcome messages when you create a new policy or add a member in your PAS system.
Recommended flow
1
Create Policy / Add Member
Your PAS creates the record as normal. No changes to your core flow.
2
Add Contact to WaBot
POST to /api/contacts with the member's details and policy number in notes/tags.
3
Send Welcome Message
POST to /api/send with the personalised welcome message.
4
Log the Response
Store the message_id returned by WaBot against the policy record for tracking.
Complete PHP example — new member welcome
<?php /** * WaBot PAS Integration Helper * Call this after successfully creating a policy/member in your PAS. */ function sendWabotWelcome(array $member, array $policy): bool { $apiKey = $_ENV['WABOT_API_KEY']; // store in .env, never hardcode $baseUrl = 'https://wabot.co.za/api'; // Step 1: Upsert contact $contactPayload = [ 'phone' => preg_replace('/\D/', '', $member['cell_number']), 'name' => $member['full_name'], 'email' => $member['email'] ?? '', 'company' => $member['employer'] ?? '', 'tags' => 'member,active,' . strtolower($policy['product_type']), 'notes' => 'Policy: ' . $policy['policy_number'] . ' | Plan: ' . $policy['plan_name'], ]; $contact = wabotRequest($baseUrl . '/contacts', $contactPayload, $apiKey); if (!$contact['success']) return false; // Step 2: Send personalised welcome message $message = "Hello {$member['first_name']}! 👋\n\n"; $message .= "Welcome to *{$policy['insurer_name']}*.\n\n"; $message .= "Your policy details:\n"; $message .= "📋 Policy No: *{$policy['policy_number']}*\n"; $message .= "📦 Plan: *{$policy['plan_name']}*\n"; $message .= "📅 Effective: *{$policy['start_date']}*\n\n"; $message .= "Reply *HELP* at any time for assistance."; $msgPayload = [ 'phone' => $contactPayload['phone'], 'message' => $message, ]; $result = wabotRequest($baseUrl . '/send', $msgPayload, $apiKey); return $result['success'] === true; } function wabotRequest(string $url, array $data, string $apiKey): array { $ch = curl_init($url); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => json_encode($data), CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'X-API-KEY: ' . $apiKey, ], CURLOPT_TIMEOUT => 10, ]); $body = curl_exec($ch); curl_close($ch); return json_decode($body, true) ?? ['success' => false]; } // --- Usage in your PAS create-policy flow --- if ($policyCreated) { sendWabotWelcome($memberData, $policyData); }
Need help with your integration? Our team has experience integrating WaBot with PAS systems, medical aid platforms, and ERP systems. Book a free integration call →

Ready to integrate?

Get your API key in 2 minutes — free plan included.