GET
/
users
/
{uid}
/
messages
List User Messages
curl --request GET \
  --url https://{appid}.api-{region}.cometchat.io/v3/users/{uid}/messages \
  --header 'apikey: <api-key>'
{
  "data": [
    {
      "id": "1776",
      "conversationId": "superhero2_user_superhero3",
      "sender": "superhero2",
      "receiverType": "user",
      "receiver": "superhero3",
      "category": "call",
      "type": "audio",
      "data": {
        "action": "initiated",
        "entities": {
          "by": {
            "entity": {
              "uid": "superhero2",
              "name": "Captain America",
              "role": "default",
              "avatar": "https://data-eu.cometchat.io/assets/images/avatars/captainamerica.png",
              "status": "offline"
            },
            "entityType": "user"
          },
          "on": {
            "entity": {
              "data": {
                "entities": {
                  "sender": {
                    "entity": {
                      "uid": "superhero2",
                      "name": "Captain America",
                      "role": "default",
                      "avatar": "https://data-eu.cometchat.io/assets/images/avatars/captainamerica.png",
                      "status": "offline"
                    },
                    "entityType": "user"
                  },
                  "receiver": {
                    "entity": {
                      "uid": "superhero3",
                      "name": "Spiderman",
                      "role": "default",
                      "avatar": "https://data-eu.cometchat.io/assets/images/avatars/spiderman.png",
                      "status": "offline",
                      "conversationId": "superhero2_user_superhero3"
                    },
                    "entityType": "user"
                  }
                },
                "metadata": {
                  "key": {
                    "one": "two"
                  }
                }
              },
              "type": "audio",
              "sender": "superhero2",
              "status": "initiated",
              "joinedAt": 1646995097,
              "receiver": "superhero3",
              "sessionid": "16469950973f7f6a1ea6d5166db11c929cdbde6a61902e10ba",
              "wsChannel": {
                "secret": "083c2a7f660150e42c2bf07a17231e90980b290d",
                "service": "19757e59e8b9669.call",
                "identity": "[19757e59e8b9669]16469950973f7f6a1ea6d5166db11c929cdbde6a61902e10ba"
              },
              "initiatedAt": 1646995097,
              "receiverType": "user",
              "conversationId": "superhero2_user_superhero3"
            },
            "entityType": "call"
          },
          "for": {
            "entity": {
              "uid": "superhero3",
              "name": "Spiderman",
              "role": "default",
              "avatar": "https://data-eu.cometchat.io/assets/images/avatars/spiderman.png",
              "status": "offline",
              "conversationId": "superhero2_user_superhero3"
            },
            "entityType": "user"
          }
        }
      },
      "sentAt": 1646995097,
      "updatedAt": 1646995097
    },
    {
      "id": "1777",
      "conversationId": "superhero2_user_superhero3",
      "sender": "superhero3",
      "receiverType": "user",
      "receiver": "superhero2",
      "category": "call",
      "type": "video",
      "data": {
        "action": "ongoing",
        "entities": {
          "by": {
            "entity": {
              "uid": "superhero3",
              "name": "Spiderman",
              "role": "default",
              "avatar": "https://data-eu.cometchat.io/assets/images/avatars/spiderman.png",
              "status": "offline"
            },
            "entityType": "user"
          },
          "on": {
            "entity": {
              "data": {
                "entities": {
                  "sender": {
                    "entity": {
                      "uid": "superhero2",
                      "name": "Captain America",
                      "role": "default",
                      "avatar": "https://data-eu.cometchat.io/assets/images/avatars/captainamerica.png",
                      "status": "offline"
                    },
                    "entityType": "user"
                  },
                  "receiver": {
                    "entity": {
                      "uid": "superhero3",
                      "name": "Spiderman",
                      "role": "default",
                      "avatar": "https://data-eu.cometchat.io/assets/images/avatars/spiderman.png",
                      "status": "offline",
                      "conversationId": "superhero2_user_superhero3"
                    },
                    "entityType": "user"
                  }
                },
                "metadata": {
                  "key": {
                    "one": "two"
                  }
                }
              },
              "type": "video",
              "sender": "superhero2",
              "status": "ongoing",
              "joinedAt": 1646995512,
              "receiver": "superhero3",
              "sessionid": "16469950973f7f6a1ea6d5166db11c929cdbde6a61902e10ba",
              "startedAt": 1646995512,
              "wsChannel": {
                "secret": "083c2a7f660150e42c2bf07a17231e90980b290d",
                "service": "19757e59e8b9669.call",
                "identity": "[19757e59e8b9669]16469950973f7f6a1ea6d5166db11c929cdbde6a61902e10ba"
              },
              "initiatedAt": 1646995097,
              "receiverType": "user",
              "conversationId": "superhero2_user_superhero3"
            },
            "entityType": "call"
          },
          "for": {
            "entity": {
              "uid": "superhero2",
              "name": "Captain America",
              "role": "default",
              "avatar": "https://data-eu.cometchat.io/assets/images/avatars/captainamerica.png",
              "status": "offline",
              "conversationId": "superhero2_user_superhero3"
            },
            "entityType": "user"
          }
        }
      },
      "sentAt": 1646995512,
      "updatedAt": 1646995512
    }
  ],
  "meta": {
    "pagination": {
      "total": 0,
      "count": 2,
      "per_page": 100,
      "current_page": 1,
      "total_pages": 1
    },
    "cursor": {
      "id": 1786,
      "affix": "prepend"
    }
  }
}

