curl --request POST \
--url https://app.timelines.ai/integrations/api/messages/to_jid \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"jid": "14840000000@s.whatsapp.net",
"whatsapp_account_phone": "+14841111111",
"reply_to": "<string>",
"text": "hello, world!",
"file_uid": "afa9d4dd-978d-4a14-aa1b-bd65c272e645",
"label": "customer",
"chat_name": "MyChat",
"attachment_template_id": 123456
}
'import requests
url = "https://app.timelines.ai/integrations/api/messages/to_jid"
payload = {
"jid": "14840000000@s.whatsapp.net",
"whatsapp_account_phone": "+14841111111",
"reply_to": "<string>",
"text": "hello, world!",
"file_uid": "afa9d4dd-978d-4a14-aa1b-bd65c272e645",
"label": "customer",
"chat_name": "MyChat",
"attachment_template_id": 123456
}
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({
jid: '14840000000@s.whatsapp.net',
whatsapp_account_phone: '+14841111111',
reply_to: '<string>',
text: 'hello, world!',
file_uid: 'afa9d4dd-978d-4a14-aa1b-bd65c272e645',
label: 'customer',
chat_name: 'MyChat',
attachment_template_id: 123456
})
};
fetch('https://app.timelines.ai/integrations/api/messages/to_jid', 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/messages/to_jid",
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([
'jid' => '14840000000@s.whatsapp.net',
'whatsapp_account_phone' => '+14841111111',
'reply_to' => '<string>',
'text' => 'hello, world!',
'file_uid' => 'afa9d4dd-978d-4a14-aa1b-bd65c272e645',
'label' => 'customer',
'chat_name' => 'MyChat',
'attachment_template_id' => 123456
]),
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/messages/to_jid"
payload := strings.NewReader("{\n \"jid\": \"14840000000@s.whatsapp.net\",\n \"whatsapp_account_phone\": \"+14841111111\",\n \"reply_to\": \"<string>\",\n \"text\": \"hello, world!\",\n \"file_uid\": \"afa9d4dd-978d-4a14-aa1b-bd65c272e645\",\n \"label\": \"customer\",\n \"chat_name\": \"MyChat\",\n \"attachment_template_id\": 123456\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/messages/to_jid")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"jid\": \"14840000000@s.whatsapp.net\",\n \"whatsapp_account_phone\": \"+14841111111\",\n \"reply_to\": \"<string>\",\n \"text\": \"hello, world!\",\n \"file_uid\": \"afa9d4dd-978d-4a14-aa1b-bd65c272e645\",\n \"label\": \"customer\",\n \"chat_name\": \"MyChat\",\n \"attachment_template_id\": 123456\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.timelines.ai/integrations/api/messages/to_jid")
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 \"jid\": \"14840000000@s.whatsapp.net\",\n \"whatsapp_account_phone\": \"+14841111111\",\n \"reply_to\": \"<string>\",\n \"text\": \"hello, world!\",\n \"file_uid\": \"afa9d4dd-978d-4a14-aa1b-bd65c272e645\",\n \"label\": \"customer\",\n \"chat_name\": \"MyChat\",\n \"attachment_template_id\": 123456\n}"
response = http.request(request)
puts response.read_body{
"status": "ok",
"data": {
"message_uid": "<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 Message to JID
Send a message to a WhatsApp chat or group specified by JID.
curl --request POST \
--url https://app.timelines.ai/integrations/api/messages/to_jid \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"jid": "14840000000@s.whatsapp.net",
"whatsapp_account_phone": "+14841111111",
"reply_to": "<string>",
"text": "hello, world!",
"file_uid": "afa9d4dd-978d-4a14-aa1b-bd65c272e645",
"label": "customer",
"chat_name": "MyChat",
"attachment_template_id": 123456
}
'import requests
url = "https://app.timelines.ai/integrations/api/messages/to_jid"
payload = {
"jid": "14840000000@s.whatsapp.net",
"whatsapp_account_phone": "+14841111111",
"reply_to": "<string>",
"text": "hello, world!",
"file_uid": "afa9d4dd-978d-4a14-aa1b-bd65c272e645",
"label": "customer",
"chat_name": "MyChat",
"attachment_template_id": 123456
}
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({
jid: '14840000000@s.whatsapp.net',
whatsapp_account_phone: '+14841111111',
reply_to: '<string>',
text: 'hello, world!',
file_uid: 'afa9d4dd-978d-4a14-aa1b-bd65c272e645',
label: 'customer',
chat_name: 'MyChat',
attachment_template_id: 123456
})
};
fetch('https://app.timelines.ai/integrations/api/messages/to_jid', 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/messages/to_jid",
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([
'jid' => '14840000000@s.whatsapp.net',
'whatsapp_account_phone' => '+14841111111',
'reply_to' => '<string>',
'text' => 'hello, world!',
'file_uid' => 'afa9d4dd-978d-4a14-aa1b-bd65c272e645',
'label' => 'customer',
'chat_name' => 'MyChat',
'attachment_template_id' => 123456
]),
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/messages/to_jid"
payload := strings.NewReader("{\n \"jid\": \"14840000000@s.whatsapp.net\",\n \"whatsapp_account_phone\": \"+14841111111\",\n \"reply_to\": \"<string>\",\n \"text\": \"hello, world!\",\n \"file_uid\": \"afa9d4dd-978d-4a14-aa1b-bd65c272e645\",\n \"label\": \"customer\",\n \"chat_name\": \"MyChat\",\n \"attachment_template_id\": 123456\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/messages/to_jid")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"jid\": \"14840000000@s.whatsapp.net\",\n \"whatsapp_account_phone\": \"+14841111111\",\n \"reply_to\": \"<string>\",\n \"text\": \"hello, world!\",\n \"file_uid\": \"afa9d4dd-978d-4a14-aa1b-bd65c272e645\",\n \"label\": \"customer\",\n \"chat_name\": \"MyChat\",\n \"attachment_template_id\": 123456\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.timelines.ai/integrations/api/messages/to_jid")
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 \"jid\": \"14840000000@s.whatsapp.net\",\n \"whatsapp_account_phone\": \"+14841111111\",\n \"reply_to\": \"<string>\",\n \"text\": \"hello, world!\",\n \"file_uid\": \"afa9d4dd-978d-4a14-aa1b-bd65c272e645\",\n \"label\": \"customer\",\n \"chat_name\": \"MyChat\",\n \"attachment_template_id\": 123456\n}"
response = http.request(request)
puts response.read_body{
"status": "ok",
"data": {
"message_uid": "<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 recipient and message payload.
jid, WhatsApp ID of a contact or a group, a string structured as 'x@s.whatsapp.net', where 'x' is the phone number of the contact.
"14840000000@s.whatsapp.net"
the WhatsApp account (as a phone number, in international format) to which the chat specified by JID belongs to. If omitted, the most recently connected WhatsApp account in the workspace will be used.
"+14841111111"
UID of the message this message replies to. Must reference a message in the same workspace and WhatsApp account. Null or empty string is ignored.
plain text message
2000"hello, world!"
attachment UID
"afa9d4dd-978d-4a14-aa1b-bd65c272e645"
assign label to the chat, in which the message is sent (create new label, if not exists)
64"customer"
an exact name of the chat (or group) as appears in TimelinesAI)
256"MyChat"
a template ID of the attachment to be sent. The template must be created in the workspace before sending a message with it.
123456

