REST API Documentation
Comprehensive API for integrating WhatsApp messaging into your functionality.
Getting Started
Before using our REST API, you need to set up your account and link your WhatsApp device. Follow these simple steps:
Link Your Device
First, you need to link your WhatsApp number to our platform. Scan the QR code to connect your device instantaneously.
Go to Device LinkedGet API Keys
Create an App to generate your unique App Key and Auth Key. You will need these keys to authenticate your API requests.
Go to Apps ManagerIntroduction
Our REST API allows you to programmatically send WhatsApp messages, including text, media, and templates. Integration is simple with standard HTTP requests.
Parameters
| S/N | Value | Type | Required | Description |
|---|---|---|---|---|
| 1 | appkey |
string | Yes | Used to authorize a transaction for the app |
| 2 | authkey |
string | Yes | Used to authorize a transaction for the valid user |
| 3 | to |
number | Yes | Who will receive the message (Whatsapp number with country code) |
| 4 | template_id |
string | No | Used for template messages |
| 5 | message |
string | No | The transactional message content (max: 1000 words) |
| 6 | file |
string | No | File URL (jpg, jpeg, png, webp, pdf, docx, xlsx, csv, txt) |
| 7 | variables |
Array | No | Replaces variables in template (e.g. {1}, {2}) |
Code Examples
Text Message Only
curl --location --request POST 'https://tawhub.test/api/create-message' \
--form 'appkey="2f82cc75-4708-4dfa-9b53-2e2b0ad6fcbf"' \
--form 'authkey="oPSozpciuOudVlBl5im77LZuqIaxFCvboiUM9YhkLIk1hRQKWP"' \
--form 'to="RECEIVER_NUMBER"' \
--form 'message="Example message"'
Text Message with File
curl --location --request POST 'https://tawhub.test/api/create-message' \
--form 'appkey="2f82cc75-4708-4dfa-9b53-2e2b0ad6fcbf"' \
--form 'authkey="oPSozpciuOudVlBl5im77LZuqIaxFCvboiUM9YhkLIk1hRQKWP"' \
--form 'to="RECEIVER_NUMBER"' \
--form 'message="Example message"' \
--form 'file="https://www.africau.edu/images/default/sample.pdf"'
Template Only
curl --location --request POST 'https://tawhub.test/api/create-message' \
--form 'appkey="2f82cc75-4708-4dfa-9b53-2e2b0ad6fcbf"' \
--form 'authkey="oPSozpciuOudVlBl5im77LZuqIaxFCvboiUM9YhkLIk1hRQKWP"' \
--form 'to="RECEIVER_NUMBER"' \
--form 'template_id="TEMPLATE_ID"' \
--form 'variables[{variableKey1}]="jhone"' \
--form 'variables[{variableKey2}]="replaceable value"'
Text Message Only
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://tawhub.test/api/create-message',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array(
'appkey' => '2f82cc75-4708-4dfa-9b53-2e2b0ad6fcbf',
'authkey' => 'oPSozpciuOudVlBl5im77LZuqIaxFCvboiUM9YhkLIk1hRQKWP',
'to' => 'RECEIVER_NUMBER',
'message' => 'Example message',
'sandbox' => 'false'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Text Message with File
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://tawhub.test/api/create-message',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array(
'appkey' => '2f82cc75-4708-4dfa-9b53-2e2b0ad6fcbf',
'authkey' => 'oPSozpciuOudVlBl5im77LZuqIaxFCvboiUM9YhkLIk1hRQKWP',
'to' => 'RECEIVER_NUMBER',
'message' => 'Example message',
'file' => 'https://www.africau.edu/images/default/sample.pdf',
'sandbox' => 'false'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Template Message Only
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://tawhub.test/api/create-message',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array(
'appkey' => '2f82cc75-4708-4dfa-9b53-2e2b0ad6fcbf',
'authkey' => 'oPSozpciuOudVlBl5im77LZuqIaxFCvboiUM9YhkLIk1hRQKWP',
'to' => 'RECEIVER_NUMBER',
'template_id' => 'TEMPLATE_ID',
'variables' => array(
'{variableKey1}' => 'Jhone',
'{variableKey2}' => 'replaceable value'
)
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Text Message Only
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://tawhub.test/api/create-message',
'headers': {
},
formData: {
'appkey': '2f82cc75-4708-4dfa-9b53-2e2b0ad6fcbf',
'authkey': 'oPSozpciuOudVlBl5im77LZuqIaxFCvboiUM9YhkLIk1hRQKWP',
'to': 'RECEIVER_NUMBER',
'message': 'Example message'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Text Message With File
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://tawhub.test/api/create-message',
'headers': {
},
formData: {
'appkey': '2f82cc75-4708-4dfa-9b53-2e2b0ad6fcbf',
'authkey': 'oPSozpciuOudVlBl5im77LZuqIaxFCvboiUM9YhkLIk1hRQKWP',
'to': 'RECEIVER_NUMBER',
'message': 'Example message',
'file': 'https://www.africau.edu/images/default/sample.pdf'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Template Only
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://tawhub.test/api/create-message',
'headers': {
},
formData: {
'appkey': '2f82cc75-4708-4dfa-9b53-2e2b0ad6fcbf',
'authkey': 'oPSozpciuOudVlBl5im77LZuqIaxFCvboiUM9YhkLIk1hRQKWP',
'to': 'RECEIVER_NUMBER',
'template_id': 'SELECTED_TEMPLATE_ID',
'variables': {
'{variableKey1}' : 'jhone',
'{variableKey2}' : 'replaceable value'
}
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Text Message Only
import requests
url = "https://tawhub.test/api/create-message"
payload={
'appkey': '2f82cc75-4708-4dfa-9b53-2e2b0ad6fcbf',
'authkey': 'oPSozpciuOudVlBl5im77LZuqIaxFCvboiUM9YhkLIk1hRQKWP',
'to': 'RECEIVER_NUMBER',
'message': 'Example message',
}
files=[]
headers = {}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
Ready-to-use WordPress Plugin
Integrate Tawhub with your WordPress/WooCommerce site easily.
- Support for ALL Order Statuses (Pending, Processing, Completed, etc.)
- Admin Notifications for New Orders
- Rich Message Templates with Order Items & Totals
- Test Connection Feature
ZIP Archive
Installation
- Download the plugin zip file.
- In WordPress Admin: Plugins -> Add New -> Upload Plugin.
- Activate the plugin.
- Go to Settings -> Tawhub WhatsApp to enter App/Auth Keys.
Developer Usage
Use the global function anywhere in your theme/plugins:
tawhub_send_whatsapp(
'201xxxxxxxxx',
'Message text',
'https://file-url.pdf' // optional
);
Successful Callbacks
{
"message_status": "Success",
"data": {
"from": "SENDER_NUMBER",
"to": "RECEIVER_NUMBER",
"status_code": 200
}
}
Ready To Scale? 🚀
Join thousands of businesses already using our platform to engage customers and grow their business.