A Message is a structured data unit within a chat system that encapsulates content sent from a sender to one or more recipients. The
Message
object allows the API to process and respond to communications, log historical data, and integrate with other systems.This object represents the content of a Message.
Field | Type | Required | Description |
message_id | String | Yes | Unique identifier for this message. |
reference | Long | Yes | Unique local identifier. |
app_id | String | No | App Id to which the message belongs. |
chat | Yes | Conversation the message belongs to. | |
from | Yes | Sender (user) of this message. | |
sent_to | Yes | Receiver (user): usually the bot ID, but for channels with multiple admins, it's the specific admin who should receive the message. | |
type | String | Yes | Message type:
text— text message
text_file— text exceeding 1800 characters converted to a file
photo— photo message
gif— GIF message
sticker— sticker message
video— video message
audio— audio message
voice— voice note message
location— location message
contact— contact message
document— document message |
date | Long | Yes | Unix Epoch timestamp in milliseconds of the sent message. |
reply_to_message_id | String | Optional | Unique identifier for the parent message if this is a reply. |
from_admin | Integer | Optional | 1 if the sender is an admin, otherwise 0 . |
text | String | Conditional | Available when the type is text. |
text_file | Conditional | Available when the type is text_file. | |
photo | Conditional | Available when the type is photo. | |
gif | Conditional | Available when the type is gif. | |
sticker | Sticker | Conditional | Available when the type is sticker. |
video | Conditional | Available when the type is video. | |
audio | Conditional | Available when the type is audio. | |
voice | Conditional | Available when the type is voice. | |
document | Conditional | Available when the type is document. | |
location | Conditional | Available when the type is location. | |
contact | Conditional | Available when the type is contact. | |
article | Article | Conditional | Available when the type is article (must be a nandbox article). |
url | String | Conditional | Available when the type is article (article’s URL). |
status | String | Optional | deleted if the message is recalled, updated if modified. |
caption | String | Optional | Media caption (0-256 characters), available for all types except text or text_file. |
bg_color | String | Optional | Hex color code for the message background, available only for text. |
tag | Optional | Delivers the message to specific user tags within the chat. | |
schedule_date | Long | Optional | Schedules the message for a specific time (Unix Epoch timestamp in milliseconds, e.g., 1579102262). |
menu_ref | String | Optional | Menu reference ( menu_id ) for an existing predefined menu, displayed as an inline menu with the message. |
inline_menu | Array of Menu | Optional | Inline menu object to hold menus. If both inline_menu and menu_ref are defined, inline_menu takes priority. |
white_list_user | Optional | White list user object. | |
chat_settings | Integer | Optional | 1 if this is an administrative message allowing admins to chat privately with the bot. |
Text_File
This object represents a text file.
Field | Type | Required | Description |
Id | String | Yes | Unique identifier for this file. |
size | Integer | Yes | File size. |
Objects
json{ "message": { "date": 1512445910180, "gif": { "thumbnail": { "width": 256, "id": "cfdb3cc5.gif.thumb.jpg", "height": 191 }, "size": 4136640, "width": 443, "id": "cfdb3cc5.gif.thumb.jpg", "height": 332 }, "chat": { "name": "chat 1", "id": "4522291356145774", "type": 0 }, "message_id": "d2_QhlW1MAH12617138", "from": { "name": "john smith", "id": "4521191845180798", "type": 0, "version": "('0hn0','1YDA','2ViB','32Fg')" }, "type": "gif" } }