Trigger AI Reply
curl --request POST \
--url https://api.periskope.app/v1/ai/reply \
--header 'Content-Type: application/json' \
--data '
{
"chat_id": "120363025896399300@g.us",
"unique_id": "BAE58B775A57D71E",
"org_phone": "919874532456"
}
'import requests
url = "https://api.periskope.app/v1/ai/reply"
payload = {
"chat_id": "120363025896399300@g.us",
"unique_id": "BAE58B775A57D71E",
"org_phone": "919874532456"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
chat_id: '120363025896399300@g.us',
unique_id: 'BAE58B775A57D71E',
org_phone: '919874532456'
})
};
fetch('https://api.periskope.app/v1/ai/reply', 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.periskope.app/v1/ai/reply",
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([
'chat_id' => '120363025896399300@g.us',
'unique_id' => 'BAE58B775A57D71E',
'org_phone' => '919874532456'
]),
CURLOPT_HTTPHEADER => [
"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://api.periskope.app/v1/ai/reply"
payload := strings.NewReader("{\n \"chat_id\": \"120363025896399300@g.us\",\n \"unique_id\": \"BAE58B775A57D71E\",\n \"org_phone\": \"919874532456\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.periskope.app/v1/ai/reply")
.header("Content-Type", "application/json")
.body("{\n \"chat_id\": \"120363025896399300@g.us\",\n \"unique_id\": \"BAE58B775A57D71E\",\n \"org_phone\": \"919874532456\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.periskope.app/v1/ai/reply")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"chat_id\": \"120363025896399300@g.us\",\n \"unique_id\": \"BAE58B775A57D71E\",\n \"org_phone\": \"919874532456\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "AI reply triggered",
"trace_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}AI APIs
Trigger AI Reply
Triggers an AI-generated reply to a specific message in a chat. The AI agent processes the message context and generates an appropriate response asynchronously.
Requirements:
- Organization must have an active subscription
- Organization must be on the Pro plan
- AI agent must be enabled at the organization level
- AI agent must be enabled for the specific chat
This is an asynchronous endpoint - it queues the AI reply for processing and returns immediately with a trace ID for tracking.
Trigger AI Reply
curl --request POST \
--url https://api.periskope.app/v1/ai/reply \
--header 'Content-Type: application/json' \
--data '
{
"chat_id": "120363025896399300@g.us",
"unique_id": "BAE58B775A57D71E",
"org_phone": "919874532456"
}
'import requests
url = "https://api.periskope.app/v1/ai/reply"
payload = {
"chat_id": "120363025896399300@g.us",
"unique_id": "BAE58B775A57D71E",
"org_phone": "919874532456"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
chat_id: '120363025896399300@g.us',
unique_id: 'BAE58B775A57D71E',
org_phone: '919874532456'
})
};
fetch('https://api.periskope.app/v1/ai/reply', 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.periskope.app/v1/ai/reply",
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([
'chat_id' => '120363025896399300@g.us',
'unique_id' => 'BAE58B775A57D71E',
'org_phone' => '919874532456'
]),
CURLOPT_HTTPHEADER => [
"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://api.periskope.app/v1/ai/reply"
payload := strings.NewReader("{\n \"chat_id\": \"120363025896399300@g.us\",\n \"unique_id\": \"BAE58B775A57D71E\",\n \"org_phone\": \"919874532456\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.periskope.app/v1/ai/reply")
.header("Content-Type", "application/json")
.body("{\n \"chat_id\": \"120363025896399300@g.us\",\n \"unique_id\": \"BAE58B775A57D71E\",\n \"org_phone\": \"919874532456\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.periskope.app/v1/ai/reply")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"chat_id\": \"120363025896399300@g.us\",\n \"unique_id\": \"BAE58B775A57D71E\",\n \"org_phone\": \"919874532456\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "AI reply triggered",
"trace_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}Headers
The connected WhatsApp phone number for scope validation
Example:
"919874532456"
Body
application/json
The unique identifier of the chat to reply in
Example:
"120363025896399300@g.us"
The unique_id of the message to reply to. The AI will use this message and its surrounding context to generate a reply
Example:
"BAE58B775A57D71E"
The phone number of the organization (connected WhatsApp number) in the format country_code + number without special characters
Example:
"919874532456"
Was this page helpful?