Messages
Send raw WhatsApp template message
Queue a WhatsApp template payload through a connected WhatsApp Business account. When using an AUTHENTICATION template, optional channels can define the message flow.
POST
/
messages
/
send
/
raw
Send raw WhatsApp template message
curl --request POST \
--url https://modawer.com/api/messages/send/raw \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <x-api-key>' \
--data '
{
"whatsappBusinessId": "<string>",
"phoneNumberId": "<string>",
"payload": {
"recipient": "<string>",
"to": "<string>",
"type": "template",
"template": {
"name": "<string>",
"language": {
"code": "<string>"
},
"components": [
{}
]
}
},
"channels": [
"WhatsApp"
]
}
'import requests
url = "https://modawer.com/api/messages/send/raw"
payload = {
"whatsappBusinessId": "<string>",
"phoneNumberId": "<string>",
"payload": {
"recipient": "<string>",
"to": "<string>",
"type": "template",
"template": {
"name": "<string>",
"language": { "code": "<string>" },
"components": [{}]
}
},
"channels": ["WhatsApp"]
}
headers = {
"X-API-KEY": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
whatsappBusinessId: '<string>',
phoneNumberId: '<string>',
payload: {
recipient: '<string>',
to: '<string>',
type: 'template',
template: {name: '<string>', language: {code: '<string>'}, components: [{}]}
},
channels: ['WhatsApp']
})
};
fetch('https://modawer.com/api/messages/send/raw', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://modawer.com/api/messages/send/raw",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'whatsappBusinessId' => '<string>',
'phoneNumberId' => '<string>',
'payload' => [
'recipient' => '<string>',
'to' => '<string>',
'type' => 'template',
'template' => [
'name' => '<string>',
'language' => [
'code' => '<string>'
],
'components' => [
[
]
]
]
],
'channels' => [
'WhatsApp'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://modawer.com/api/messages/send/raw"
payload := strings.NewReader("{\n \"whatsappBusinessId\": \"<string>\",\n \"phoneNumberId\": \"<string>\",\n \"payload\": {\n \"recipient\": \"<string>\",\n \"to\": \"<string>\",\n \"type\": \"template\",\n \"template\": {\n \"name\": \"<string>\",\n \"language\": {\n \"code\": \"<string>\"\n },\n \"components\": [\n {}\n ]\n }\n },\n \"channels\": [\n \"WhatsApp\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<x-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://modawer.com/api/messages/send/raw")
.header("X-API-KEY", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"whatsappBusinessId\": \"<string>\",\n \"phoneNumberId\": \"<string>\",\n \"payload\": {\n \"recipient\": \"<string>\",\n \"to\": \"<string>\",\n \"type\": \"template\",\n \"template\": {\n \"name\": \"<string>\",\n \"language\": {\n \"code\": \"<string>\"\n },\n \"components\": [\n {}\n ]\n }\n },\n \"channels\": [\n \"WhatsApp\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://modawer.com/api/messages/send/raw")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"whatsappBusinessId\": \"<string>\",\n \"phoneNumberId\": \"<string>\",\n \"payload\": {\n \"recipient\": \"<string>\",\n \"to\": \"<string>\",\n \"type\": \"template\",\n \"template\": {\n \"name\": \"<string>\",\n \"language\": {\n \"code\": \"<string>\"\n },\n \"components\": [\n {}\n ]\n }\n },\n \"channels\": [\n \"WhatsApp\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"queued": true
}Headers
Body
application/json
Connected WhatsApp Business Account ID (WABA ID).
WhatsApp phone number ID that should send the message.
Show child attributes
Show child attributes
Optional message flow. Only applicable when the selected template is AUTHENTICATION.
Available options:
WhatsApp, Telegram Response
200 - application/json
OK
⌘I
Send raw WhatsApp template message
curl --request POST \
--url https://modawer.com/api/messages/send/raw \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <x-api-key>' \
--data '
{
"whatsappBusinessId": "<string>",
"phoneNumberId": "<string>",
"payload": {
"recipient": "<string>",
"to": "<string>",
"type": "template",
"template": {
"name": "<string>",
"language": {
"code": "<string>"
},
"components": [
{}
]
}
},
"channels": [
"WhatsApp"
]
}
'import requests
url = "https://modawer.com/api/messages/send/raw"
payload = {
"whatsappBusinessId": "<string>",
"phoneNumberId": "<string>",
"payload": {
"recipient": "<string>",
"to": "<string>",
"type": "template",
"template": {
"name": "<string>",
"language": { "code": "<string>" },
"components": [{}]
}
},
"channels": ["WhatsApp"]
}
headers = {
"X-API-KEY": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
whatsappBusinessId: '<string>',
phoneNumberId: '<string>',
payload: {
recipient: '<string>',
to: '<string>',
type: 'template',
template: {name: '<string>', language: {code: '<string>'}, components: [{}]}
},
channels: ['WhatsApp']
})
};
fetch('https://modawer.com/api/messages/send/raw', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://modawer.com/api/messages/send/raw",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'whatsappBusinessId' => '<string>',
'phoneNumberId' => '<string>',
'payload' => [
'recipient' => '<string>',
'to' => '<string>',
'type' => 'template',
'template' => [
'name' => '<string>',
'language' => [
'code' => '<string>'
],
'components' => [
[
]
]
]
],
'channels' => [
'WhatsApp'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://modawer.com/api/messages/send/raw"
payload := strings.NewReader("{\n \"whatsappBusinessId\": \"<string>\",\n \"phoneNumberId\": \"<string>\",\n \"payload\": {\n \"recipient\": \"<string>\",\n \"to\": \"<string>\",\n \"type\": \"template\",\n \"template\": {\n \"name\": \"<string>\",\n \"language\": {\n \"code\": \"<string>\"\n },\n \"components\": [\n {}\n ]\n }\n },\n \"channels\": [\n \"WhatsApp\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<x-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://modawer.com/api/messages/send/raw")
.header("X-API-KEY", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"whatsappBusinessId\": \"<string>\",\n \"phoneNumberId\": \"<string>\",\n \"payload\": {\n \"recipient\": \"<string>\",\n \"to\": \"<string>\",\n \"type\": \"template\",\n \"template\": {\n \"name\": \"<string>\",\n \"language\": {\n \"code\": \"<string>\"\n },\n \"components\": [\n {}\n ]\n }\n },\n \"channels\": [\n \"WhatsApp\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://modawer.com/api/messages/send/raw")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"whatsappBusinessId\": \"<string>\",\n \"phoneNumberId\": \"<string>\",\n \"payload\": {\n \"recipient\": \"<string>\",\n \"to\": \"<string>\",\n \"type\": \"template\",\n \"template\": {\n \"name\": \"<string>\",\n \"language\": {\n \"code\": \"<string>\"\n },\n \"components\": [\n {}\n ]\n }\n },\n \"channels\": [\n \"WhatsApp\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"queued": true
}