Send an Event to Addy
curl --request POST \
--url https://app.adsera.in/api/pub/addy/events \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-api-secret: <api-key>' \
--data '
{
"phone": "919876543210",
"type": "order_shipped",
"description": "The order was handed to the courier.",
"data": {
"order_id": "A-1042",
"courier": "Delhivery",
"tracking_url": "https://track.example.com/AWB123"
},
"whatsapp": "<string>"
}
'import requests
url = "https://app.adsera.in/api/pub/addy/events"
payload = {
"phone": "919876543210",
"type": "order_shipped",
"description": "The order was handed to the courier.",
"data": {
"order_id": "A-1042",
"courier": "Delhivery",
"tracking_url": "https://track.example.com/AWB123"
},
"whatsapp": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"x-api-secret": "<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>',
'x-api-secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
phone: '919876543210',
type: 'order_shipped',
description: 'The order was handed to the courier.',
data: {
order_id: 'A-1042',
courier: 'Delhivery',
tracking_url: 'https://track.example.com/AWB123'
},
whatsapp: '<string>'
})
};
fetch('https://app.adsera.in/api/pub/addy/events', 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.adsera.in/api/pub/addy/events",
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([
'phone' => '919876543210',
'type' => 'order_shipped',
'description' => 'The order was handed to the courier.',
'data' => [
'order_id' => 'A-1042',
'courier' => 'Delhivery',
'tracking_url' => 'https://track.example.com/AWB123'
],
'whatsapp' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>",
"x-api-secret: <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://app.adsera.in/api/pub/addy/events"
payload := strings.NewReader("{\n \"phone\": \"919876543210\",\n \"type\": \"order_shipped\",\n \"description\": \"The order was handed to the courier.\",\n \"data\": {\n \"order_id\": \"A-1042\",\n \"courier\": \"Delhivery\",\n \"tracking_url\": \"https://track.example.com/AWB123\"\n },\n \"whatsapp\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-api-secret", "<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://app.adsera.in/api/pub/addy/events")
.header("x-api-key", "<api-key>")
.header("x-api-secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"919876543210\",\n \"type\": \"order_shipped\",\n \"description\": \"The order was handed to the courier.\",\n \"data\": {\n \"order_id\": \"A-1042\",\n \"courier\": \"Delhivery\",\n \"tracking_url\": \"https://track.example.com/AWB123\"\n },\n \"whatsapp\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.adsera.in/api/pub/addy/events")
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["x-api-secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone\": \"919876543210\",\n \"type\": \"order_shipped\",\n \"description\": \"The order was handed to the courier.\",\n \"data\": {\n \"order_id\": \"A-1042\",\n \"courier\": \"Delhivery\",\n \"tracking_url\": \"https://track.example.com/AWB123\"\n },\n \"whatsapp\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"delivered": true,
"via": "message",
"text": "<string>",
"reason": "<string>"
}
}{
"success": false,
"error": "Contact not found"
}{
"status": 401,
"success": false,
"error": "Unauthorized: Please provide valid API credentials."
}{
"success": false,
"error": "Contact not found"
}{
"success": false,
"error": "Contact not found"
}AI Agent (Addy)
Send an Event to Addy
Tell Addy something happened for a customer, such as an order shipped or a payment received. Within 24 hours of the customer’s last message Addy writes the update itself, using only the facts you send. Later, it sends the event’s WhatsApp template.
POST
/
api
/
pub
/
addy
/
events
Send an Event to Addy
curl --request POST \
--url https://app.adsera.in/api/pub/addy/events \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-api-secret: <api-key>' \
--data '
{
"phone": "919876543210",
"type": "order_shipped",
"description": "The order was handed to the courier.",
"data": {
"order_id": "A-1042",
"courier": "Delhivery",
"tracking_url": "https://track.example.com/AWB123"
},
"whatsapp": "<string>"
}
'import requests
url = "https://app.adsera.in/api/pub/addy/events"
payload = {
"phone": "919876543210",
"type": "order_shipped",
"description": "The order was handed to the courier.",
"data": {
"order_id": "A-1042",
"courier": "Delhivery",
"tracking_url": "https://track.example.com/AWB123"
},
"whatsapp": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"x-api-secret": "<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>',
'x-api-secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
phone: '919876543210',
type: 'order_shipped',
description: 'The order was handed to the courier.',
data: {
order_id: 'A-1042',
courier: 'Delhivery',
tracking_url: 'https://track.example.com/AWB123'
},
whatsapp: '<string>'
})
};
fetch('https://app.adsera.in/api/pub/addy/events', 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.adsera.in/api/pub/addy/events",
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([
'phone' => '919876543210',
'type' => 'order_shipped',
'description' => 'The order was handed to the courier.',
'data' => [
'order_id' => 'A-1042',
'courier' => 'Delhivery',
'tracking_url' => 'https://track.example.com/AWB123'
],
'whatsapp' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>",
"x-api-secret: <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://app.adsera.in/api/pub/addy/events"
payload := strings.NewReader("{\n \"phone\": \"919876543210\",\n \"type\": \"order_shipped\",\n \"description\": \"The order was handed to the courier.\",\n \"data\": {\n \"order_id\": \"A-1042\",\n \"courier\": \"Delhivery\",\n \"tracking_url\": \"https://track.example.com/AWB123\"\n },\n \"whatsapp\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-api-secret", "<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://app.adsera.in/api/pub/addy/events")
.header("x-api-key", "<api-key>")
.header("x-api-secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"919876543210\",\n \"type\": \"order_shipped\",\n \"description\": \"The order was handed to the courier.\",\n \"data\": {\n \"order_id\": \"A-1042\",\n \"courier\": \"Delhivery\",\n \"tracking_url\": \"https://track.example.com/AWB123\"\n },\n \"whatsapp\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.adsera.in/api/pub/addy/events")
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["x-api-secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone\": \"919876543210\",\n \"type\": \"order_shipped\",\n \"description\": \"The order was handed to the courier.\",\n \"data\": {\n \"order_id\": \"A-1042\",\n \"courier\": \"Delhivery\",\n \"tracking_url\": \"https://track.example.com/AWB123\"\n },\n \"whatsapp\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"delivered": true,
"via": "message",
"text": "<string>",
"reason": "<string>"
}
}{
"success": false,
"error": "Contact not found"
}{
"status": 401,
"success": false,
"error": "Unauthorized: Please provide valid API credentials."
}{
"success": false,
"error": "Contact not found"
}{
"success": false,
"error": "Contact not found"
}Use events to keep customers updated from your own systems: an order shipped, a payment arrived, an appointment moved, a document is ready.
Before you start: set your events up in AI Agent → Events. For each event you set:
Every event is listed with what happened under AI Agent → Events → Recent events. WhatsApp Pay payments and Cal.com bookings need no event: Addy already knows about them.
- its key (
type), such asorder_shipped - what it means and what Addy should tell the customer
- the facts it carries, such as
order_idandtracking_url - a WhatsApp template to use when the 24-hour window has closed
type you haven’t set up, as long as you add a description of what happened.
What Addy does:
| When | What is sent |
|---|---|
| Within 24 hours of the customer’s last message | Addy writes the update in its own voice, using only the facts in data. The response has via: "message" and the text. |
| After 24 hours | The event’s WhatsApp template, with its variables filled from data or the contact. The response has via: "template". With no template set, nothing is sent and reason is outside_24h_window. |
| Within 24 hours, but your team has taken the chat | Nothing is sent (reason: "a_person_is_handling_this_chat"), so Addy never talks over your salesperson. Outside the 24 hours the template still goes out. |
curl -X POST https://app.adsera.in/api/pub/addy/events \
-H "x-api-key: YOUR_APP_ID" -H "x-api-secret: YOUR_APP_SECRET" \
-H "Content-Type: application/json" \
-d '{"phone": "919876543210", "type": "order_shipped", "data": {"order_id": "A-1042", "courier": "Delhivery", "tracking_url": "https://track.example.com/AWB123"}}'
Authorizations
Body
application/json
Was this page helpful?