Messages
Send Template to Customer
Sends an approved template to one customer.
POST
/
api
/
v1
/
contacts
/
{contact_id}
/
messages
Send Template to Customer
curl --request POST \
--url https://app.chatflows.io/api/v1/contacts/{contact_id}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"channel_id": 2,
"template_id": 1,
"template_data": {
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "#A123"
}
]
}
]
}
}
'import requests
url = "https://app.chatflows.io/api/v1/contacts/{contact_id}/messages"
payload = {
"channel_id": 2,
"template_id": 1,
"template_data": { "components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "#A123"
}
]
}
] }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
channel_id: 2,
template_id: 1,
template_data: {components: [{type: 'body', parameters: [{type: 'text', text: '#A123'}]}]}
})
};
fetch('https://app.chatflows.io/api/v1/contacts/{contact_id}/messages', 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://app.chatflows.io/api/v1/contacts/{contact_id}/messages",
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_id' => 2,
'template_id' => 1,
'template_data' => [
'components' => [
[
'type' => 'body',
'parameters' => [
[
'type' => 'text',
'text' => '#A123'
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://app.chatflows.io/api/v1/contacts/{contact_id}/messages"
payload := strings.NewReader("{\n \"channel_id\": 2,\n \"template_id\": 1,\n \"template_data\": {\n \"components\": [\n {\n \"type\": \"body\",\n \"parameters\": [\n {\n \"type\": \"text\",\n \"text\": \"#A123\"\n }\n ]\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://app.chatflows.io/api/v1/contacts/{contact_id}/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"channel_id\": 2,\n \"template_id\": 1,\n \"template_data\": {\n \"components\": [\n {\n \"type\": \"body\",\n \"parameters\": [\n {\n \"type\": \"text\",\n \"text\": \"#A123\"\n }\n ]\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.chatflows.io/api/v1/contacts/{contact_id}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"channel_id\": 2,\n \"template_id\": 1,\n \"template_data\": {\n \"components\": [\n {\n \"type\": \"body\",\n \"parameters\": [\n {\n \"type\": \"text\",\n \"text\": \"#A123\"\n }\n ]\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"status": "queued",
"data": {
"id": 88,
"conversation_id": 12,
"contact_id": 1,
"channel_id": 2,
"type": "template",
"status": "queued",
"body": null,
"metadata": null,
"error_message": null,
"error_details": null,
"sent_at": null,
"delivered_at": null,
"read_at": null,
"created_at": "2026-06-26T10:00:00+00:00"
}
}
Put the customer’s ID in the URL, then send the template details in the request.
For example, to send to customer
5, use /api/v1/contacts/5/messages.Authorizations
Body
application/json
⌘I
Send Template to Customer
curl --request POST \
--url https://app.chatflows.io/api/v1/contacts/{contact_id}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"channel_id": 2,
"template_id": 1,
"template_data": {
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "#A123"
}
]
}
]
}
}
'import requests
url = "https://app.chatflows.io/api/v1/contacts/{contact_id}/messages"
payload = {
"channel_id": 2,
"template_id": 1,
"template_data": { "components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "#A123"
}
]
}
] }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
channel_id: 2,
template_id: 1,
template_data: {components: [{type: 'body', parameters: [{type: 'text', text: '#A123'}]}]}
})
};
fetch('https://app.chatflows.io/api/v1/contacts/{contact_id}/messages', 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://app.chatflows.io/api/v1/contacts/{contact_id}/messages",
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_id' => 2,
'template_id' => 1,
'template_data' => [
'components' => [
[
'type' => 'body',
'parameters' => [
[
'type' => 'text',
'text' => '#A123'
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://app.chatflows.io/api/v1/contacts/{contact_id}/messages"
payload := strings.NewReader("{\n \"channel_id\": 2,\n \"template_id\": 1,\n \"template_data\": {\n \"components\": [\n {\n \"type\": \"body\",\n \"parameters\": [\n {\n \"type\": \"text\",\n \"text\": \"#A123\"\n }\n ]\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://app.chatflows.io/api/v1/contacts/{contact_id}/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"channel_id\": 2,\n \"template_id\": 1,\n \"template_data\": {\n \"components\": [\n {\n \"type\": \"body\",\n \"parameters\": [\n {\n \"type\": \"text\",\n \"text\": \"#A123\"\n }\n ]\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.chatflows.io/api/v1/contacts/{contact_id}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"channel_id\": 2,\n \"template_id\": 1,\n \"template_data\": {\n \"components\": [\n {\n \"type\": \"body\",\n \"parameters\": [\n {\n \"type\": \"text\",\n \"text\": \"#A123\"\n }\n ]\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"status": "queued",
"data": {
"id": 88,
"conversation_id": 12,
"contact_id": 1,
"channel_id": 2,
"type": "template",
"status": "queued",
"body": null,
"metadata": null,
"error_message": null,
"error_details": null,
"sent_at": null,
"delivered_at": null,
"read_at": null,
"created_at": "2026-06-26T10:00:00+00:00"
}
}

