cURL
curl --request POST \
--url 'https://api.iomnihub.ai/stable/open/whatsapp/send-template?api_key=' \
--header 'Content-Type: multipart/form-data' \
--form template_id=102323213 \
--form channel_id=1022 \
--form 'customer_phone=+628123456789' \
--form file='@example-file' \
--form 'body_vars={
"1": "John Doe"
}' \
--form 'button_vars={
"1": "Home"
}' \
--form header_type=document \
--form 'customer_attributes={
"1": "John Doe"
}'import requests
url = "https://api.iomnihub.ai/stable/open/whatsapp/send-template?api_key="
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"template_id": "102323213",
"channel_id": "1022",
"customer_phone": "+628123456789",
"body_vars": "{
\"1\": \"John Doe\"
}",
"button_vars": "{
\"1\": \"Home\"
}",
"header_type": "document",
"customer_attributes": "{
\"1\": \"John Doe\"
}"
}
response = requests.post(url, data=payload, files=files)
print(response.text)const form = new FormData();
form.append('template_id', '102323213');
form.append('channel_id', '1022');
form.append('customer_phone', '+628123456789');
form.append('file', '<string>');
form.append('body_vars', '{
"1": "John Doe"
}');
form.append('button_vars', '{
"1": "Home"
}');
form.append('header_type', 'document');
form.append('customer_attributes', '{
"1": "John Doe"
}');
const options = {method: 'POST'};
options.body = form;
fetch('https://api.iomnihub.ai/stable/open/whatsapp/send-template?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?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 => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"template_id\"\r\n\r\n102323213\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"channel_id\"\r\n\r\n1022\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"customer_phone\"\r\n\r\n+628123456789\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"body_vars\"\r\n\r\n{\r\n \"1\": \"John Doe\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"button_vars\"\r\n\r\n{\r\n \"1\": \"Home\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"header_type\"\r\n\r\ndocument\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"customer_attributes\"\r\n\r\n{\r\n \"1\": \"John Doe\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data"
],
]);
$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?api_key="
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"template_id\"\r\n\r\n102323213\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"channel_id\"\r\n\r\n1022\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"customer_phone\"\r\n\r\n+628123456789\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"body_vars\"\r\n\r\n{\r\n \"1\": \"John Doe\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"button_vars\"\r\n\r\n{\r\n \"1\": \"Home\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"header_type\"\r\n\r\ndocument\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"customer_attributes\"\r\n\r\n{\r\n \"1\": \"John Doe\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
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?api_key=")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"template_id\"\r\n\r\n102323213\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"channel_id\"\r\n\r\n1022\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"customer_phone\"\r\n\r\n+628123456789\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"body_vars\"\r\n\r\n{\r\n \"1\": \"John Doe\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"button_vars\"\r\n\r\n{\r\n \"1\": \"Home\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"header_type\"\r\n\r\ndocument\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"customer_attributes\"\r\n\r\n{\r\n \"1\": \"John Doe\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.iomnihub.ai/stable/open/whatsapp/send-template?api_key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"template_id\"\r\n\r\n102323213\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"channel_id\"\r\n\r\n1022\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"customer_phone\"\r\n\r\n+628123456789\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"body_vars\"\r\n\r\n{\r\n \"1\": \"John Doe\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"button_vars\"\r\n\r\n{\r\n \"1\": \"Home\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"header_type\"\r\n\r\ndocument\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"customer_attributes\"\r\n\r\n{\r\n \"1\": \"John Doe\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"status": "ongoing"
}
}{
"detail": "Invalid api key provided."
}{
"detail": "Invalid api key provided."
}{
"detail": "Invalid api key provided."
}{
"detail": "Invalid api key provided."
}WhatsApp
Send WhatsApp Template (with File)
Sends a per-approved template message to WhatsApp (with File support)
POST
/
stable
/
open
/
whatsapp
/
send-template
cURL
curl --request POST \
--url 'https://api.iomnihub.ai/stable/open/whatsapp/send-template?api_key=' \
--header 'Content-Type: multipart/form-data' \
--form template_id=102323213 \
--form channel_id=1022 \
--form 'customer_phone=+628123456789' \
--form file='@example-file' \
--form 'body_vars={
"1": "John Doe"
}' \
--form 'button_vars={
"1": "Home"
}' \
--form header_type=document \
--form 'customer_attributes={
"1": "John Doe"
}'import requests
url = "https://api.iomnihub.ai/stable/open/whatsapp/send-template?api_key="
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"template_id": "102323213",
"channel_id": "1022",
"customer_phone": "+628123456789",
"body_vars": "{
\"1\": \"John Doe\"
}",
"button_vars": "{
\"1\": \"Home\"
}",
"header_type": "document",
"customer_attributes": "{
\"1\": \"John Doe\"
}"
}
response = requests.post(url, data=payload, files=files)
print(response.text)const form = new FormData();
form.append('template_id', '102323213');
form.append('channel_id', '1022');
form.append('customer_phone', '+628123456789');
form.append('file', '<string>');
form.append('body_vars', '{
"1": "John Doe"
}');
form.append('button_vars', '{
"1": "Home"
}');
form.append('header_type', 'document');
form.append('customer_attributes', '{
"1": "John Doe"
}');
const options = {method: 'POST'};
options.body = form;
fetch('https://api.iomnihub.ai/stable/open/whatsapp/send-template?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?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 => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"template_id\"\r\n\r\n102323213\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"channel_id\"\r\n\r\n1022\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"customer_phone\"\r\n\r\n+628123456789\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"body_vars\"\r\n\r\n{\r\n \"1\": \"John Doe\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"button_vars\"\r\n\r\n{\r\n \"1\": \"Home\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"header_type\"\r\n\r\ndocument\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"customer_attributes\"\r\n\r\n{\r\n \"1\": \"John Doe\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data"
],
]);
$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?api_key="
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"template_id\"\r\n\r\n102323213\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"channel_id\"\r\n\r\n1022\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"customer_phone\"\r\n\r\n+628123456789\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"body_vars\"\r\n\r\n{\r\n \"1\": \"John Doe\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"button_vars\"\r\n\r\n{\r\n \"1\": \"Home\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"header_type\"\r\n\r\ndocument\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"customer_attributes\"\r\n\r\n{\r\n \"1\": \"John Doe\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
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?api_key=")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"template_id\"\r\n\r\n102323213\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"channel_id\"\r\n\r\n1022\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"customer_phone\"\r\n\r\n+628123456789\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"body_vars\"\r\n\r\n{\r\n \"1\": \"John Doe\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"button_vars\"\r\n\r\n{\r\n \"1\": \"Home\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"header_type\"\r\n\r\ndocument\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"customer_attributes\"\r\n\r\n{\r\n \"1\": \"John Doe\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.iomnihub.ai/stable/open/whatsapp/send-template?api_key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"template_id\"\r\n\r\n102323213\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"channel_id\"\r\n\r\n1022\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"customer_phone\"\r\n\r\n+628123456789\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"body_vars\"\r\n\r\n{\r\n \"1\": \"John Doe\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"button_vars\"\r\n\r\n{\r\n \"1\": \"Home\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"header_type\"\r\n\r\ndocument\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"customer_attributes\"\r\n\r\n{\r\n \"1\": \"John Doe\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"status": "ongoing"
}
}{
"detail": "Invalid api key provided."
}{
"detail": "Invalid api key provided."
}{
"detail": "Invalid api key provided."
}{
"detail": "Invalid api key provided."
}Authorizations
Body
multipart/form-data
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"
File to send
Key-pair values of the variables in the template body
Show child attributes
Show child attributes
Key-pair values of the variables in the template buttons
Show child attributes
Show child attributes
Key-pair values of the variables in the template buttons
Available options:
none, text, document, image, video Example:
"document"
Key-pair values of the customer variables to be stored against that customer
Show child attributes
Show child attributes
⌘I