Conversations
List Conversations
Retrieve all conversations for your company
GET https://api.perform.chat/rest/v1/conversations
{
"keyId": "your-key-id",
"keySecret": "your-key-secret"
}
| Parameter | Type | Default | Max | Description |
|---|
page | number | 1 | - | Page number |
limit | number | 20 | 100 | Items per page |
{
"data": [
{
"id": "conv_123",
"title": "Help with billing question",
"customer_user_id": "cu_123",
"message_count": 12,
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T11:45:00Z"
},
{
"id": "conv_124",
"title": "Product inquiry",
"customer_user_id": "cu_456",
"message_count": 5,
"created_at": "2025-01-15T09:15:00Z",
"updated_at": "2025-01-15T09:30:00Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 250,
"total_pages": 13
}
}
| Field | Type | Description |
|---|
id | string | Unique conversation identifier |
title | string | Conversation title |
customer_user_id | string | ID of the customer user |
message_count | number | Number of messages |
created_at | string | ISO 8601 timestamp of creation |
updated_at | string | ISO 8601 timestamp of last update |
async function listConversations(page = 1, limit = 20) {
const response = await axios.get(
'https://api.performchat.com/rest/v1/v1/conversations',
{
params: { page, limit },
data: {
keyId: process.env.API_KEY_ID,
keySecret: process.env.API_KEY_SECRET
}
}
)
return response.data
}
// Usage
const recent = await listConversations(1, 10)
console.log(`Recent conversations: ${recent.data.length}`)
| Status | Description |
|---|
| 401 | Invalid API credentials |
| 400 | Invalid parameters |
| 500 | Internal server error |
async function getRecentConversations(limit = 10) {
return await listConversations(1, limit)
}
async function exportAllConversations() {
const allConversations = []
let page = 1
let hasMore = true
while (hasMore) {
const result = await listConversations(page, 100)
allConversations.push(...result.data)
hasMore = page < result.pagination.total_pages
page++
}
return allConversations
}
async function findUserConversations(customerUserId) {
const all = await exportAllConversations()
return all.filter(conv => conv.customer_user_id === customerUserId)
}
- Use appropriate page sizes - Larger pages (100) for exports, smaller for UI
- Cache conversation lists - Lists don't change frequently
- Monitor pagination - Don't assume all data fits in one page
- Track updated_at - Identify active conversations