Message
Send Message as Bot
Section titled “Send Message as Bot”This API allow to send message as bot into the group by roomId
Request
Section titled “Request”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"}
Success Response
Section titled “Success Response”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 Codes
Section titled “Error Codes”Error Code | Message | Http Status Code |
---|---|---|
40000 | validation failed | 400 |
10001 | user not found | 404 |
10002 | message not found | 404 |
50000 | unknown error | 500 |
40027 | Message is invalid | 400 |
40023 | message does not belong to the room | 400 |
40022 | user not allow to send a message | 400 |
Get Messages as Bot
Section titled “Get Messages as Bot”This API allows to retrieve messages from a specific room using the bot token.
Request
Section titled “Request”Request URL : baseURL/bot/{chatmeBotToken}/get-message
Http method : GET
Auth required : YES
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
roomId | string | Yes | ID of the room to get messages |
page | number | No | Page number for pagination |
limit | number | No | Number of messages per page (default: 100) |
search | string | No | Search text to filter messages |
beforeDate | date | No | Get messages before this date |
afterDate | date | No | Get messages after this date |
filterType | string | No | Filter messages by type (‘media’, ‘file’, ‘link’, ‘pinnedMessage’, ‘voice’) |
isUreadMessage | boolean | No | Get unread message |
Example Request URL
baseURL/bot/{chatmeBotToken}/get-message?roomId=685bf2b7b7cc4fca65684b78
Success Response
Section titled “Success Response”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 Codes
Section titled “Error Codes”Error Code | Message | Http Status Code |
---|---|---|
40000 | validation failed | 400 |
10001 | user not found | 404 |
10002 | message not found | 404 |
50000 | unknown error | 500 |
40027 | Message is invalid | 400 |
40023 | message does not belong to the room | 400 |
40022 | user not allow to get messages | 400 |
Pin Unpin Message
Section titled “Pin Unpin Message”This API allows bots to pin or unpin messages in a specific room.
Request
Section titled “Request”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}
Success Response
Section titled “Success Response”Content example
{ "data": { "message": [ "6860d992a417f59e999373c4" ], "user": { "_id": "685e166d91184b1fe17a4494", "fullName": "dev2bot", "avatar": null }, "roomId": "685e19b026c11e7141154123", "type": "pin" }}
Error Codes
Section titled “Error Codes”Error Code | Message | Http Status Code |
---|---|---|
10025 | message is pinned or unpinned | 400 |
Delete Message
Section titled “Delete Message”This API allows bots to delete messages in a specific room.
Request
Section titled “Request”Request URL : baseURL/bot/{chatmeBotToken}/delete-message
Http method : DELETE
Auth required : YES
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
roomId | string | Yes | ID of the room where the message is located |
messageId | string | Yes | ID of the message to delete |
Example Request URL
baseURL/bot/{chatmeBotToken}/delete-message?roomId=685e19b026c11e7141154123&messageId=68626718afad44a3f1143c88
Success Response
Section titled “Success Response”Content example
{ "data": { "success": true }}
Error Codes
Section titled “Error Codes”Error Code | Message | Http Status Code |
---|---|---|
40000 | validation failed | 400 |
10002 | message not found | 404 |
40023 | message does not belong to the room | 400 |
40022 | user not allow to delete message | 400 |
50000 | unknown error | 500 |