Markit AI LogoMarkit | Docs
Markit API

Conversations

The Conversations resource allows you to retrieve user conversations. The following actions can be performed on this resource:

  • Retrieve All Conversations
  • Retrieve a Specific Conversation

Retrieve All Conversations

Retrieves all conversations on your account. If you want to retrieve the messages from a conversation, use the conversationSid and fetch the single conversation. The default number of conversations is 20.

    GET https://api.markitai.com/v1/conversations

You can include additional parameters in the request as described in the Query Parameters section. For instance, the request below will return conversations with a status of "archived".

    GET https://api.markitai.com/v1/conversations?status=archived

Available query parameters:

  • limit: 20 (default)
  • offset: 0 (default)
  • status: ‘archived’ (default = '')
  • recentTimestamp: ‘desc’ | ‘asc’ (default = ‘desc’)

Example Response:

{
  "data": [
    {
      "conversationSid": "CHXXXXX",
      "createdAt": "2024-11-05T00:00:00.000Z",
      "creatorUid": "abc123",
      "chatIndicator": [
        {
          "indicator": false,
          "uid": "abc123"
        },
        {
          "indicator": true,
          "uid": "123abc"
        }
      ],
      "participantUids": [
        "123abc"
      ],
      "recentMessage": {
        "twilioMessageId": "IMXXXXX",
        "sentBy": "abc123",
        "text": "Here is a sample message.",
        "photoURL": ""
      },
      "recentTimestamp": "2024-01-01T-00:00:00.000Z",
      "archived": false
    },
    ...
],
  "pagingData": {
    "prevPage": null,
    "currentPage": 1,
    "nextPage": 2,
    "hasMore": true
  }
}

Retrieve a Single Conversation

Retrieves a single conversation with the conversation ID equal to {id}. Also fetches the 10 (default) most recent messages in the conversation.

You can add a query to change the limit of the number of messages to retrieve by appending
?limit=10 to the request. Max limit of 100.

    GET https://api.markitai.com/v1/conversations/{id}

Example Response:

{
  "conversation": {
    "conversationSid": "CHXXXXX",
    "createdAt": "2024-01-01T00:00:00.000Z",
    "creatorUid": "abc123",
    "chatIndicator": [
      {
        "indicator": false,
        "uid": "abc123"
      },
      {
        "indicator": true,
        "uid": "123abc"
      }
    ],
    "participantUids": [
      "123abc"
    ],
    "recentMessage": {
      "twilioMessageId": "IMXXXXX",
      "sentBy": "abc123",
      "text": "This is a sample message.",
      "photoURL": ""
    },
    "recentTimestamp": "2024-01-01T00:00:00.000Z",
    "archived": false
  },
  "messages": [
    {
      "_id": "IMXXXXX",
      "text": "This is a sample message.",
      "createdAt": "2024-01-01T00:00:00.000Z",
      "user": {
        "_id": "abc123",
        "name": "John Doe",
        "avatar": "https://firebasestorage.googleapis.com/…"
      },
      "type": "chat",
      "photoURL": "",
      "status": "delivered"
    },
    ...
  ]
}

On this page