perform.chat
Conversations

List Conversations

Retrieve all conversations for your company

Endpoint

GET https://api.perform.chat/rest/v1/conversations

Request Body

{
  "keyId": "your-key-id",
  "keySecret": "your-key-secret"
}

Query Parameters

ParameterTypeDefaultMaxDescription
pagenumber1-Page number
limitnumber20100Items per page

Response

{
  "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
  }
}

Response Fields

Conversation Object

FieldTypeDescription
idstringUnique conversation identifier
titlestringConversation title
customer_user_idstringID of the customer user
message_countnumberNumber of messages
created_atstringISO 8601 timestamp of creation
updated_atstringISO 8601 timestamp of last update

Example Request

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}`)

Error Responses

StatusDescription
401Invalid API credentials
400Invalid parameters
500Internal server error

Use Cases

Get Recent Conversations

async function getRecentConversations(limit = 10) {
  return await listConversations(1, limit)
}

Export All Conversations

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
}

Find Conversations by User

async function findUserConversations(customerUserId) {
  const all = await exportAllConversations()
  return all.filter(conv => conv.customer_user_id === customerUserId)
}

Best Practices

  1. Use appropriate page sizes - Larger pages (100) for exports, smaller for UI
  2. Cache conversation lists - Lists don't change frequently
  3. Monitor pagination - Don't assume all data fits in one page
  4. Track updated_at - Identify active conversations