Get Messages
File: src/Methods/Messages/GetMessages.ts
Schema: channels.GetMessages & messages.GetMessages
Get one or more messages from a chat by using message identifiers.
Usage
client.api.getMessages(chatId, messageIds, replyToMessageIds, replies);
name | required | type | description |
---|---|---|---|
chatId | true | bigint or string | Unique identifier or username of the target chat. |
messageIds | true | array of number | Message identifier to get the content of the message. You can pass with undefined if you want to use replyToMessageIds parameter. |
replyToMessageIds | true | array of number | Message identifier to get the content of the previous message which is replied by current messages. You can pass with undefined if you want to use messageIds parameter. |
replies | true | number | The number of subsequent replies to get for each message. Pass 0 for no reply at all or -1 for unlimited replies. Defaults to 1. |
You cannot use the messageIds
parameter at the same time as replyToMessageIds
, if the
messageIds
parameter is available then we will prioritize using the messageIds
parameter over
replyToMessageIds
.
Possible Error
Code | Message | Description |
---|---|---|
400 | CHANNEL_INVALID | The provided channel is invalid. |
400 | CHANNEL_PRIVATE | You haven't joined this channel/supergroup. |
400 | MESSAGE_IDS_EMPTY | No message ids were provided. |
400 | MSG_ID_INVALID | Invalid message ID provided. |
400 | USER_BANNED_IN_CHANNEL | You're banned from sending messages in supergroups/channels. |
406 | CHANNEL_PRIVATE | You haven't joined this channel/supergroup. |