curl --request POST \
--url https://app.timelines.ai/integrations/api/waba/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "Hello",
"file_uid": "<string>",
"waba_account_id": 4021,
"phone": "+15551230000"
}
'import requests
url = "https://app.timelines.ai/integrations/api/waba/messages"
payload = {
"text": "Hello",
"file_uid": "<string>",
"waba_account_id": 4021,
"phone": "+15551230000"
}
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({
text: 'Hello',
file_uid: '<string>',
waba_account_id: 4021,
phone: '+15551230000'
})
};
fetch('https://app.timelines.ai/integrations/api/waba/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.timelines.ai/integrations/api/waba/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([
'text' => 'Hello',
'file_uid' => '<string>',
'waba_account_id' => 4021,
'phone' => '+15551230000'
]),
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.timelines.ai/integrations/api/waba/messages"
payload := strings.NewReader("{\n \"text\": \"Hello\",\n \"file_uid\": \"<string>\",\n \"waba_account_id\": 4021,\n \"phone\": \"+15551230000\"\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.timelines.ai/integrations/api/waba/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Hello\",\n \"file_uid\": \"<string>\",\n \"waba_account_id\": 4021,\n \"phone\": \"+15551230000\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.timelines.ai/integrations/api/waba/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 \"text\": \"Hello\",\n \"file_uid\": \"<string>\",\n \"waba_account_id\": 4021,\n \"phone\": \"+15551230000\"\n}"
response = http.request(request)
puts response.read_body{
"status": "ok",
"data": {
"uid": "de919486-0c93-409d-ae66-c2bbb544faca",
"chat_id": "1000001",
"timestamp": "2023-06-18 15:19:23 +0300",
"received_timestamp": "2023-06-18 14:39:25 +0300",
"sender_phone": "+972540000001",
"sender_name": "John Doe",
"recipient_phone": "+972540000002",
"recipient_name": "Kate Smith",
"from_me": true,
"status": "Read",
"origin": "Public API",
"has_attachment": true,
"message_type": "Note",
"data": {
"key1": "value1",
"key2": "value2"
},
"created_by": "Kate Smith",
"text": "Hello, Kateπ",
"attachment_url": "https://acme.com/logo.png",
"attachment_filename": "logo.png",
"reactions": {
"users": [
{
"name": "John Doe",
"phone": "+972540000001",
"reaction": "π",
"current": true
},
{
"name": "Kate Smith",
"phone": "+972540000002",
"reaction": "π",
"current": false
}
],
"reactions": {
"π": 2
},
"total": 2
},
"failure_reason": {
"code": 123,
"title": "<string>",
"details": "<string>"
}
}
}{
"message": "<string>",
"status": "error",
"error_code": "validation_error",
"errors": [
{
"fields": [
"url"
],
"msg": "must be a valid http(s) URL"
}
]
}{
"message": "<string>",
"status": "error",
"error_code": "validation_error",
"errors": [
{
"fields": [
"url"
],
"msg": "must be a valid http(s) URL"
}
]
}{
"message": "<string>",
"status": "error",
"error_code": "validation_error",
"errors": [
{
"fields": [
"url"
],
"msg": "must be a valid http(s) URL"
}
]
}Send WABA Message to Phone
Send a WABA message to a phone number.
curl --request POST \
--url https://app.timelines.ai/integrations/api/waba/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "Hello",
"file_uid": "<string>",
"waba_account_id": 4021,
"phone": "+15551230000"
}
'import requests
url = "https://app.timelines.ai/integrations/api/waba/messages"
payload = {
"text": "Hello",
"file_uid": "<string>",
"waba_account_id": 4021,
"phone": "+15551230000"
}
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({
text: 'Hello',
file_uid: '<string>',
waba_account_id: 4021,
phone: '+15551230000'
})
};
fetch('https://app.timelines.ai/integrations/api/waba/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.timelines.ai/integrations/api/waba/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([
'text' => 'Hello',
'file_uid' => '<string>',
'waba_account_id' => 4021,
'phone' => '+15551230000'
]),
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.timelines.ai/integrations/api/waba/messages"
payload := strings.NewReader("{\n \"text\": \"Hello\",\n \"file_uid\": \"<string>\",\n \"waba_account_id\": 4021,\n \"phone\": \"+15551230000\"\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.timelines.ai/integrations/api/waba/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Hello\",\n \"file_uid\": \"<string>\",\n \"waba_account_id\": 4021,\n \"phone\": \"+15551230000\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.timelines.ai/integrations/api/waba/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 \"text\": \"Hello\",\n \"file_uid\": \"<string>\",\n \"waba_account_id\": 4021,\n \"phone\": \"+15551230000\"\n}"
response = http.request(request)
puts response.read_body{
"status": "ok",
"data": {
"uid": "de919486-0c93-409d-ae66-c2bbb544faca",
"chat_id": "1000001",
"timestamp": "2023-06-18 15:19:23 +0300",
"received_timestamp": "2023-06-18 14:39:25 +0300",
"sender_phone": "+972540000001",
"sender_name": "John Doe",
"recipient_phone": "+972540000002",
"recipient_name": "Kate Smith",
"from_me": true,
"status": "Read",
"origin": "Public API",
"has_attachment": true,
"message_type": "Note",
"data": {
"key1": "value1",
"key2": "value2"
},
"created_by": "Kate Smith",
"text": "Hello, Kateπ",
"attachment_url": "https://acme.com/logo.png",
"attachment_filename": "logo.png",
"reactions": {
"users": [
{
"name": "John Doe",
"phone": "+972540000001",
"reaction": "π",
"current": true
},
{
"name": "Kate Smith",
"phone": "+972540000002",
"reaction": "π",
"current": false
}
],
"reactions": {
"π": 2
},
"total": 2
},
"failure_reason": {
"code": 123,
"title": "<string>",
"details": "<string>"
}
}
}{
"message": "<string>",
"status": "error",
"error_code": "validation_error",
"errors": [
{
"fields": [
"url"
],
"msg": "must be a valid http(s) URL"
}
]
}{
"message": "<string>",
"status": "error",
"error_code": "validation_error",
"errors": [
{
"fields": [
"url"
],
"msg": "must be a valid http(s) URL"
}
]
}{
"message": "<string>",
"status": "error",
"error_code": "validation_error",
"errors": [
{
"fields": [
"url"
],
"msg": "must be a valid http(s) URL"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
A JSON describing the recipient and message payload, or a multipart/form-data upload of a file with an optional text caption.
Exactly one of text, file_uid, or template must be provided (a file may be sent together with a text caption; template cannot be combined with text, file_uid, or a file upload). waba_account_id and phone are required when sending without a chat id (i.e. via POST /waba/messages); they are ignored when sending into an existing chat.
Free-text message or caption for file_uid.
"Hello"
Previously uploaded Public API file UID.
Show child attributes
Show child attributes
Required when sending without a chat id.
4021
Required when sending without a chat id.
"+15551230000"

