Send a template message to a lead
curl --request POST \
--url https://api.hostreach.io/v1/public/v1/messaging/leads/{leadId}/templates \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"templateId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"scheduledAt": "2026-06-10T10:00:00Z",
"campaignId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.hostreach.io/v1/public/v1/messaging/leads/{leadId}/templates"
payload = {
"templateId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"scheduledAt": "2026-06-10T10:00:00Z",
"campaignId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
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({
templateId: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
accountId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
scheduledAt: '2026-06-10T10:00:00Z',
campaignId: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://api.hostreach.io/v1/public/v1/messaging/leads/{leadId}/templates', 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.hostreach.io/v1/public/v1/messaging/leads/{leadId}/templates",
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([
'templateId' => '3fa85f64-5717-4562-b3fc-2c963f66afa6',
'accountId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'scheduledAt' => '2026-06-10T10:00:00Z',
'campaignId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
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.hostreach.io/v1/public/v1/messaging/leads/{leadId}/templates"
payload := strings.NewReader("{\n \"templateId\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\",\n \"accountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"scheduledAt\": \"2026-06-10T10:00:00Z\",\n \"campaignId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\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.hostreach.io/v1/public/v1/messaging/leads/{leadId}/templates")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"templateId\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\",\n \"accountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"scheduledAt\": \"2026-06-10T10:00:00Z\",\n \"campaignId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hostreach.io/v1/public/v1/messaging/leads/{leadId}/templates")
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 \"templateId\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\",\n \"accountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"scheduledAt\": \"2026-06-10T10:00:00Z\",\n \"campaignId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_bodyMessaging
Send a template message to a lead
POST
/
public
/
v1
/
messaging
/
leads
/
{leadId}
/
templates
Send a template message to a lead
curl --request POST \
--url https://api.hostreach.io/v1/public/v1/messaging/leads/{leadId}/templates \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"templateId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"scheduledAt": "2026-06-10T10:00:00Z",
"campaignId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.hostreach.io/v1/public/v1/messaging/leads/{leadId}/templates"
payload = {
"templateId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"scheduledAt": "2026-06-10T10:00:00Z",
"campaignId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
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({
templateId: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
accountId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
scheduledAt: '2026-06-10T10:00:00Z',
campaignId: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://api.hostreach.io/v1/public/v1/messaging/leads/{leadId}/templates', 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.hostreach.io/v1/public/v1/messaging/leads/{leadId}/templates",
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([
'templateId' => '3fa85f64-5717-4562-b3fc-2c963f66afa6',
'accountId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'scheduledAt' => '2026-06-10T10:00:00Z',
'campaignId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
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.hostreach.io/v1/public/v1/messaging/leads/{leadId}/templates"
payload := strings.NewReader("{\n \"templateId\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\",\n \"accountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"scheduledAt\": \"2026-06-10T10:00:00Z\",\n \"campaignId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\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.hostreach.io/v1/public/v1/messaging/leads/{leadId}/templates")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"templateId\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\",\n \"accountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"scheduledAt\": \"2026-06-10T10:00:00Z\",\n \"campaignId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hostreach.io/v1/public/v1/messaging/leads/{leadId}/templates")
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 \"templateId\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\",\n \"accountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"scheduledAt\": \"2026-06-10T10:00:00Z\",\n \"campaignId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
API key (hr_live_... or hr_test_...). Generate from Settings › Workspace › Acceso API.
Path Parameters
Body
application/json
UUID of the approved WhatsApp template to send.
Example:
"3fa85f64-5717-4562-b3fc-2c963f66afa6"
WhatsApp account UUID to send from. Defaults to the campaign account linked to the lead.
ISO-8601 timestamp to schedule the message. Omit to send immediately.
Example:
"2026-06-10T10:00:00Z"
Campaign context for attribution. Inferred from the lead if omitted.
Response
201 - undefined
Was this page helpful?
⌘I