Send Message
curl --request POST \
--url https://api.example.com/api/v1/messages/send \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"channel": "<string>",
"recipient": {},
"template": {},
"templateVariables": {},
"providerIntegration": {},
"subject": "<string>",
"body": "<string>",
"buttons": [
{}
]
}
'import requests
url = "https://api.example.com/api/v1/messages/send"
payload = {
"channel": "<string>",
"recipient": {},
"template": {},
"templateVariables": {},
"providerIntegration": {},
"subject": "<string>",
"body": "<string>",
"buttons": [{}]
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
channel: '<string>',
recipient: {},
template: {},
templateVariables: {},
providerIntegration: {},
subject: '<string>',
body: JSON.stringify('<string>'),
buttons: [{}]
})
};
fetch('https://api.example.com/api/v1/messages/send', 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://api.example.com/api/v1/messages/send",
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([
'channel' => '<string>',
'recipient' => [
],
'template' => [
],
'templateVariables' => [
],
'providerIntegration' => [
],
'subject' => '<string>',
'body' => '<string>',
'buttons' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$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://api.example.com/api/v1/messages/send"
payload := strings.NewReader("{\n \"channel\": \"<string>\",\n \"recipient\": {},\n \"template\": {},\n \"templateVariables\": {},\n \"providerIntegration\": {},\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"buttons\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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://api.example.com/api/v1/messages/send")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"channel\": \"<string>\",\n \"recipient\": {},\n \"template\": {},\n \"templateVariables\": {},\n \"providerIntegration\": {},\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"buttons\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/messages/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"channel\": \"<string>\",\n \"recipient\": {},\n \"template\": {},\n \"templateVariables\": {},\n \"providerIntegration\": {},\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"buttons\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"notificationId": "<string>"
}Messaging APIs
Send Message
Sends a message via a specified channel (Email, WhatsApp, Slack, etc.) to a recipient with support for templating
POST
/
api
/
v1
/
messages
/
send
Send Message
curl --request POST \
--url https://api.example.com/api/v1/messages/send \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"channel": "<string>",
"recipient": {},
"template": {},
"templateVariables": {},
"providerIntegration": {},
"subject": "<string>",
"body": "<string>",
"buttons": [
{}
]
}
'import requests
url = "https://api.example.com/api/v1/messages/send"
payload = {
"channel": "<string>",
"recipient": {},
"template": {},
"templateVariables": {},
"providerIntegration": {},
"subject": "<string>",
"body": "<string>",
"buttons": [{}]
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
channel: '<string>',
recipient: {},
template: {},
templateVariables: {},
providerIntegration: {},
subject: '<string>',
body: JSON.stringify('<string>'),
buttons: [{}]
})
};
fetch('https://api.example.com/api/v1/messages/send', 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://api.example.com/api/v1/messages/send",
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([
'channel' => '<string>',
'recipient' => [
],
'template' => [
],
'templateVariables' => [
],
'providerIntegration' => [
],
'subject' => '<string>',
'body' => '<string>',
'buttons' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$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://api.example.com/api/v1/messages/send"
payload := strings.NewReader("{\n \"channel\": \"<string>\",\n \"recipient\": {},\n \"template\": {},\n \"templateVariables\": {},\n \"providerIntegration\": {},\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"buttons\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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://api.example.com/api/v1/messages/send")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"channel\": \"<string>\",\n \"recipient\": {},\n \"template\": {},\n \"templateVariables\": {},\n \"providerIntegration\": {},\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"buttons\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/messages/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"channel\": \"<string>\",\n \"recipient\": {},\n \"template\": {},\n \"templateVariables\": {},\n \"providerIntegration\": {},\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"buttons\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"notificationId": "<string>"
}Header
Request Body
{
"channel": "EMAIL | SMS | WHATSAPP | SLACK | TEAMS | DISCORD | LINE | IN_APP | PUSH",
"recipient": {
"email": "user@example.com",
"sms": "+911234567890",
"whatsapp": "+911234567890",
"pushToken": "push-token-123",
"inApp": "internal-user-id",
"slack": "U01XXXXXXX",
"discord": "discord-user-id",
"teams": "teams-user-id",
"line": "line-user-id",
"userId": "unified-user-id"
},
"template": {
"name": "welcome_template"
},
"templateVariables": {
"firstName": "John",
"offerCode": "ABCD123"
},
"providerIntegration": {
"id": "provider-uuid-1234",
"name": "Provider Name",
"code": "SLACK | TWILIO | WATI | ..."
},
"subject": "Welcome to our app!",
"body": "Hello John, welcome onboard!",
"buttons": [
{
"text": "Visit Website",
"value": "https://example.com"
}
]
}
Request Fields
Required Fields
The communication channel. One of:
EMAIL, SMS, WHATSAPP, SLACK, TEAMS, DISCORD, LINE, IN_APP, PUSHThe destination for the message. Must include the field matching the selected channel.
Optional Fields
Template configuration for the message
Key-value pairs to populate template placeholders
Provider configuration
Message subject (for EMAIL only)
Message body (for SLACK, EMAIL, TEAMS)
Interactive buttons (for SLACK only)
Response
Success Response (200 OK)
{
"notificationId": "c1234567-89ab-4def-9012-3456789abcdef"
}
Response Fields
Unique identifier for the sent message
Error Responses
400- Bad Request (Invalid request format or missing required fields)401- Unauthorized (Missing or invalid API key)403- Forbidden (Insufficient permissions to send message)404- Not Found (Template or provider not found)429- Too Many Requests500- Internal Server Error
Examples
{
"channel": "SLACK",
"recipient": {
"slack": "U01ABCDEF"
},
"body": "Hello from Slack!",
"buttons": [
{
"text": "Open App",
"value": "open_app"
}
],
"providerIntegration": {
"code": "SLACK",
"name": "Slack Default"
}
}
{
"channel": "EMAIL",
"recipient": {
"email": "user@example.com"
},
"template": {
"name": "welcome_email"
},
"templateVariables": {
"firstName": "John",
"expiryDate": "2023-12-31"
},
"providerIntegration": {
"code": "SENDGRID",
"name": "Production Email"
}
}
{
"channel": "SMS",
"recipient": {
"sms": "+1234567890"
},
"body": "Your verification code is 123456. Valid for 10 minutes.",
"providerIntegration": {
"code": "TWILIO",
"name": "Twilio Production"
}
}
Was this page helpful?
⌘I