WhatsApp API
Trigger Bot Flow
Trigger a specific Keyword Replies flow for any mobile number via the ChatSyncs API, using the flow’s unique ID. Use when a developer asks how to programmatically start a bot conversation instead of waiting for the user to message first.
POST
/
whatsapp
/
trigger-bot
Trigger Bot Flow
curl --request POST \
--url https://platform.chatsyncs.com/api/v1/whatsapp/trigger-bot \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data apiToken=API-KEY \
--data phone_number_id=PHONE-NUMBER-ID \
--data bot_flow_unique_id=BOT-FLOW-UNIQUE-ID \
--data phone_number=PHONE-NUMBERimport requests
url = "https://platform.chatsyncs.com/api/v1/whatsapp/trigger-bot"
payload = {
"apiToken": "API-KEY",
"phone_number_id": "PHONE-NUMBER-ID",
"bot_flow_unique_id": "BOT-FLOW-UNIQUE-ID",
"phone_number": "PHONE-NUMBER"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
apiToken: 'API-KEY',
phone_number_id: 'PHONE-NUMBER-ID',
bot_flow_unique_id: 'BOT-FLOW-UNIQUE-ID',
phone_number: 'PHONE-NUMBER'
})
};
fetch('https://platform.chatsyncs.com/api/v1/whatsapp/trigger-bot', 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://platform.chatsyncs.com/api/v1/whatsapp/trigger-bot",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "apiToken=API-KEY&phone_number_id=PHONE-NUMBER-ID&bot_flow_unique_id=BOT-FLOW-UNIQUE-ID&phone_number=PHONE-NUMBER",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded"
],
]);
$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://platform.chatsyncs.com/api/v1/whatsapp/trigger-bot"
payload := strings.NewReader("apiToken=API-KEY&phone_number_id=PHONE-NUMBER-ID&bot_flow_unique_id=BOT-FLOW-UNIQUE-ID&phone_number=PHONE-NUMBER")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://platform.chatsyncs.com/api/v1/whatsapp/trigger-bot")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("apiToken=API-KEY&phone_number_id=PHONE-NUMBER-ID&bot_flow_unique_id=BOT-FLOW-UNIQUE-ID&phone_number=PHONE-NUMBER")
.asString();require 'uri'
require 'net/http'
url = URI("https://platform.chatsyncs.com/api/v1/whatsapp/trigger-bot")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "apiToken=API-KEY&phone_number_id=PHONE-NUMBER-ID&bot_flow_unique_id=BOT-FLOW-UNIQUE-ID&phone_number=PHONE-NUMBER"
response = http.request(request)
puts response.read_body{
"status": "1",
"message": "Bot Flow has been trigger successfully"
}Starts a specific Keyword Replies flow for a phone number — useful for
kicking off a conversation from your own system instead of waiting for the user to message
first.
Where to find
bot_flow_unique_id: call Bot Flow List — the unique_id
of each flow — or open Chatbot Manager → Automation → Keyword Replies, where it’s the Unique ID column. See
Finding Your IDs & API Token
for a screenshot.The flow id isn’t checked. An unknown
bot_flow_unique_id still returns "status":"1" and
Bot Flow has been trigger successfully, and nothing happens. Take the id from
Bot Flow List.Body
application/x-www-form-urlencoded
Your ChatSyncs API key (not a WhatsApp/Meta access token). Where to find it.
Example:
"API-KEY"
The WhatsApp account's phone number ID. Where to find it.
Example:
"PHONE-NUMBER-ID"
The Bot Flow's unique ID to trigger. Where to find it.
Example:
"BOT-FLOW-UNIQUE-ID"
The subscriber's phone number, with country code, digits only.
Example:
"PHONE-NUMBER"
Was this page helpful?
⌘I
Trigger Bot Flow
curl --request POST \
--url https://platform.chatsyncs.com/api/v1/whatsapp/trigger-bot \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data apiToken=API-KEY \
--data phone_number_id=PHONE-NUMBER-ID \
--data bot_flow_unique_id=BOT-FLOW-UNIQUE-ID \
--data phone_number=PHONE-NUMBERimport requests
url = "https://platform.chatsyncs.com/api/v1/whatsapp/trigger-bot"
payload = {
"apiToken": "API-KEY",
"phone_number_id": "PHONE-NUMBER-ID",
"bot_flow_unique_id": "BOT-FLOW-UNIQUE-ID",
"phone_number": "PHONE-NUMBER"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
apiToken: 'API-KEY',
phone_number_id: 'PHONE-NUMBER-ID',
bot_flow_unique_id: 'BOT-FLOW-UNIQUE-ID',
phone_number: 'PHONE-NUMBER'
})
};
fetch('https://platform.chatsyncs.com/api/v1/whatsapp/trigger-bot', 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://platform.chatsyncs.com/api/v1/whatsapp/trigger-bot",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "apiToken=API-KEY&phone_number_id=PHONE-NUMBER-ID&bot_flow_unique_id=BOT-FLOW-UNIQUE-ID&phone_number=PHONE-NUMBER",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded"
],
]);
$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://platform.chatsyncs.com/api/v1/whatsapp/trigger-bot"
payload := strings.NewReader("apiToken=API-KEY&phone_number_id=PHONE-NUMBER-ID&bot_flow_unique_id=BOT-FLOW-UNIQUE-ID&phone_number=PHONE-NUMBER")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://platform.chatsyncs.com/api/v1/whatsapp/trigger-bot")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("apiToken=API-KEY&phone_number_id=PHONE-NUMBER-ID&bot_flow_unique_id=BOT-FLOW-UNIQUE-ID&phone_number=PHONE-NUMBER")
.asString();require 'uri'
require 'net/http'
url = URI("https://platform.chatsyncs.com/api/v1/whatsapp/trigger-bot")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "apiToken=API-KEY&phone_number_id=PHONE-NUMBER-ID&bot_flow_unique_id=BOT-FLOW-UNIQUE-ID&phone_number=PHONE-NUMBER"
response = http.request(request)
puts response.read_body{
"status": "1",
"message": "Bot Flow has been trigger successfully"
}
