MazBot API Documentation
Version 2.0 | Updated: April 2025Introduction
The MazBot API enables seamless WhatsApp messaging integration for your applications. Explore endpoints, request/response formats, and examples below.
Best Practices
- Securely store JWT tokens
- Validate phone numbers
- Implement retry logic
- Cache template IDs
- Respect rate limits (60 requests/minute)
Rate Limiting
All API endpoints are rate limited to prevent abuse and ensure fair usage.
| Property | Value |
|---|---|
| Rate Limit | 60 requests per minute |
| Tracking | By authenticated user ID or IP address |
| Error Response | HTTP 429 (Too Many Requests) |
| Headers | Not currently implemented (X-RateLimit-* headers) |
Pagination
Paginated endpoints return consistent pagination metadata. Items per page are fixed and cannot be customized.
| Endpoint | Per Page |
|---|---|
| /contacts | 10 items |
| /chat-rooms | 20 items |
| /team | 10 items |
Pagination Response Format
{
"paginate": {
"total": 150,
"current_page": 1,
"per_page": 10,
"last_page": 15,
"prev_page_url": null,
"next_page_url": "https://mazbot.net/api/endpoint?page=2",
"path": "https://mazbot.net/api/endpoint"
}
}
Authentication
Authenticate to obtain a JWT token for API requests.
Login Endpoint
Request Parameters
| Parameter | Type | Description |
|---|---|---|
| string | Registered MazBot email | |
| password | string | MazBot account password |
Request Headers
| Header | Value |
|---|---|
| apiKey | Your MazBot API Key |
PHP Example
curl_setopt_array($curl, [
CURLOPT_URL => 'https://mazbot.net/api/login',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query([
'email' => '[email protected]',
'password' => 'your_password'
]),
CURLOPT_HTTPHEADER => ['apiKey: your_api_key'],
]);
$response = curl_exec($curl);
curl_close($curl);
$loginResponse = json_decode($response, true);
$jwtToken = $loginResponse['data']['token'] ?? null;
if (!$jwtToken) {
throw new Exception('Login failed: ' . ($loginResponse['message'] ?? 'Unknown error'));
}
Python Example
JavaScript Example
HTTP Example
Success Response
{
"success": true,
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
}
Error Response
{
"success": false,
"message": "Invalid credentials"
}
Sending WhatsApp Messages
Use your JWT token to send WhatsApp template messages.
template_id by
visiting https://mazbot.net/client/templates and hovering over the "Edit"
button for your desired template.
{{1}}, {{2}}), you must include the body_values and
body_matchs arrays in your request to map values to these placeholders. The number of
variables
in your template determines the structure of these arrays.
Payment Reminder:
Account Name: {{1}}
Current Plan Expiry Date: {{2}}
Please make the payment now to avoid service interruption.
Kindly ignore this message if you have already made the payment.
For this template, use the following code:
$templateData = [
'template_id' => '93',
'mobile' => '20123456789',
'body_values' => [
'1' => 'Ahmed',
'2' => '2024-09-01'
],
'body_matchs' => [
'1' => 'input_value',
'2' => 'input_value'
]
];
Important: Adjust the body_values and body_matchs
arrays to
match the number of placeholders in your template. For example, a template with three placeholders
({{1}}, {{2}}, {{3}}) requires three entries in each
array.
Send Template Endpoint
Request Parameters
| Field | Type | Description |
|---|---|---|
| template_id | string | Template ID from MazBot dashboard |
| mobile | string | Recipient's phone number (e.g., 20123456789) |
| body_values | array | Optional template placeholder values |
| body_matchs | array | Optional placeholder match labels |
Request Headers
| Header | Value |
|---|---|
| apiKey | Your MazBot API Key |
| Authorization | Bearer YOUR_JWT_TOKEN |
| Content-Type | application/json |
PHP Example (With Variables)
$templateData = [
'template_id' => '93',
'mobile' => '20123456789',
'body_values' => [
'1' => 'Ahmed',
'2' => '2024-09-01'
],
'body_matchs' => [
'1' => 'input_value',
'2' => 'input_value'
]
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://mazbot.net/api/whatsapp/send-template',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($templateData),
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'apiKey: your_api_key',
'Authorization: Bearer your_jwt_token'
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Python Example (With Variables)
JavaScript Example (With Variables)
HTTP Example (With Variables)
Success Response
{
"success": true,
"data": {
"message_id": "ABEGkYZI4pQIDAgASkQw",
"status": "sent"
}
}
Team Management API
Manage your team members (staff) with full CRUD operations. Use these endpoints to add, update, and view team members.
Get All Team Members
Returns a list of all team members.
PHP Example
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://mazbot.net/api/team',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer your_jwt_token'
],
]);
$response = curl_exec($curl);
curl_close($curl);
$teamData = json_decode($response, true);
Add Team Member
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| first_name | string | Yes | Team member's first name |
| last_name | string | Yes | Team member's last name |
| phone | string | No | Phone number with country code |
| string | Yes | Email address | |
| password | string | Yes | Account password |
| permissions | array | No | List of permission strings |
PHP Example
$teamData = [
'first_name' => 'Ahmed',
'last_name' => 'Mohamed',
'phone' => '+201234567890',
'email' => '[email protected]',
'password' => 'securePassword123',
'permissions' => ['read:team', 'write:contacts']
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://mazbot.net/api/team-store',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($teamData),
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Authorization: Bearer your_jwt_token'
],
]);
$response = curl_exec($curl);
curl_close($curl);
Update Team Member
Updates an existing team member's information.
WhatsApp API
Manage WhatsApp contacts and contact lists.
Get All Contacts
Returns a list of all WhatsApp contacts.
Add Contact
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Contact name |
| phone | string | Yes | Phone number with country code |
| country_id | integer | No | Country ID |
| status | integer | No | 1 = Active, 0 = Inactive |
PHP Example
$contactData = [
'name' => 'Ahmed Mohamed',
'phone' => '+201234567890',
'country_id' => 1,
'status' => 1
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://mazbot.net/api/whatsapp-contact-store',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($contactData),
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Authorization: Bearer your_jwt_token'
],
]);
$response = curl_exec($curl);
curl_close($curl);
Get All Contact Lists
Returns a list of all WhatsApp contact lists.
Contact Management API
Manage contacts with full CRUD operations, pagination, and block functionality.
Get All Contacts
Retrieve a paginated list of all contacts.
PHP Example
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://mazbot.net/api/contacts?page=1',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer your_jwt_token'
],
]);
$response = curl_exec($curl);
curl_close($curl);
$data = json_decode($response, true);
print_r($data['data']['contacts']);
JSON Response Example
{
"status": true,
"message": "data_retrieved_successfully",
"data": {
"contacts": [
{
"id": 101,
"name": "Ahmed Mohamed",
"phone": "+201234567890",
"email": "[email protected]",
"type": "whatsapp",
"status": 1
}
],
"paginate": {
"total": 150,
"current_page": 1,
"per_page": 10,
"last_page": 15,
"next_page_url": "https://mazbot.net/api/contacts?page=2"
}
}
}
Create Contact
Add a new contact to the system.
PHP Example
$contactData = [
'phone' => '01234567890',
'country_id' => 1,
'name' => 'Ahmed Mohamed',
'email' => '[email protected]'
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://mazbot.net/api/contacts',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($contactData),
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Authorization: Bearer your_jwt_token'
],
]);
$response = curl_exec($curl);
curl_close($curl);
Update Contact
Update an existing contact's information.
Block Contact
Block or unblock a contact to prevent/allow messaging.
Chat Management API
Manage chat rooms and messages.
Get Chat Rooms
Retrieve a list of chat rooms with search and filter options.
PHP Example
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://mazbot.net/api/chat-rooms?page=1&type=whatsapp',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer your_jwt_token'
],
]);
$response = curl_exec($curl);
curl_close($curl);
$data = json_decode($response, true);
print_r($data['data']['chat_rooms']);
JSON Response Example
{
"status": true,
"message": "chat_retrieved_successfully",
"data": {
"chat_rooms": [
{
"id": 1,
"contact_name": "Ahmed Mohamed",
"phone": "+201234567890",
"last_message": "Hello, how can I help you?",
"unread_count": 3,
"last_conversation_at": "2025-12-29T10:30:00Z"
}
],
"total_unread_messages": 12,
"next_page_url": true
}
}
Get Messages
Get all messages for a specific contact/chatroom.
PHP Example
$contactId = 123;
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mazbot.net/api/chatroom-messages/{$contactId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer your_jwt_token'
],
]);
$response = curl_exec($curl);
curl_close($curl);
Clear Chat
Delete all messages in a chat room.
Media & Files API
Manage shared files and media in conversations.
Get Shared Files
Delete File
AI Auto-Reply API
Manage AI auto-reply settings for contacts.
Toggle AI Auto-Reply
Enable or disable AI auto-reply for a specific contact.
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| contact_id | integer | Yes | Contact ID |
| ai_reply_enabled | boolean | No | True to enable, false to disable. If omitted, toggles current state. |
PHP Example
$data = [
'contact_id' => 123,
'ai_reply_enabled' => true
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://mazbot.net/api/toggle-contact-ai-reply',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Authorization: Bearer your_jwt_token'
],
]);
$response = curl_exec($curl);
curl_close($curl);
JSON Response Example
{
"success": true,
"message": "AI auto-reply enabled for this contact",
"ai_reply_enabled": true,
"contact_id": 123
}
Client & Staff API
Assign staff to contacts and view contact details.
Assign Staff
Assign a staff member to handle a specific contact.
PHP Example
$data = [
'contact_id' => 101,
'staff_id' => 5
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://mazbot.net/api/assign-staff',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Authorization: Bearer your_jwt_token'
],
]);
$response = curl_exec($curl);
curl_close($curl);
Contact Details
Get detailed information about a specific contact including notes and tags.
Ticket System API
Create and manage support tickets.
Get All Tickets
Create Ticket
Reply to Ticket
Ready to Integrate!
Start building with the MazBot API. Contact support for assistance.