Skip to main content
GET
/
api
/
v5
/
messages
Find message by message feed id and multiple conditions
curl --request GET \
  --url https://apix.us.amity.co/api/v5/messages \
  --header 'Authorization: Bearer <token>'
{
  "messages": [
    {
      "messageId": "a85dca058f5b585f86a29f14",
      "networkId": "9530b11ec8de87db22b06b27",
      "channelId": "abc665aed9dbb8d036037eed",
      "channelType": "community",
      "messageFeedId": "507f191e810c19729de860ea",
      "segment": 123,
      "dataType": "text",
      "data": {
        "text": "test"
      },
      "fileId": "76bfe68974157a114053364d",
      "thumbnailFileId": "76bfe68974157a114053364e",
      "metadata": {
        "refId": "d601c27c0675baa2103ec573"
      },
      "tags": [
        "tag1",
        "tag2"
      ],
      "creatorId": "5349b4ddd2781d08c09890f4",
      "mentionedUsers": [
        {
          "type": "user",
          "userIds": [
            "3cac302ab992aa17b215ba21",
            "adb34ec2aeedca03a38e1d54"
          ]
        }
      ],
      "reactions": {
        "like": 1,
        "love": 2
      },
      "reactionCount": 123,
      "parentId": "abc665afd7dbb8d036037eea",
      "path": "12cba9779cc479e1fcefd1de/chat/f00ab16cbd27d4a9525aea6d/32b468ae0b1bd0cc7976719d/0a003482f0ac53a71e7c9239",
      "flagCount": 123,
      "childCount": 123,
      "isDeleted": false,
      "editedAt": "2023-11-07T05:31:56Z",
      "createdAt": "2023-11-07T05:31:56Z",
      "updatedAt": "2023-11-07T05:31:56Z",
      "myReactions": [
        "like",
        "love"
      ]
    }
  ],
  "messageFeeds": [
    {
      "messageFeedId": "a85dca058f5b585f86a29f14",
      "channelId": "abc665aed9dbb8d036037eeb",
      "channelPublicId": "abc665aed9dbb8d036037eeb",
      "channelType": "community",
      "name": "text",
      "creatorId": "8aa313c8dbb00af911b07672",
      "path": "12cba9779cc479e1fcefd1de/chat/f00ab16cbd27d4a9525aea6d/32b468ae0b1bd0cc7976719d/0a003482f0ac53a71e7c9239",
      "childCount": 123,
      "isDeleted": false,
      "createdAt": "2023-11-07T05:31:56Z",
      "updatedAt": "2023-11-07T05:31:56Z",
      "lastMessageId": "9530b11ec8de87db22b06b21",
      "lastMessageTimestamp": "2023-11-07T05:31:56Z",
      "editedAt": "2023-11-07T05:31:56Z",
      "messagePreviewId": "<string>"
    }
  ],
  "files": [
    {
      "fileId": "<string>",
      "fileUrl": "<string>",
      "type": "image",
      "accessType": "public",
      "altText": "<string>",
      "createdAt": "2023-11-07T05:31:56Z",
      "updatedAt": "2023-11-07T05:31:56Z",
      "attributes": {
        "name": "<string>",
        "extension": "<string>",
        "size": 123,
        "mimeType": "<string>",
        "metadata": {
          "exif": {},
          "gps": {},
          "height": 123,
          "width": 123,
          "isFull": true
        }
      }
    }
  ],
  "users": [
    {
      "userId": "<string>",
      "createdAt": "2023-11-07T05:31:56Z",
      "updatedAt": "2023-11-07T05:31:56Z",
      "_id": "<string>",
      "path": "<string>",
      "roles": [
        "<string>"
      ],
      "displayName": "<string>",
      "flagCount": 123,
      "hashFlag": {
        "bits": 123,
        "hashes": 123,
        "hash": [
          "<string>"
        ]
      },
      "metadata": {},
      "isDeleted": true
    }
  ],
  "roles": [
    {
      "roleId": "<string>",
      "updatedAt": "2023-11-07T05:31:56Z",
      "permissions": [
        "<string>"
      ],
      "isDeleted": false,
      "displayName": "<string>",
      "createdAt": "2023-11-07T05:31:56Z"
    }
  ],
  "paging": {
    "next": "<string>",
    "previous": "<string>",
    "total": 123
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

messageFeedId
string
required

Message feed ID The ID of the message feed

Maximum string length: 30
Example:

"a85dca058f5b585f86a29f14"

parentId
string

parent ID of a message (max length=50) Parent id of message

Maximum string length: 30
Example:

"abc665afd7dbb8d036037eea"

isDeleted
boolean
default:false

deleted flag of message that needs to be find Soft delete flag

includeTags
string[]

Used for querying messages by matching all specified tags. When a query includes multiple tags (e.g., tags=['tag1', 'tag2', 'tag3']), the system will return all messages that have all the specified tags. (max=10) List of tags for searching

Maximum array length: 10
Maximum string length: 30
Example:
["tag1", "tag2"]
excludeTags
string[]

Used for querying messages by excluding all specified tags. When a query includes multiple tags (e.g., excludeTags=['tag1', 'tag2', 'tag3']), the system will return all messages that do not have any of the specified tags. (max=10) List of tags for searching

Maximum array length: 10
Maximum string length: 30
Example:
["tag1", "tag2"]
hasFlags
boolean

flag to filter only flagged message A flag to filter only flagged message

dataType
string

data type of message (max length=20) Type of data

Maximum string length: 20
Example:

"text"

options
object

Pagination options

after: string(30) : return documents after this message id

before: string(30) : return documents before this message id

limit: number(0, 100) default=10 if use limit along with options.around, limit must be even number

sortBy: segmentAsc | segmentDesc

token: string(100) : This token will be generated by server using encryption of after, before, limit, sortBy. It would be returned in response payload (paging.next, paging.previous). The caller can send only token for getting data from previous or next page easily.

around: target message id

Page options by using cursor

Response

Paginated message payload

The returned payload of message(s)

messages
object[]

The list of message

messageFeeds
object[]

List of message feeds

files
object[]

The list of file

users
object[]

The list of user

roles
object[]
paging
object

Paging response