Authorizations

apikey
string
header
required

API Key with fullAccess scope(i.e. Rest API Key from the Dashboard).

Headers

onBehalfOf
string

UID of the user on whose behalf the action is performed.

Path Parameters

uid
string
required

An UID of a user.

Query Parameters

searchKey
string

searches for occurence of message.

hasAttachments
boolean

Fetches messages that include attachments.

attachmentTypes
enum<string>

Displays messages according to the type of attachment. Supported types include: image, video, audio, and file.

Available options:
image,
video,
audio,
file
hasMentions
boolean

Fetches messages that include mentions.

Fetches messages that include links.

mentionedUids
boolean

Fetches messages that include the mentioned comma-separated UIDs.

unread
boolean

displays all the unread messages of the user.

undelivered
boolean

displays all the messages those are undelivered.

count
boolean

displays the count of messages as per group/user

hideReplies
boolean

Shows only messages skipping the replies in the message thread.

affix
enum<string>

Determines whether to pull the messages either before or after any message id. Possible values are append(after) and prepend(before).

Available options:
append,
prepend
id
string

Retrieves all those messages after the passed id.

category
string

Fetches messages that belongs to specific category.

categories
any[]

Fetches messages that contains multiple categories.

type
string

Fetches messages that belongs to a specific type.

types
any[]

Fetches messages with multiple types.

myMentionsOnly
boolean
default:false

Filters messages with mentions for the UID in onBehalfOf header.

hasReactions
boolean
default:false

Filters messages sent by a the uid given in sender query param and has reactions. If onBehalfOf header is also set then the messages from their common conversations will be filtered.

sender
string

Filters messages with sender. If onBehalfOf header is also set then the messages from their common conversations will be filtered.

mentionsWithBlockedInfo
boolean
default:false

For the mentioned users, provides blocked information with respect to the UID in onBehalfOf header.

mentionswithTagInfo
boolean
default:false

Provides user tags for the mentioned users.

perPage
integer
default:100

The number of records to fetch. Minimum value: 1, Maximum value: 1000

limit
integer
default:10

The number of records to fetch. Minimum value: 1, Maximum value: 1000 (works alongside onBehalfOf header)

fromTimestamp
integer

Fetches the messages from this timestamp.

toTimestamp
integer

Fetches the messages till this timestamp.

withTags
boolean

This will fetch messages along with the tags.

tags
string[]

This will fetch only those messages belonging to the mentioned tags.

Response

200 - application/json

Get User Messages

The response is of type object.