Telegram User Bot icon

Telegram User Bot

Send messages and manage contacts via Telegram User Bot (MTProto)

Get Messages

AI-generated

Summary

Retrieve recent messages from a specified Telegram chat, optionally filtering to only unread messages, up to a configurable limit.

Inputs

  • Chat ID (required) — The Telegram chat ID to fetch messages from.
  • Limit — Maximum number of messages to return (default is 20).
  • Only Unread — Whether to only return unread messages from the chat (default is true).

Output shape

An array with a single item containing a JSON object with the chat ID, unread message count, and an array of messages with details (messageId, text, date, sender info, media presence/type, reply to message ID).

The 'messages' array length depends on the limit and the unread filter. Each message includes sender details when available. If 'Only Unread' is true, messages returned will be limited up to the number of unread messages in the chat.

Examples

Example 1: Fetch the latest 20 unread messages from chat ID '-1001234567890'.

Set Chat ID to '-1001234567890', Limit to 20, Only Unread to true (default).

Discussion