Rich messages

sendRichMessageDraft()

Use this method to stream a partial rich message to a user while the message is being generated. Note that the streamed draft is ephemeral and acts as a temporary 30-second preview - once the output is finalized, you must call sendRichMessage with the complete message to persist it in the user's chat. Returns True on success.

parameters

parametertyperequireddescription
chat_idnumberrequiredUnique identifier for the target private chat
message_thread_idnumberoptionalUnique identifier for the target message thread
draft_idnumberrequiredUnique identifier of the message draft; must be non-zero. Changes to drafts with the same identifier are animated.
rich_messageInputRichMessagerequiredThe partial message to be streamed

returns

boolean

usage in yaebal

not (yet) hard-typed on Api — call it through the generic .call<T>() escape hatch documented in @yaebal/types.

bot.ts
import type { SendRichMessageDraftParams } from "@yaebal/types";

await bot.api.call<boolean>("sendRichMessageDraft", {
  chat_id: 123456789,
  draft_id: 1,
  rich_message: {} /* InputRichMessage */,
} satisfies SendRichMessageDraftParams);

context shortcut

also available as ctx.sendRichMessageDraft() on 16 context types — see @yaebal/contexts.

context shortcut
/** Use this method to stream a partial rich message to a user while the message is being generated. Note that the streamed draft is ephemeral and acts as a temporary 30-second preview - once the output is finalized, you **must** call [sendRichMessage](https://core.telegram.org/bots/api/#sendrichmessage) with the complete message to persist it in the user's chat. Returns *True* on success. */
ctx.sendRichMessageDraft(params: Omit<SendRichMessageDraftParams, "chat_id">)