Skip to main content
Export messages for a specific account with cursor-based pagination support. Response includes messageType (string), source, and subType fields. The channel parameter is optional - if not provided, all non-email message types will be returned including activity messages (opportunity updates, appointments, etc.).
GET https://services.leadconnectorhq.com/conversations/messages/export

Autorización

Authorization
string
required
Bearer token generado desde el portal Leadway. Ver Autenticación.
Version
string
default:"2021-07-28"
required
Versión de la API.

Query parameters

locationId
string
required
Account ID to filter messages by
limit
number
Number of messages to return per page
cursor
string
Cursor for pagination. Pass the nextCursor from previous response to get next page.
sortBy
string
Field to sort by
sortOrder
string
Sort order
conversationId
string
Filter messages by conversation ID
contactId
string
Filter messages by contact ID
channel
string
Filter by message channel. If not provided, all non-email message types will be returned including activity messages (opportunity updates, appointments, etc.)
startDate
string
Start date to filter messages by
endDate
string
End date to filter messages by

Respuestas

messages
object[]
required
Array of messages
nextCursor
string
Cursor for fetching next page. Null if no more results.
total
number
default:"1234"
required
Total number of messages matching the query
{
  "messages": [
    {
      "id": "ve9EPM428h8vShlRW1KT",
      "type": 1,
      "messageType": "SMS",
      "locationId": "ve9EPM428h8vShlRW1KT",
      "contactId": "ve9EPM428h8vShlRW1KT",
      "conversationId": "ve9EPM428h8vShlRW1KT",
      "dateAdded": "2024-03-27T18:13:49.000Z",
      "body": "Hi there",
      "direction": "inbound",
      "status": "connected",
      "contentType": "text/plain",
      "attachments": [
        "string"
      ],
      "meta": {
        "callDuration": 120,
        "callStatus": "completed",
        "email": {
          "email": {
            "messageIds": [
              "ve9EPM428kjkvShlRW1KT",
              "ve9EPs1028kjkvShlRW1KT"
            ]
          }
        }
      },
      "source": "workflow",
      "userId": "ve9EPM428kjkvShlRW1KT",
      "conversationProviderId": "ve9EPM428kjkvShlRW1KT",
      "chatWidgetId": "67b0cc8cf14b19d85ace7s35"
    }
  ],
  "nextCursor": "eyJwaXRJZCI6ImFiYy0xMjMiLCJsYXN0U29ydCI6WzE2NDY4NjQ0MDBdLCJsYXN0SWQiOiIxMjMifQ==",
  "total": 1234
}
{}
{}

Ejemplo

curl -X GET 'https://services.leadconnectorhq.com/conversations/messages/export' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Version: 2021-07-28'
const response = await fetch('https://services.leadconnectorhq.com/conversations/messages/export', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
    Version: '2021-07-28',
  },
});
const data = await response.json();
import os, requests
response = requests.request(
    'GET',
    'https://services.leadconnectorhq.com/conversations/messages/export',
    headers={
        'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
        'Version': '2021-07-28',
    },
)
data = response.json()
<?php
$ch = curl_init('https://services.leadconnectorhq.com/conversations/messages/export');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
        'Version: 2021-07-28',
    ],
]);
$data = json_decode(curl_exec($ch), true);