1
Send Message Gateway
Authenticate and send alerts by posting parameters to our global serverless edge gateway function. Use secure API key headers.
POST
https://massivsend.com/functions/v1/send-transactional
| Header | Type | Description |
|---|---|---|
Content-Type |
String | Set to application/json |
x-api-key |
String | Your private API key (starts with ms_live_) |
2
JSON Request Body
Provide the destination number, Meta approved template identifier, language code, and dynamic variables mapped by index keys.
{
"phoneNumber": "+919876543210",
"templateName": "order_tracking",
"language": "en",
"parameters": {
"1": "Alex Mercer",
"2": "549201",
"3": "https://massivsend.com/track/549201"
}
}
| Field | Type | Required | Description |
|---|---|---|---|
phoneNumber |
String | Yes | Recipient number with country code (e.g. +919876543210). |
templateName |
String | Yes | The template identifier approved in your Meta Dashboard. |
language |
String | Yes | Standard 2-letter language code of the template (e.g. en). |
parameters |
Object | No | Index key string mapping variables (e.g. "1" -> "John Doe"). |
3
Code Snippets
Select your language to copy pre-configured scripts for WooCommerce, WordPress, Node.js, Python, or Java.
const axios = require('axios');
const sendWhatsApp = async () => {
try {
const response = await axios.post(
'https://massivsend.com/functions/v1/send-transactional',
{
phoneNumber: '+919876543210',
templateName: 'order_tracking',
language: 'en',
parameters: {
"1": "John Doe",
"2": "893041",
"3": "https://massivsend.com/track/893041"
}
},
{
headers: {
'Content-Type': 'application/json',
'x-api-key': 'ms_live_your_api_key_here'
}
}
);
console.log('Success:', response.data);
} catch (error) {
console.error('Error:', error.response?.data || error.message);
}
};
sendWhatsApp();
import requests
url = "https://massivsend.com/functions/v1/send-transactional"
headers = {
"Content-Type": "application/json",
"x-api-key": "ms_live_your_api_key_here"
}
payload = {
"phoneNumber": "+919876543210",
"templateName": "order_tracking",
"language": "en",
"parameters": {
"1": "John Doe",
"2": "893041",
"3": "https://massivsend.com/track/893041"
}
}
response = requests.post(url, json=payload, headers=headers)
print(response.status_code)
print(response.json())
function send_whatsapp_alert($phone, $name, $order_id, $tracking_url) {
$url = 'https://massivsend.com/functions/v1/send-transactional';
$body = array(
'phoneNumber' => $phone,
'templateName' => 'order_tracking',
'language' => 'en',
'parameters' => array(
'1' => $name,
'2' => $order_id,
'3' => $tracking_url
)
);
$args = array(
'body' => json_encode($body),
'headers' => array(
'Content-Type' => 'application/json',
'x-api-key' => 'ms_live_your_api_key_here'
),
'timeout' => 15,
'data_format' => 'body'
);
$response = wp_remote_post($url, $args);
return is_wp_error($response) ? false : json_decode(wp_remote_retrieve_body($response), true);
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class MassivSendSender {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String jsonPayload = """
{
"phoneNumber": "+919876543210",
"templateName": "order_tracking",
"language": "en",
"parameters": {
"1": "John Doe",
"2": "893041",
"3": "https://massivsend.com/track/893041"
}
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://massivsend.com/functions/v1/send-transactional"))
.header("Content-Type", "application/json")
.header("x-api-key", "ms_live_your_api_key_here")
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
.build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println("Status: " + response.statusCode());
System.out.println("Response: " + response.body());
}
}
curl -X POST https://massivsend.com/functions/v1/send-transactional \
-H "Content-Type: application/json" \
-H "x-api-key: ms_live_your_api_key_here" \
-d '{
"phoneNumber": "+919876543210",
"templateName": "order_tracking",
"language": "en",
"parameters": {
"1": "John Doe",
"2": "893041",
"3": "https://massivsend.com/track/893041"
}
}'
4
Webhook Forwarding
Paste your public server URL inside **Settings > API Configuration**. When a customer replies, we forward the response payload instantly.
Incoming JSON Webhook Schema
{
"from": "+919876543210",
"text": "Yes, please confirm shipping.",
"messageId": "wamid.HBgLMjMxNDM2...",
"timestamp": 1784123218
}
Implementation Checklist
- Create a public
POSTendpoint on your backend server (WooCommerce custom route, Express router, Django controller, etc.). - Navigate to Settings > API Configuration in your MassivSend app dashboard.
- Paste your endpoint URL under the "Webhook Forwarding URL" input field.
- Ensure your endpoint processes payloads asynchronously and returns a
200 OKwithin 3 seconds.