Skip to main content
POST
/
messages
/
send-template
Send a template message
curl --request POST \
  --url https://api.bitbybit.studio/whatsapp/open/v1/messages/send-template \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "to": "6281234567890",
  "template_name": "welcome_message",
  "params": [
    "John",
    "Order123",
    "2024-01-01"
  ],
  "mediaUrl": "<string>",
  "ignoreActiveTicket": false,
  "countryCode": "ID"
}
'
import requests

url = "https://api.bitbybit.studio/whatsapp/open/v1/messages/send-template"

payload = {
"to": "6281234567890",
"template_name": "welcome_message",
"params": ["John", "Order123", "2024-01-01"],
"mediaUrl": "<string>",
"ignoreActiveTicket": False,
"countryCode": "ID"
}
headers = {
"x-api-key": "<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': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
to: '6281234567890',
template_name: 'welcome_message',
params: ['John', 'Order123', '2024-01-01'],
mediaUrl: '<string>',
ignoreActiveTicket: false,
countryCode: 'ID'
})
};

fetch('https://api.bitbybit.studio/whatsapp/open/v1/messages/send-template', 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.bitbybit.studio/whatsapp/open/v1/messages/send-template",
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([
'to' => '6281234567890',
'template_name' => 'welcome_message',
'params' => [
'John',
'Order123',
'2024-01-01'
],
'mediaUrl' => '<string>',
'ignoreActiveTicket' => false,
'countryCode' => 'ID'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <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://api.bitbybit.studio/whatsapp/open/v1/messages/send-template"

payload := strings.NewReader("{\n \"to\": \"6281234567890\",\n \"template_name\": \"welcome_message\",\n \"params\": [\n \"John\",\n \"Order123\",\n \"2024-01-01\"\n ],\n \"mediaUrl\": \"<string>\",\n \"ignoreActiveTicket\": false,\n \"countryCode\": \"ID\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("x-api-key", "<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://api.bitbybit.studio/whatsapp/open/v1/messages/send-template")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"to\": \"6281234567890\",\n \"template_name\": \"welcome_message\",\n \"params\": [\n \"John\",\n \"Order123\",\n \"2024-01-01\"\n ],\n \"mediaUrl\": \"<string>\",\n \"ignoreActiveTicket\": false,\n \"countryCode\": \"ID\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.bitbybit.studio/whatsapp/open/v1/messages/send-template")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"to\": \"6281234567890\",\n \"template_name\": \"welcome_message\",\n \"params\": [\n \"John\",\n \"Order123\",\n \"2024-01-01\"\n ],\n \"mediaUrl\": \"<string>\",\n \"ignoreActiveTicket\": false,\n \"countryCode\": \"ID\"\n}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "messageId2": "<string>",
    "timestamp": "<string>"
  }
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request body"
}
}
{
"error": {
"code": "INVALID_API_KEY",
"message": "Invalid or expired API key"
}
}
{
"error": {
"code": "INSUFFICIENT_SCOPE",
"message": "API key does not have the required scope"
}
}
{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Too many requests. Please retry after the reset period."
}
}

Authorizations

x-api-key
string
header
required

API key for authentication. Create one in Settings > Developer.

Body

application/json
to
string
required

Destination phone number

Example:

"6281234567890"

template_name
string
required

Name of the approved WhatsApp template

Example:

"welcome_message"

template_source
enum<string>
required

Template source — CRM for business templates, AUTH for OTP

Available options:
CRM,
AUTH
sources
enum<string>

Messaging channel to use

Available options:
whatsapp cloud api,
whatsapp coex
params
string[]

Dynamic parameters to insert into the template placeholders

Example:
["John", "Order123", "2024-01-01"]
mediaUrl
string

Custom media URL for media templates — overrides the template default

ignoreActiveTicket
boolean
default:false

If true, skip sending when the chat is actively handled by an agent

countryCode
string | null

Country code for number formatting

Example:

"ID"

Response

Template message sent successfully

data
object