send_streaming_text()

Client.send_streaming_text()

Send a sequence of live thinking/streaming text.

Usable by Users Bots

Telegram clients display the native “Thinking…” status while these updates are streamed, just like the official AI bot experience.

This method uses the low-level SetTyping method with SendMessageTextDraftAction to send thinking / streaming text generation updates to the recipient.

Parameters:
  • chat_id (int | str) – Unique identifier (int) or username (str) of the target chat.

  • streaming_text (str | Sequence of str) – Text or text chunks to send as streaming “thinking” updates. When a single string is passed, it is sent as one update.

  • delay (float, optional) – Delay (in seconds) between successive streaming updates. Defaults to 2.0.

  • parse_mode (ParseMode, optional) – Mode for parsing entities if they are used inside the streaming text (rare).

  • entities (List of MessageEntity, optional) – Special entities that appear in the streaming text entries.

  • reply_to_message_id (int, optional) – ID of the original message to reply to.

  • message_thread_id (int, optional) – Forum topic ID. Required for threaded replies in forum chats.

Returns:

bool – The result of the last streamed typing update.

Example

# Send a thinking stream
await app.send_streaming_text(
    message.chat.id,
    streaming_text=[
        "Hello! Let me think…",
        "OK, I see what you need…",
        "Working out the details…",
        "Here comes the final advice…"
    ],
    message_thread_id=message.message_thread_id,
    delay=2.0
)

# Single chunk variant
await app.send_streaming_text(
    message.chat.id,
    streaming_text="Hello! Let me think…",
    message_thread_id=message.message_thread_id
)