curl --request GET \
--url https://app.timelines.ai/integrations/api/waba/chats/{chat_id}/messages \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.timelines.ai/integrations/api/waba/chats/{chat_id}/messages"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.timelines.ai/integrations/api/waba/chats/{chat_id}/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/chats/{chat_id}/messages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.timelines.ai/integrations/api/waba/chats/{chat_id}/messages"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.timelines.ai/integrations/api/waba/chats/{chat_id}/messages")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.timelines.ai/integrations/api/waba/chats/{chat_id}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": "ok",
"data": {
"has_more_pages": true,
"messages": [
{
"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"
}
]
}Get WABA Chat History
Get the filtered chat history (messages only) of a WABA chat.
curl --request GET \
--url https://app.timelines.ai/integrations/api/waba/chats/{chat_id}/messages \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.timelines.ai/integrations/api/waba/chats/{chat_id}/messages"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.timelines.ai/integrations/api/waba/chats/{chat_id}/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/chats/{chat_id}/messages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.timelines.ai/integrations/api/waba/chats/{chat_id}/messages"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.timelines.ai/integrations/api/waba/chats/{chat_id}/messages")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.timelines.ai/integrations/api/waba/chats/{chat_id}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": "ok",
"data": {
"has_more_pages": true,
"messages": [
{
"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.
Path Parameters
an id of the chat as appears in TimelinesAI (can be found in the URL of the chat page, or in the payload of outbound webhook). Supports sending messages to a group.
Query Parameters
specify true to filter messages sent from the WABA account, false to filter messages received from the contact.
can specify date or datetime in ISO format to filter out messages created AFTER the specified date (inclusive)
can specify date or datetime in ISO format to filter out messages created BEFORE the specified date (inclusive)
can specify message uid to filter out messages created after the specified message (excluding the specified message itself)
can specify message uid to filter out messages created before the specified message (excluding the specified message itself)
order messages by timestamp, according to possible values: asc, desc
asc, desc specify the page of results, starting with 1. Check "has more page" response value to see if more pages are available.
override the default page size (50).

