cURL
curl --request POST \
--url 'https://api.iomnihub.ai/stable/open/whatsapp/send-template-message?api_key=' \
--header 'Content-Type: application/json' \
--data '
{
"template_id": "102323213",
"channel_id": "1022",
"customer_phone": "+628123456789",
"attributes": {
"1": "John Doe"
},
"attachment": {
"image": "https://iomnihub.ai/attachment.jpg",
"audio": "https://iomnihub.ai/attachment.mp3",
"video": "https://iomnihub.ai/attachment.mp4",
"document": "https://iomnihub.ai/attachment.pdf"
}
}
'import requests
url = "https://api.iomnihub.ai/stable/open/whatsapp/send-template-message?api_key="
payload = {
"template_id": "102323213",
"channel_id": "1022",
"customer_phone": "+628123456789",
"attributes": { "1": "John Doe" },
"attachment": {
"image": "https://iomnihub.ai/attachment.jpg",
"audio": "https://iomnihub.ai/attachment.mp3",
"video": "https://iomnihub.ai/attachment.mp4",
"document": "https://iomnihub.ai/attachment.pdf"
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
template_id: '102323213',
channel_id: '1022',
customer_phone: '+628123456789',
attributes: {'1': 'John Doe'},
attachment: {
image: 'https://iomnihub.ai/attachment.jpg',
audio: 'https://iomnihub.ai/attachment.mp3',
video: 'https://iomnihub.ai/attachment.mp4',
document: 'https://iomnihub.ai/attachment.pdf'
}
})
};
fetch('https://api.iomnihub.ai/stable/open/whatsapp/send-template-message?api_key=', 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.iomnihub.ai/stable/open/whatsapp/send-template-message?api_key=",
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([
'template_id' => '102323213',
'channel_id' => '1022',
'customer_phone' => '+628123456789',
'attributes' => [
'1' => 'John Doe'
],
'attachment' => [
'image' => 'https://iomnihub.ai/attachment.jpg',
'audio' => 'https://iomnihub.ai/attachment.mp3',
'video' => 'https://iomnihub.ai/attachment.mp4',
'document' => 'https://iomnihub.ai/attachment.pdf'
]
]),
CURLOPT_HTTPHEADER => [
"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.iomnihub.ai/stable/open/whatsapp/send-template-message?api_key="
payload := strings.NewReader("{\n \"template_id\": \"102323213\",\n \"channel_id\": \"1022\",\n \"customer_phone\": \"+628123456789\",\n \"attributes\": {\n \"1\": \"John Doe\"\n },\n \"attachment\": {\n \"image\": \"https://iomnihub.ai/attachment.jpg\",\n \"audio\": \"https://iomnihub.ai/attachment.mp3\",\n \"video\": \"https://iomnihub.ai/attachment.mp4\",\n \"document\": \"https://iomnihub.ai/attachment.pdf\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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.iomnihub.ai/stable/open/whatsapp/send-template-message?api_key=")
.header("Content-Type", "application/json")
.body("{\n \"template_id\": \"102323213\",\n \"channel_id\": \"1022\",\n \"customer_phone\": \"+628123456789\",\n \"attributes\": {\n \"1\": \"John Doe\"\n },\n \"attachment\": {\n \"image\": \"https://iomnihub.ai/attachment.jpg\",\n \"audio\": \"https://iomnihub.ai/attachment.mp3\",\n \"video\": \"https://iomnihub.ai/attachment.mp4\",\n \"document\": \"https://iomnihub.ai/attachment.pdf\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.iomnihub.ai/stable/open/whatsapp/send-template-message?api_key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"template_id\": \"102323213\",\n \"channel_id\": \"1022\",\n \"customer_phone\": \"+628123456789\",\n \"attributes\": {\n \"1\": \"John Doe\"\n },\n \"attachment\": {\n \"image\": \"https://iomnihub.ai/attachment.jpg\",\n \"audio\": \"https://iomnihub.ai/attachment.mp3\",\n \"video\": \"https://iomnihub.ai/attachment.mp4\",\n \"document\": \"https://iomnihub.ai/attachment.pdf\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"project_id": 123,
"timestamp": "<string>",
"function_name": "<string>",
"message": "<string>",
"status": "<string>",
"extra": {
"timestamp": "<string>",
"project_id": 123,
"platform_id": 123,
"customer_id": 123,
"customer_phone": "<string>",
"template_id": "<string>",
"template_name": "<string>",
"source": "<string>",
"success": true,
"report": {
"messaging_product": "<string>",
"contacts": [
{
"input": "<string>",
"wa_id": "<string>"
}
],
"messages": [
{
"id": "<string>",
"message_status": "<string>"
}
]
}
}
}{
"error": "<string>",
"code": "<string>",
"success": true
}{
"detail": "Invalid api key provided."
}WhatsApp
Send WhatsApp Template
Sends a per-approved template message to WhatsApp
POST
/
stable
/
open
/
whatsapp
/
send-template-message
cURL
curl --request POST \
--url 'https://api.iomnihub.ai/stable/open/whatsapp/send-template-message?api_key=' \
--header 'Content-Type: application/json' \
--data '
{
"template_id": "102323213",
"channel_id": "1022",
"customer_phone": "+628123456789",
"attributes": {
"1": "John Doe"
},
"attachment": {
"image": "https://iomnihub.ai/attachment.jpg",
"audio": "https://iomnihub.ai/attachment.mp3",
"video": "https://iomnihub.ai/attachment.mp4",
"document": "https://iomnihub.ai/attachment.pdf"
}
}
'import requests
url = "https://api.iomnihub.ai/stable/open/whatsapp/send-template-message?api_key="
payload = {
"template_id": "102323213",
"channel_id": "1022",
"customer_phone": "+628123456789",
"attributes": { "1": "John Doe" },
"attachment": {
"image": "https://iomnihub.ai/attachment.jpg",
"audio": "https://iomnihub.ai/attachment.mp3",
"video": "https://iomnihub.ai/attachment.mp4",
"document": "https://iomnihub.ai/attachment.pdf"
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
template_id: '102323213',
channel_id: '1022',
customer_phone: '+628123456789',
attributes: {'1': 'John Doe'},
attachment: {
image: 'https://iomnihub.ai/attachment.jpg',
audio: 'https://iomnihub.ai/attachment.mp3',
video: 'https://iomnihub.ai/attachment.mp4',
document: 'https://iomnihub.ai/attachment.pdf'
}
})
};
fetch('https://api.iomnihub.ai/stable/open/whatsapp/send-template-message?api_key=', 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.iomnihub.ai/stable/open/whatsapp/send-template-message?api_key=",
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([
'template_id' => '102323213',
'channel_id' => '1022',
'customer_phone' => '+628123456789',
'attributes' => [
'1' => 'John Doe'
],
'attachment' => [
'image' => 'https://iomnihub.ai/attachment.jpg',
'audio' => 'https://iomnihub.ai/attachment.mp3',
'video' => 'https://iomnihub.ai/attachment.mp4',
'document' => 'https://iomnihub.ai/attachment.pdf'
]
]),
CURLOPT_HTTPHEADER => [
"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.iomnihub.ai/stable/open/whatsapp/send-template-message?api_key="
payload := strings.NewReader("{\n \"template_id\": \"102323213\",\n \"channel_id\": \"1022\",\n \"customer_phone\": \"+628123456789\",\n \"attributes\": {\n \"1\": \"John Doe\"\n },\n \"attachment\": {\n \"image\": \"https://iomnihub.ai/attachment.jpg\",\n \"audio\": \"https://iomnihub.ai/attachment.mp3\",\n \"video\": \"https://iomnihub.ai/attachment.mp4\",\n \"document\": \"https://iomnihub.ai/attachment.pdf\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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.iomnihub.ai/stable/open/whatsapp/send-template-message?api_key=")
.header("Content-Type", "application/json")
.body("{\n \"template_id\": \"102323213\",\n \"channel_id\": \"1022\",\n \"customer_phone\": \"+628123456789\",\n \"attributes\": {\n \"1\": \"John Doe\"\n },\n \"attachment\": {\n \"image\": \"https://iomnihub.ai/attachment.jpg\",\n \"audio\": \"https://iomnihub.ai/attachment.mp3\",\n \"video\": \"https://iomnihub.ai/attachment.mp4\",\n \"document\": \"https://iomnihub.ai/attachment.pdf\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.iomnihub.ai/stable/open/whatsapp/send-template-message?api_key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"template_id\": \"102323213\",\n \"channel_id\": \"1022\",\n \"customer_phone\": \"+628123456789\",\n \"attributes\": {\n \"1\": \"John Doe\"\n },\n \"attachment\": {\n \"image\": \"https://iomnihub.ai/attachment.jpg\",\n \"audio\": \"https://iomnihub.ai/attachment.mp3\",\n \"video\": \"https://iomnihub.ai/attachment.mp4\",\n \"document\": \"https://iomnihub.ai/attachment.pdf\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"project_id": 123,
"timestamp": "<string>",
"function_name": "<string>",
"message": "<string>",
"status": "<string>",
"extra": {
"timestamp": "<string>",
"project_id": 123,
"platform_id": 123,
"customer_id": 123,
"customer_phone": "<string>",
"template_id": "<string>",
"template_name": "<string>",
"source": "<string>",
"success": true,
"report": {
"messaging_product": "<string>",
"contacts": [
{
"input": "<string>",
"wa_id": "<string>"
}
],
"messages": [
{
"id": "<string>",
"message_status": "<string>"
}
]
}
}
}{
"error": "<string>",
"code": "<string>",
"success": true
}{
"detail": "Invalid api key provided."
}Authorizations
Body
application/json
WhatsApp Template to send
The Id of the Template, can be found in iOmniHub Dashboard
Example:
"102323213"
The Id of the WhatsApp Channel, can be found in iOmniHub Dashboard
Example:
"1022"
Customer phone with country code
Example:
"+628123456789"
Key-pair values of the variables in the template
Show child attributes
Show child attributes
Key-pair values of the variables in the template
Show child attributes
Show child attributes
⌘I