Developer & API
The 3DM Connect API lets your ERP, CRM, HRMS, or custom software send WhatsApp template messages and sync contact data. This guide covers authentication, the main endpoints, ERP webhooks, and how to connect your systems.
Getting Started with the API
All API requests use your company hash for authentication. You send it in the Authorization header as a Bearer token. The base URL for API calls is your 3DM Connect instance (e.g. the same domain where you log in). Endpoints are under the /api/ path. Use POST for all documented endpoints and send JSON in the request body where applicable.
Your Company Hash
The company hash uniquely identifies your account and authenticates API requests.
- Log in to 3DM Connect and go to Developer (or Developer Area / API in the menu).
- Your Company Hash is shown on that page. Copy it and store it securely in your app’s config or environment variables.
- If the hash is ever compromised or you need to rotate it, use the Regenerate option in the same Developer area. Regenerating invalidates the old hash immediately; update all systems that use it.
Send Template API
Use this endpoint to send a pre-approved WhatsApp template to a phone number. Templates are created and approved in 3DM Connect (see Template Management); the API fills in the variables at send time.
Endpoint: POST /api/send-template.php
Authentication: Authorization: Bearer YOUR_COMPANY_HASH
Request body (JSON):
phone_number(string, required) — Recipient number in E.164 format (e.g.923001234567).template_name(string, required) — The exact name of the template as shown in 3DM Connect (e.g.payment_reminder).template_variables(object, optional) — Named key-value pairs for template placeholders. Keys must match the variable names in the template (e.g.customer_name,invoice_number).
Response: JSON with success (true/false), and on success a message_id or similar; on error, error or message describing the failure.
curl -X POST "https://your-3dm-connect-domain.com/api/send-template.php" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_COMPANY_HASH" \
-d '{
"phone_number": "923001234567",
"template_name": "payment_reminder",
"template_variables": {
"customer_name": "Ahmed",
"invoice_number": "INV-2024-001",
"amount": "5,000 PKR",
"due_date": "28 Feb 2024",
"payment_url": "https://pay.example.com/inv/001"
}
}'
$baseUrl = 'https://your-3dm-connect-domain.com';
$companyHash = 'YOUR_COMPANY_HASH';
$payload = [
'phone_number' => '923001234567',
'template_name' => 'payment_reminder',
'template_variables' => [
'customer_name' => 'Ahmed',
'invoice_number' => 'INV-2024-001',
'amount' => '5,000 PKR',
'due_date' => '28 Feb 2024',
'payment_url' => 'https://pay.example.com/inv/001',
],
];
$ch = curl_init($baseUrl . '/api/send-template.php');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Authorization: Bearer ' . $companyHash,
],
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$data = json_decode($response, true);
if ($httpCode === 200 && !empty($data['success'])) {
// Message sent successfully
} else {
// Handle error: $data['error'] or $data['message']
}
Get All Templates API
Retrieves all WhatsApp templates available for your company. Use this to list template names and metadata before calling the Send Template API.
Endpoint: POST /api/get-all-templates.php
Authentication: Authorization: Bearer YOUR_COMPANY_HASH
Request body: Empty JSON object {}.
Response: JSON with success, templates (array of objects with name, category, status, language, body, etc.), and count.
curl -X POST "https://your-3dm-connect-domain.com/api/get-all-templates.php" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_COMPANY_HASH" \
-d '{}'
Get Template Variables API
Returns the list of variables (placeholders) for a specific template. Use this to know which keys to send in template_variables when calling the Send Template API.
Endpoint: POST /api/get-template-variables.php
Authentication: Authorization: Bearer YOUR_COMPANY_HASH
Request body (JSON): { "template_name": "payment_reminder" }
Response: JSON with success, template_name, and variables. The variables object lists named variables for BODY, HEADER, and BUTTON sections (e.g. customer_name, invoice_number).
// Request
POST /api/get-template-variables.php
{ "template_name": "welcome_client" }
// Response
{
"success": true,
"template_name": "welcome_client",
"variables": {
"BODY": ["client_name", "manager_name", "manager_phone"],
"HEADER": [],
"BUTTON": []
}
}
ERP Webhooks
3DM Connect can call your ERP or backend to fetch contact names and extra contact info. You host the endpoints; we send requests to them when we need data (e.g. to display names in the inbox or to enrich a conversation).
Contact name sync webhook
Your ERP exposes an endpoint that accepts a list of phone numbers and returns the corresponding names.
- Request (from 3DM Connect to your ERP): POST with JSON body:
company_hash,phone_numbers(array of E.164 numbers). - Response (from your ERP): JSON with
success: trueandnames— an object mapping phone number to display name (e.g."+923001234567": "Ali Khan").
Contact info webhook
Your ERP exposes an endpoint that returns detailed info for a single contact (e.g. balance, last order, status).
- Request (from 3DM Connect to your ERP): POST with JSON body:
company_hash,phone_e164(single number). - Response (from your ERP): JSON with
success: trueanddata— an object with the fields you want to expose (e.g.balance,last_order,status).
After implementing these endpoints, provide the URLs to 3DM Connect support or enter them in your account’s Developer / Integration settings so we can call them.
Connecting Your ERP / CRM / HRMS
Follow these steps to send WhatsApp messages from your system when business events occur.
-
1
Get your company hash from the Developer area and store it securely in your backend.
-
2
Create templates in 3DM Connect for each message type (payment reminder, welcome, payslip, etc.). Use named variables (e.g.
{{customer_name}},{{invoice_number}}) and get them approved in the WhatsApp template flow. -
3
In your ERP/CRM/HRMS, when an event occurs (invoice created, deal won, salary processed), have your developer call the Send Template API with the recipient phone number, template name, and the correct
template_variablesfor that template. -
4
Optionally implement the ERP webhooks (contact name and contact info) so 3DM Connect can show names and context in the inbox.
Example Integrations
These examples show typical templates and variables for common use cases. All use named variables.
Salary slips from HRMS
When payroll runs, call the Send Template API with the employee’s phone number and the payslip template. Example template body:
Payment reminders from accounting
When an invoice is due, trigger a reminder using a template like:
CRM meeting reminders
When a meeting is scheduled or the day before, send a reminder: