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. Each conversation is with one follower, and its uid is that follower's user ID. If you want to retrieve the messages from a conversation, use the uid 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": [
    {
      "uid": "123abc",
      "createdAt": "2024-11-05T00:00:00.000Z",
      "chatIndicator": [
        {
          "indicator": false,
          "uid": "abc123"
        },
        {
          "indicator": true,
          "uid": "123abc"
        }
      ],
      "recentMessage": {
        "twilioMessageId": "SMXXXXX",
        "sentBy": "abc123",
        "text": "Here is a sample message.",
        "photoURL": ""
      },
      "recentTimestamp": "2024-01-01T00:00:00.000Z",
      "archived": false
    },
    ...
],
  "pagingData": {
    "prevPage": null,
    "currentPage": 1,
    "nextPage": 2,
    "hasMore": true
  }
}

Retrieve a Single Conversation

Retrieves a single conversation where {id} is the uid of the follower you are messaging. 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:

{
  "data": {
    "uid": "123abc",
    "createdAt": "2024-01-01T00:00:00.000Z",
    "chatIndicator": [
      {
        "indicator": false,
        "uid": "abc123"
      },
      {
        "indicator": true,
        "uid": "123abc"
      }
    ],
    "recentMessage": {
      "twilioMessageId": "SMXXXXX",
      "sentBy": "abc123",
      "text": "This is a sample message.",
      "photoURL": ""
    },
    "recentTimestamp": "2024-01-01T00:00:00.000Z",
    "archived": false
  },
  "messages": [
    {
      "_id": "SMXXXXX",
      "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