Append thread messages
curl --request POST \
--url https://api.sidenet.ai/v1/threads/{id}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"role": "user",
"content": "Hi, can I check in at 2pm?",
"metadata": {
"channel": "whatsapp",
"wa_message_id": "wamid.HBg…"
}
}
],
"user_id": "user_4821",
"title": "WhatsApp · +34 600 000 000",
"metadata": {}
}
'import requests
url = "https://api.sidenet.ai/v1/threads/{id}/messages"
payload = {
"messages": [
{
"role": "user",
"content": "Hi, can I check in at 2pm?",
"metadata": {
"channel": "whatsapp",
"wa_message_id": "wamid.HBg…"
}
}
],
"user_id": "user_4821",
"title": "WhatsApp · +34 600 000 000",
"metadata": {}
}
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({
messages: [
{
role: 'user',
content: 'Hi, can I check in at 2pm?',
metadata: {channel: 'whatsapp', wa_message_id: 'wamid.HBg…'}
}
],
user_id: 'user_4821',
title: 'WhatsApp · +34 600 000 000',
metadata: {}
})
};
fetch('https://api.sidenet.ai/v1/threads/{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://api.sidenet.ai/v1/threads/{id}/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([
'messages' => [
[
'role' => 'user',
'content' => 'Hi, can I check in at 2pm?',
'metadata' => [
'channel' => 'whatsapp',
'wa_message_id' => 'wamid.HBg…'
]
]
],
'user_id' => 'user_4821',
'title' => 'WhatsApp · +34 600 000 000',
'metadata' => [
]
]),
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://api.sidenet.ai/v1/threads/{id}/messages"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hi, can I check in at 2pm?\",\n \"metadata\": {\n \"channel\": \"whatsapp\",\n \"wa_message_id\": \"wamid.HBg…\"\n }\n }\n ],\n \"user_id\": \"user_4821\",\n \"title\": \"WhatsApp · +34 600 000 000\",\n \"metadata\": {}\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://api.sidenet.ai/v1/threads/{id}/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hi, can I check in at 2pm?\",\n \"metadata\": {\n \"channel\": \"whatsapp\",\n \"wa_message_id\": \"wamid.HBg…\"\n }\n }\n ],\n \"user_id\": \"user_4821\",\n \"title\": \"WhatsApp · +34 600 000 000\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sidenet.ai/v1/threads/{id}/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 \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hi, can I check in at 2pm?\",\n \"metadata\": {\n \"channel\": \"whatsapp\",\n \"wa_message_id\": \"wamid.HBg…\"\n }\n }\n ],\n \"user_id\": \"user_4821\",\n \"title\": \"WhatsApp · +34 600 000 000\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"thread_id": "<string>",
"created": true,
"message_ids": [
"<string>"
]
}Chat & Messaging
Append thread messages
Appends messages to a thread without running an agent — to record a message that arrived on an external channel, or to create a thread (any id you choose) before anyone has spoken on it. The thread is created when it does not exist, for the calling user: a session token writes as its own user; an organization API key names the user with user_id. An existing thread must belong to that user (403 otherwise). Each message is { role, content, metadata?, created_at?, id? } where content is a text or an array of message parts; up to 50 per call. The rows are ordinary thread messages: GET /v1/messages returns them and the next POST /v1/chat turn on the thread reads them as history.
POST
/
v1
/
threads
/
{id}
/
messages
Append thread messages
curl --request POST \
--url https://api.sidenet.ai/v1/threads/{id}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"role": "user",
"content": "Hi, can I check in at 2pm?",
"metadata": {
"channel": "whatsapp",
"wa_message_id": "wamid.HBg…"
}
}
],
"user_id": "user_4821",
"title": "WhatsApp · +34 600 000 000",
"metadata": {}
}
'import requests
url = "https://api.sidenet.ai/v1/threads/{id}/messages"
payload = {
"messages": [
{
"role": "user",
"content": "Hi, can I check in at 2pm?",
"metadata": {
"channel": "whatsapp",
"wa_message_id": "wamid.HBg…"
}
}
],
"user_id": "user_4821",
"title": "WhatsApp · +34 600 000 000",
"metadata": {}
}
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({
messages: [
{
role: 'user',
content: 'Hi, can I check in at 2pm?',
metadata: {channel: 'whatsapp', wa_message_id: 'wamid.HBg…'}
}
],
user_id: 'user_4821',
title: 'WhatsApp · +34 600 000 000',
metadata: {}
})
};
fetch('https://api.sidenet.ai/v1/threads/{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://api.sidenet.ai/v1/threads/{id}/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([
'messages' => [
[
'role' => 'user',
'content' => 'Hi, can I check in at 2pm?',
'metadata' => [
'channel' => 'whatsapp',
'wa_message_id' => 'wamid.HBg…'
]
]
],
'user_id' => 'user_4821',
'title' => 'WhatsApp · +34 600 000 000',
'metadata' => [
]
]),
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://api.sidenet.ai/v1/threads/{id}/messages"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hi, can I check in at 2pm?\",\n \"metadata\": {\n \"channel\": \"whatsapp\",\n \"wa_message_id\": \"wamid.HBg…\"\n }\n }\n ],\n \"user_id\": \"user_4821\",\n \"title\": \"WhatsApp · +34 600 000 000\",\n \"metadata\": {}\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://api.sidenet.ai/v1/threads/{id}/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hi, can I check in at 2pm?\",\n \"metadata\": {\n \"channel\": \"whatsapp\",\n \"wa_message_id\": \"wamid.HBg…\"\n }\n }\n ],\n \"user_id\": \"user_4821\",\n \"title\": \"WhatsApp · +34 600 000 000\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sidenet.ai/v1/threads/{id}/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 \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hi, can I check in at 2pm?\",\n \"metadata\": {\n \"channel\": \"whatsapp\",\n \"wa_message_id\": \"wamid.HBg…\"\n }\n }\n ],\n \"user_id\": \"user_4821\",\n \"title\": \"WhatsApp · +34 600 000 000\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"thread_id": "<string>",
"created": true,
"message_ids": [
"<string>"
]
}Authorizations
bearerAuthsessionToken
Path Parameters
Body
application/json