Get EXTERNAL Conversation Messages
curl --request GET \
--url https://api.example.com/api/v1/sdk/conversations/:conversationId/messagesimport requests
url = "https://api.example.com/api/v1/sdk/conversations/:conversationId/messages"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/sdk/conversations/:conversationId/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.example.com/api/v1/sdk/conversations/:conversationId/messages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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://api.example.com/api/v1/sdk/conversations/:conversationId/messages"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/sdk/conversations/:conversationId/messages")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/sdk/conversations/:conversationId/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyConversations
Get EXTERNAL Conversation Messages
GET
/
api
/
v1
/
sdk
/
conversations
/
:conversationId
/
messages
Get EXTERNAL Conversation Messages
curl --request GET \
--url https://api.example.com/api/v1/sdk/conversations/:conversationId/messagesimport requests
url = "https://api.example.com/api/v1/sdk/conversations/:conversationId/messages"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/sdk/conversations/:conversationId/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.example.com/api/v1/sdk/conversations/:conversationId/messages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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://api.example.com/api/v1/sdk/conversations/:conversationId/messages"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/sdk/conversations/:conversationId/messages")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/sdk/conversations/:conversationId/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyOverview
Get paginated message history for an EXTERNAL conversation. The caller must be a participant (sameexternal_user_id or token identity).
Preferred path: GET /api/v1/sdk/conversations/:conversationId/messages.Legacy path:
GET /api/v1/conversations/external/:conversationId/messages.
Auth: Either Bearer token (SDK token) or API keys (X-Api-Key + X-Api-Secret). With Bearer, external_user_id is derived from the token and can be omitted.
When to Use
- Your frontend or backend needs to load past messages (inbox) for an EXTERNAL conversation.
- Use with List EXTERNAL conversations to build a full inbox: list conversations, then fetch messages for the selected one.
Request Headers
| Header | Required | Description |
|---|---|---|
Authorization | Optional* | Bearer <SDK token>. Use when calling from frontend with SDK token. |
X-Api-Key | Optional* | App public key. Required when not using Bearer. |
X-Api-Secret | Optional* | App secret key. Required when not using Bearer. |
Path Parameters
| Parameter | Description |
|---|---|
conversationId | Conversation UUID (EXTERNAL). |
Query Parameters
| Parameter | Required | Description |
|---|---|---|
external_user_id | When using API keys | Your app’s user ID. Omit when using Bearer (backend uses token sub). |
cursor | No | ISO 8601 timestamp. Returns messages before this time. Omit for the latest page. |
limit | No | Number of messages (default 20, max 100). |
Example: Bearer token (SDK / frontend)
curl -X GET "https://dev.vocantly.com/api/v1/sdk/conversations/770e8400-e29b-41d4-a716-446655440002/messages?limit=20" \
-H "Authorization: Bearer <SDK_TOKEN>" \
-H "Content-Type: application/json"
Example: API keys (backend)
curl -X GET "https://dev.vocantly.com/api/v1/sdk/conversations/770e8400-e29b-41d4-a716-446655440002/messages?external_user_id=user_123&limit=20" \
-H "X-Api-Key: pk_xxxxx" \
-H "X-Api-Secret: sk_xxxxx"
curl -X GET "https://dev.vocantly.com/api/v1/sdk/conversations/770e8400.../messages?external_user_id=user_123&cursor=2024-01-01T10:00:00.000Z&limit=20" \
-H "X-Api-Key: pk_xxxxx" \
-H "X-Api-Secret: sk_xxxxx"
Response
Success (200)
{
"success": true,
"message": "Messages retrieved successfully",
"data": {
"messages": [
{
"id": "msg-uuid",
"conversation_id": "770e8400-e29b-41d4-a716-446655440002",
"sender_id": "user_123",
"sender_type": "sdk",
"content": "Hello!",
"message_type": "text",
"created_at": "2024-01-01T12:00:00Z"
}
],
"pagination": {
"has_next_page": true,
"next_cursor": "2024-01-01T11:00:00.000Z",
"limit": 20
}
}
}
- Messages are ordered newest first (descending
created_at). Usenext_cursoras thecursorquery param for the next page (older messages). - When
has_next_pageisfalse, there are no older messages.
Error Responses
| Status | Description |
|---|---|
| 400 | Missing external_user_id or invalid cursor. |
| 401 | Invalid or missing API credentials. |
| 403 | Not a participant of this conversation, or conversation is not EXTERNAL. |
| 404 | Conversation not found. |
SDK
The JavaScript SDK calls this endpoint when you useconversation.fetchMessages({ cursor, limit }). Configure apiUrl and Bearer token, API keys, or getRestHeaders(). See SDK Inbox.
List EXTERNAL conversations
Inbox list
Create EXTERNAL (API Key)
Create conversation