Skip to content

Message

This API allow to send message as bot into the group by roomId

Request URL : baseURL/bot/{chatmeBotToken}/send-message

Http method : POST

Auth required : YES

Data constraints

{
"message": "[message field] (required depend on type) default max lenght is 500 but for media/file max is 100",
"type": "[message's type which is one of enum('text', 'media','file','activity', 'sticker', 'link', 'contact', 'group', 'voice', 'vows', 'vcall')] (required)",
"room": "[roomId of the room to forward the message to] (required)",
"attachments": "[ array objectId of attachment (required when type == media , file)]",
"localize": "[boolean when the text need translation (optional)]",
"args": "[argument to translate if localize field is true]",
"refType": "[type of ref which is one of enum ('reply','forward')] (required when contain enum value)",
"ref": "[reference id of the message (required when refType exists)]",
"contact": "[userId of the contact you wanna share] (required when type == contact)",
"group": "[groupId you wanna share] (required when type == group)",
"sticker": "[stickerId you wanna send. only download stickers allow to send] (required when type == sticker)",
"mentions": "[array objectId of userId] (required when you mention someone. allow only in group)"
}
}

Data example

{
"message": "Hello from Bot",
"room": "646593c5478e49a804ecbb43",
"type": "text"
}

Content example

{
"data": {
"message": {
"_id": "64094cf53bd810afb0885f56",
"message": "Hello DR TECH",
"sender": {
"_id": "64094bc21e2c2b936f478ce2",
"avatar": null,
"fullName": "Dr Tech0"
},
"isPinned": false,
"attachments": [],
"localize": false,
"type": "text",
"status": "sent",
"refType": null,
"deleters": [],
"mentions": [],
"rejectCode": null,
"createdAt": "2023-03-09T03:05:25.190Z",
"updatedAt": "2023-03-09T03:05:25.190Z",
"__v": 0
},
"room": {
"_id": "63fdada732472b179217509d",
"type": "p",
"name": "ChatMe Official",
"isMuted": false,
"unreadCount": 0,
"lastOnlineAt": "2023-03-20T09:48:35.131Z",
"draft": {}
}
}
}
Error CodeMessageHttp Status Code
40000validation failed400
10001user not found404
10002message not found404
50000unknown error500
40027Message is invalid400
40023message does not belong to the room400
40022user not allow to send a message400

This API allows to retrieve messages from a specific room using the bot token.

Request URL : baseURL/bot/{chatmeBotToken}/get-message

Http method : GET

Auth required : YES

Query Parameters

ParameterTypeRequiredDescription
roomIdstringYesID of the room to get messages
pagenumberNoPage number for pagination
limitnumberNoNumber of messages per page (default: 100)
searchstringNoSearch text to filter messages
beforeDatedateNoGet messages before this date
afterDatedateNoGet messages after this date
filterTypestringNoFilter messages by type (‘media’, ‘file’, ‘link’, ‘pinnedMessage’, ‘voice’)
isUreadMessagebooleanNoGet unread message

Example Request URL

baseURL/bot/{chatmeBotToken}/get-message?roomId=685bf2b7b7cc4fca65684b78

Content example

{
"data": [
{
"message": "Helo",
"sender": {
"_id": "644788d114ce799315bfc502",
"fullName": "Hamm",
"avatar": "https://wrs.chat-me.chat/chat-me/1684825547645-image_picker_4158F144-59E8-4BDA-8085-AEA1037D7CDF-3239-000000A8C119646D.jpg",
"isBot": false
},
"type": "text",
"status": "sent",
"refType": null,
"createdAt": "2025-06-27T04:11:05.128Z",
"isMentioned": false,
"_id": "685e19d926c11e71411541cf",
"mentions": [],
"attachments": [],
"ref": null
}
],
"pagination": {
"totalDocs": 16,
"totalPages": 1,
"hasPrevPage": false,
"prevPage": null,
"hasNextPage": false,
"nextPage": null,
"page": 1,
"limit": 100
}
}

Empty Data Response

{
"data": [],
"pagination": {
"totalPages": 1,
"hasPrevPage": false,
"prevPage": null,
"hasNextPage": false,
"nextPage": null,
"page": 1,
"limit": 10
}
}
Error CodeMessageHttp Status Code
40000validation failed400
10001user not found404
10002message not found404
50000unknown error500
40027Message is invalid400
40023message does not belong to the room400
40022user not allow to get messages400

This API allows bots to pin or unpin messages in a specific room.

Request URL : baseURL/bot/{chatmeBotToken}/pin-message

Http method : POST

Auth required : YES

Data constraints

{
"messageIds": "[array of message IDs to pin/unpin] (required)",
"roomId": "[ID of the room where the messages are located] (required)",
"pin": "[boolean - true to pin, false to unpin] (required)"
}

Data example

{
"messageIds": ["6860d992a417f59e999373c4"],
"roomId": "685e19b026c11e7141154123",
"pin": true
}

Content example

{
"data": {
"message": [
"6860d992a417f59e999373c4"
],
"user": {
"_id": "685e166d91184b1fe17a4494",
"fullName": "dev2bot",
"avatar": null
},
"roomId": "685e19b026c11e7141154123",
"type": "pin"
}
}
Error CodeMessageHttp Status Code
10025message is pinned or unpinned400

This API allows bots to delete messages in a specific room.

Request URL : baseURL/bot/{chatmeBotToken}/delete-message

Http method : DELETE

Auth required : YES

Query Parameters

ParameterTypeRequiredDescription
roomIdstringYesID of the room where the message is located
messageIdstringYesID of the message to delete

Example Request URL

baseURL/bot/{chatmeBotToken}/delete-message?roomId=685e19b026c11e7141154123&messageId=68626718afad44a3f1143c88

Content example

{
"data": {
"success": true
}
}
Error CodeMessageHttp Status Code
40000validation failed400
10002message not found404
40023message does not belong to the room400
40022user not allow to delete message400
50000unknown error500