All of these target ctx.from and return Promise<SentMessage>. ctx.reply is
the text reply (say, answer and text are deprecated aliases of it):
await ctx.reply('👋 Hello!')await ctx.quote('replying to your message') // quotes the inbound messageawait ctx.reply('typing this out...', { typing: true }) // shows "typing…" before sending
Every send (these helpers, bot.send, broadcasts, ctx.edit) is checked after the
before('send') hooks and before the transport: content that no transport can
deliver (a text that is not a string, such as ctx.reply(undefined); media
without a source; coordinates outside ±90/±180; a poll or button message with no
options) rejects with a TypeError that names the field, and nothing is sent.
Transport limits (number of buttons, media size) are still checked by each provider; a
text longer than the channel allows is split for you (see Long text).
Every MediaSource form is accepted, including { native } (a provider-specific
reference such as a Telegram file_id).A ctx reply that hits a RateLimitedError asking for a wait of up to 5 s is
retried once in place, so a flow step does not end on a transient rate limit
(tune it with BotConfig.rateLimitRetry: { retries, maxWaitMs }, or turn it off
with false). Longer waits and other errors reject as before; bot.send() is
not retried (broadcasts have their own back-off).
Every channel caps the length of one text message (capabilities.maxTextLength in UTF-16
code units, and capabilities.maxTextBytes in UTF-8 bytes on Instagram). A text send
longer than that — a ctx reply, a flow .say, bot.send or a broadcast — goes out as
several messages, in order, cut at the most natural boundary that fits: paragraph, line,
sentence, then word. A cut never splits an emoji (surrogate pairs, ZWJ sequences, flags,
skin tones) or the chat’s markup: links and URLs stay whole, and a code block, inline
code, a *bold* run or an HTML element longer than the limit is closed at the end of
one part and reopened at the start of the next.
const sent = await ctx.reply(longAnswer) // 9000 chars on Telegram → 3 messagessent.id // the last partsent.parts // the ref of every part, in order (only set when the text was split)
before('send') hooks run once, on the whole text, before it is split: a hook that
adds a footer or translates the text changes the whole message, and what it returns is
what gets split, so every part still fits (a hook that makes a short text too long gets
it split too). An abort() skips the whole text. Each part is then a send of its own:
after('send') hooks, the message log and the durable outbox see every part. Only the
first part keeps quoted; an explicit idempotencyKey gets a #2, #3… suffix from
the second part on (from #1 when a hook made the text too long). If a part fails, the
send rejects and the remaining parts are not sent; with durability, a part the outbox
defers (SendDeferredError) is followed by the remaining parts in the outbox, so the
sweeper delivers all of them, in order. bot.enqueue() splits too: it journals one
record per part (key, key#2, …). Text that fits is sent untouched.
ctx.edit is never split, and ctx.stream() splits on its own. Turn it off with
new Bot({ splitLongText: false }) (the provider then rejects a long text with
PayloadTooLargeError). To split text yourself, use splitMessage(text, { maxLength, maxBytes, format }) from @botmesh/core.
ctx.buttons(text, buttons) sends normalized button content. How it lands
depends on the provider:
@botmesh/baileys — native interactive buttons are dead in the
current WhatsApp Web protocol, so buttons degrade to a numbered text
menu. A numbered menu (.choose() in a flow, or c.choose() in a
conversation — see Flows) or a real poll usually reads better.
await ctx.buttons('Choose one', [ { id: 'a', title: 'Option A' }, { id: 'b', title: 'Option B' },])// Polls are native on Baileys and Telegram. The Cloud API has no polls:// there, ctx.poll() rejects with UnsupportedContentError — use buttons.await ctx.poll('What do you prefer?', ['Option A', 'Option B'])// Multi selectawait ctx.poll('What do you like?', ['🍕 Pizza', '🍔 Burger'], true)
If a provider cannot honor a content kind at all, send rejects with a
typed UnsupportedContentError from @botmesh/core.
BotConfig.typing shows “typing…” before every text reply sent through ctx
(reply and its deprecated aliases, quote and flow .say). The indicator lasts
text length / charsPerSecond, clamped to [minMs, maxMs]. It is off by default.
typing: true uses the bot’s timing, typing: false suppresses it, and an
object enables it with those overrides. A per-reply maxMs below the bot’s
minMs lowers the minimum instead of throwing.
delay (ms or '500ms', '1.5s') runs before the indicator. cancelIf: () => boolean
is checked after the wait: when it returns true the reply is dropped.
A failing indicator never fails the send; it is cosmetic and best effort.
On providers without capabilities.typing there is no indicator and no wait. delay is honored everywhere.
A paced reply is dropped (it resolves { skipped: true }) if the bot stops, the chat is handed off or the flow is aborted during the wait. stop({ drain: true }) waits for paced replies.
ctx.replyWithTyping(text, msPerChar?) is deprecated: it paces itself (40 ms per
character by default) and ignores BotConfig.typing. Use ctx.reply(text, { typing: true }).
Long or AI-generated answers can be streamed instead of sent in one go: see
Streaming.
const msg = await ctx.reply('Processing…')await ctx.edit('Done ✅') // edits this context's own last replyawait ctx.edit(msg.ref, 'Done ✅') // edits a given messageawait ctx.edit('Done ✅', { fallback: 'skip' }) // never sends a new message
ctx.edit(content) only targets the last reply sent by this same context
(this handler run, or this flow) and only when it has the same content kind.
It never edits replies to an earlier message, replies of another participant’s
flow in a group, or a reply followed by a bot.send to the chat.
The result has edited: true when the provider edited in place.When the provider cannot edit (no capabilities.edit, a content kind it cannot
edit, or nothing to edit), ctx.edit sends the content as a new message in
the chat of the edited message (ref.chatId), or sends nothing with
{ fallback: 'skip' }. Edits run the before/after('send') hooks (the payload
carries edit: ref, see Hooks) and update the outbound ledger.
await ctx.react('👍')await ctx.react('❤️')await ctx.react('🔥', msg.ref) // react to another messageawait ctx.react('') // remove the reaction, where the transport allows it
On providers that cannot send reactions, ctx.react resolves { skipped: true }
instead of rejecting.
await ctx.markRead() // mark the inbound message as readawait ctx.typing() // show "typing…"await ctx.recording() // show "recording audio…"await ctx.delete() // delete the inbound message (if allowed)
Actions degrade to a no-op on providers that lack the capability.
ctx.typing() and ctx.recording() are best-effort: they never reject. If the
provider fails to show the indicator, the error is logged at debug and your
handler continues, so a failing indicator never costs the reply after it.
bot.onType(...) handlers are low-specificity matchers (the old
onImage/onAudio/… helpers are deprecated aliases): a more specific
bot.when(...) that also matches wins first, unless it calls ctx.pass().
The same matchers are available as trigger constants (IMAGE, VOICE_NOTE,
LOCATION, CALL…; multi-type ones such as MEDIA rank just below): see
Special triggers.
A shared location arrives as ctx.type === 'location' with its coordinates
normalized on ctx.sharedLocation (it is not ctx.location, which sends
one):
bot.onType('location', async (ctx) => { const loc = ctx.sharedLocation if (!loc) return ctx.reply('I could not read that location') await ctx.reply(`📍 ${loc.latitude}, ${loc.longitude}${loc.name ? ` (${loc.name})` : ''}`)})
sharedLocation is { latitude, longitude, name?, address?, live? } (WGS84
decimal degrees; live: true on the first message of a live-location share).
ctx.body keeps the place name or address (or ''), so text triggers still
work. Providers that fill it: WhatsApp via Baileys (pins and live locations),
WhatsApp Cloud API, Telegram (pins, live locations and venues), Messenger and
Instagram (when Meta sends coordinates), Evolution API and WPPConnect (pins and
live locations), Gupshup and Twilio (Latitude/Longitude). Discord and
HighLevel have no inbound locations. On other channels, or when the transport sends
no coordinates, ctx.type is still 'location' but sharedLocation is
undefined. Provider authors map their payload with
toInboundLocation({ latitude, longitude, name, address, live }) from
@botmesh/core/spi, which drops missing or out-of-range coordinates.Inside a conversation, c.waitLocation(opts?) waits for one and resolves with
the InboundLocation; anything else re-prompts with otherwise (default: the
localized core.wait.location). The stored inbound message keeps it too
(StoredMessage.location).
bot.conversation('delivery', async (c) => { await c.say('Share the delivery location 📍') const loc = await c.waitLocation({ timeout: '5m' }) await c.say(`We deliver to ${loc.latitude}, ${loc.longitude}`)})
ctx.poll(question, options, multiSelect?) sends a native poll. Votes
arrive on the poll event with the full, current tally:
await ctx.poll('Pizza or sushi?', ['Pizza', 'Sushi'])bot.on('poll', (vote) => { // vote.ref.id → the poll's message id // vote.ref.chatId → the chat where it was voted (same chatId its messages use) // vote.senderId → who just voted, with the canonical id of their messages // vote.options → current tally: [{ name, votes, voters }] const picked = vote.options.filter((o) => o.voters?.includes(vote.senderId)).map((o) => o.name) console.log(picked.length ? `Picked: ${picked.join(', ')}` : 'Vote withdrawn')})
On Baileys, WhatsApp encrypts every vote end to end; the provider
decrypts it itself. It remembers the 500 most recent polls it saw (the
bot’s own and the ones others create in chats it listens to), only accepts
a vote that arrives in the poll’s own chat and names its creator, keeps
each person’s latest vote, and counts each vote message once (Baileys’
offline redelivery is not re-emitted). Limits: only polls seen by this
process can be decrypted (after a restart, votes on older polls are
dropped with a debug log), and the bot cannot vote. A poll someone else
creates still arrives as a poll message (bot.onType('poll'), the
POLL trigger); the encrypted vote no
longer does. Details in the @botmesh/baileys README.On Telegram, polls are sent non-anonymous, so each vote arrives as a
poll_answer update and the provider tallies it into the same poll event
(empty selection = vote withdrawn). Telegram only reports votes on polls the
bot sent, and the provider remembers the 500 most recent ones it sent from this
process. Members of the chat can see who voted; anonymousPolls: true sends
anonymous polls, whose votes never reach the bot. A channel refuses public-voter
polls: the poll is retried once as anonymous and the channel is remembered.
Inbound media is downloaded lazily: the context only carries a reference
until you ask for the bytes with loadMediaOf(ctx). It downloads once through
the provider and caches the result on ctx.media:
import { loadMediaOf, MediaTooLargeError } from '@botmesh/core'bot.onType('image', async (ctx) => { try { const media = await loadMediaOf(ctx, { maxBytes: 5 * 1024 * 1024 }) if (!media) return // no media, or the download failed console.log(media.mimetype) // 'image/jpeg' console.log(media.buffer) // Buffer console.log(media.size) // bytes, when the provider declared it // ctx.media is now the same payload } catch (err) { if (err instanceof MediaTooLargeError) await ctx.reply('That file is too large') else throw err }})
It resolves undefined when the message has no media, the provider cannot
download, or (by default) the download fails. { throwOnError: true }
rejects with the download error instead.
maxBytes is checked against the size the provider declared, before
downloading anything, and again while reading; the download is cut as soon as
it goes over. It rejects with MediaTooLargeError (a PayloadTooLargeError,
with bytes and maxBytes).
Call it in a before('message') hook to download before routing; the
voice plugin transcribes voice notes this way.
Besides the reply helpers, every handler receives data fields on ctx:
ctx.body, ctx.from (chat id), ctx.sender (user id; = from in DMs,
participant in groups), ctx.senderInfo, ctx.pushName, ctx.chat
({ id, kind, name?, isGroup, isBroadcast, participants? }), ctx.type,
ctx.isGroup / ctx.isPrivate / ctx.isFromMe, ctx.mentions,
ctx.quoted?, ctx.media? (after loadMediaOf), ctx.timestamp (when the message was
sent, in epoch milliseconds on every channel: new Date(ctx.timestamp)), ctx.tools (DI registry),
ctx.raw (provider-native payload), ctx.ref (the message reference —
{ id, chatId, native? }, replaces v1’s ctx.key), ctx.user (the
sender’s persistent profile), ctx.handoff() (pass the chat
to a human), ctx.call (the CallEvent, on
CALL contexts only) and the i18n members
ctx.lang, ctx.langSource, ctx.t() and ctx.setLang().
Every provider resolves aliases before emitting, so ctx.sender is the
same for the same person (the identity contract):
Baileys: LID and PN (phone) forms of a user are merged into one
canonical id (the PN when known). Messages, reactions, poll votes, calls,
group and presence events, ctx.mentions and the bot’s own selfId all
use it, so groupMode: 'mentions' works whether the mention used the LID
or the PN.
Cloud API (@botmesh/meta): users who turned on a WhatsApp
username may arrive without a phone number, only with a
business-scoped user id (BSUID, e.g. US.13491208655302741918). The
provider keeps one stable id per person (the phone when known, otherwise
the BSUID), learns phone ↔ BSUID pairs (persist them with an
identityMap), and sends to a BSUID through the recipient field
automatically. senderInfo.username and
senderInfo.platformData.bsuid expose the details. Authentication
templates require a phone: sending one to a BSUID fails with Graph error
131062, mapped to UnsupportedContentError. See the @botmesh/meta
README.
To message someone without waiting for them to write first — e.g. from a
scheduled task — use the bot instance directly. Content is
the transport-neutral tagged union ({ kind, ... }):
await bot.send('[email protected]', '🌅 Good morning!')await bot.send('[email protected]', { kind: 'image', media: { url }, caption: 'hi',})await bot.send(chatId, 'Hi, I am Ana from support') // same path; a string is sent as text
bot.broadcast(chatIds, content, options?) sends one content (a string is sent as
text) to many chats, in batches, without blocking the per-chat inbound queues:
const ac = new AbortController()const res = await bot.broadcast(chatIds, '🎉 New promo!', { batchSize: 10, // chats per batch (default 10) delayBetween: '2s', // pause between batches (ms or '2s', '1m'; default 0) concurrency: 1, // parallel sends per batch (default 1) retries: 3, // retries per chat after a RateLimitedError (default 3) onProgress: (done, total) => bot.logger.info(`${done}/${total}`), onFail: (chatId, error) => bot.logger.warn({ chatId, err: error }, 'broadcast failed'), signal: ac.signal, // abort to stop early})// → { total, sent, failed, skipped, errors: [{ chatId, error }], messages, cancelled, pending }
A RateLimitedError pauses every worker for its retryAfterMs and retries that chat.
Other errors are recorded in errors and the broadcast goes on; it never rejects for a per-chat failure.
Aborting signal or calling bot.stop() starts no new send; chats never attempted come back in pending (cancelled: true).
Duplicate ids are sent once; sends skipped by a before('send') hook count as skipped.
Breaking changesent and failed are now counts. The accepted sends moved to messages and the failures to errors.
From inside a handler, launch it with void bot.broadcast(...) so that chat’s queue is not held while it runs.
bot.trigger(name, { chatId, userId?, isGroup?, data?, ifActive?, body? }) starts a
registered flow or bot.conversation for someone who has not written: reminders,
webhooks, admin panels. data seeds c.state:
It goes through the access lists, the human handoff gate and the chat’s FIFO queue.
It resolves { started, name, chatId, userId, reason? } as soon as the conversation is
entered, not when it ends (listen to 'conversation:ended' for that). reason is
'stopped' | 'blocked' | 'handoff' | 'busy'; an unknown name rejects.
A subject with a live or dormant conversation is left alone unless ifActive: 'replace'.
It is safe to await bot.trigger(...) from a handler or command of the same chat: it runs in that message’s queue slot.
userId (default: chatId) and isGroup target one participant of a group;
body sets the synthetic message’s ctx.body (default '').
No before('message') hooks, matchers or 'message' event run, and nothing is
persisted for the synthetic message (ctx.raw is { synthetic: 'trigger', name }).
bot.triggerFlow(id, { chatId, userId?, isGroup? }, { data?, body? }) is deprecated:
it is bot.trigger(id, { chatId, userId, isGroup, data, body, ifActive: 'replace' })
resolving result.started.
bot.metrics(), bot.resetMetrics(), the Prometheus exporter toPrometheus() and
the 'conversation:started' / 'conversation:ended' events are documented in
Operations.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"botmesh","description":"A transport-agnostic TypeScript framework for messaging bots: WhatsApp (Baileys or the Cloud API), Telegram, Discord and more behind one IProvider.","colors":{"primary":"#3451B2","light":"#A8B1FF","dark":"#3451B2"},"logo":{"light":"https://mintcdn.com/afaya/32LyKbpS8BIF3Yl-/logo/light.svg?fit=max\u0026auto=format\u0026n=32LyKbpS8BIF3Yl-\u0026q=85\u0026s=5a9c4db10ba52bbd645a009cc009e31e","dark":"https://mintcdn.com/afaya/32LyKbpS8BIF3Yl-/logo/dark.svg?fit=max\u0026auto=format\u0026n=32LyKbpS8BIF3Yl-\u0026q=85\u0026s=be155346190b752c815b6d06f1134702"},"favicon":"https://mintcdn.com/afaya/32LyKbpS8BIF3Yl-/favicon.svg?fit=max\u0026auto=format\u0026n=32LyKbpS8BIF3Yl-\u0026q=85\u0026s=abe4b13c733adb336381bebc0220d3e5","navbar":{"links":[{"href":"https://www.npmjs.com/package/@botmesh/core","label":"npm"}],"primary":{"type":"github","href":"https://github.com/andresayac/botmesh"}},"footer":{"socials":{"github":"https://github.com/andresayac/botmesh"},"links":[{"header":"Project","items":[{"label":"GitHub","href":"https://github.com/andresayac/botmesh"},{"label":"npm","href":"https://www.npmjs.com/package/@botmesh/core"},{"label":"MIT License","href":"https://github.com/andresayac/botmesh/blob/main/LICENSE"},{"label":"Changelog","href":"https://github.com/andresayac/botmesh/blob/main/CHANGELOG.md"}]}]},"search":{"prompt":"Search the botmesh docs…"},"seo":{"indexing":"navigable"},"icons":{"library":"lucide"},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"styling":{"latex":true},"navigation":{"languages":[{"language":"en","default":true,"href":""},{"language":"es","footer":{"socials":{"github":"https://github.com/andresayac/botmesh"},"links":[{"header":"Proyecto","items":[{"label":"GitHub","href":"https://github.com/andresayac/botmesh"},{"label":"npm","href":"https://www.npmjs.com/package/@botmesh/core"},{"label":"Licencia MIT","href":"https://github.com/andresayac/botmesh/blob/main/LICENSE"},{"label":"Changelog","href":"https://github.com/andresayac/botmesh/blob/main/CHANGELOG.md"}]}]},"href":"es"}]}},"deployment":{"deploymentMetadataValue":{"subdomain":"afaya","hasAudioNarration":false,"actualSubdomain":"afaya","customDomains":[],"gitSource":{"type":"github","owner":"andresayac","repo":"botmesh-docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":"","_id":"6ae0b3e80b849c49dba39507"},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6ae0b3fe0b849c49dba39747","clientVersion":"0.0.3971","searchFilterCounts":[{"language":"en","tag":"API reference","count":541},{"language":"en","tag":"@botmesh/core","count":373},{"language":"en","tag":"@botmesh/core/testing","count":93},{"language":"en","tag":"@botmesh/core/spi","count":75},{"language":"en","tag":"Guide","count":53},{"language":"es","tag":"Guía","count":53},{"language":"en","tag":"Golden transcripts","count":41},{"language":"en","tag":"Durability","count":35},{"language":"en","tag":"Flows","count":34},{"language":"en","tag":"Messages \u0026 context","count":32},{"language":"en","tag":"Forms","count":30},{"language":"es","tag":"Ejemplos","count":29},{"language":"es","tag":"Características","count":25},{"language":"es","tag":"Avanzado","count":19},{"language":"es","tag":"Intermedio","count":9},{"language":"es","tag":"Principiante","count":8},{"language":"es","tag":"Desarrollo y tests","count":8},{"language":"es","tag":"IA","count":6},{"language":"es","tag":"Primeros pasos","count":6},{"language":"es","tag":"Resumen","count":1}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"isAtlas":false,"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"guide/messages","slug":"/guide/messages","pageMetadata":{"title":"Messages \u0026 Media","sidebarTitle":"Messages \u0026 media","description":"Everything you can send and receive.","href":"/guide/messages"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Everything you can send and receive.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`2`,id:`reply-helpers-inside-a-handler`,children:`Reply helpers (inside a handler)`}),`\n`,_jsxs(_components.p,{children:[`All of these target `,_jsx(_components.code,{children:`ctx.from`}),` and return `,_jsx(_components.code,{children:`Promise\u003cSentMessage>`}),`. `,_jsx(_components.code,{children:`ctx.reply`}),` is\nthe text reply (`,_jsx(_components.code,{children:`say`}),`, `,_jsx(_components.code,{children:`answer`}),` and `,_jsx(_components.code,{children:`text`}),` are deprecated aliases of it):`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`reply`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'👋 Hello!'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`quote`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'replying to your message'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// quotes the inbound message`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`reply`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'typing this out...'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`typing:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// shows \"typing…\" before sending`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Every send (these helpers, `,_jsx(_components.code,{children:`bot.send`}),`, broadcasts, `,_jsx(_components.code,{children:`ctx.edit`}),`) is checked after the\n`,_jsx(_components.code,{children:`before('send')`}),` hooks and before the transport: content that no transport can\ndeliver (a `,_jsx(_components.code,{children:`text`}),` that is not a string, such as `,_jsx(_components.code,{children:`ctx.reply(undefined)`}),`; media\nwithout a source; coordinates outside ±90/±180; a poll or button message with no\noptions) rejects with a `,_jsx(_components.code,{children:`TypeError`}),` that names the field, and nothing is sent.\nTransport limits (number of buttons, media size) are still checked by each provider; a\ntext longer than the channel allows is split for you (see `,_jsx(_components.a,{href:`#long-text-is-split-automatically`,children:`Long text`}),`).\nEvery `,_jsx(_components.code,{children:`MediaSource`}),` form is accepted, including `,_jsx(_components.code,{children:`{ native }`}),` (a provider-specific\nreference such as a Telegram `,_jsx(_components.code,{children:`file_id`}),`).`]}),`\n`,_jsxs(_components.p,{children:[`A `,_jsx(_components.code,{children:`ctx`}),` reply that hits a `,_jsx(_components.code,{children:`RateLimitedError`}),` asking for a wait of up to 5 s is\nretried once in place, so a flow step does not end on a transient rate limit\n(tune it with `,_jsx(_components.code,{children:`BotConfig.rateLimitRetry: { retries, maxWaitMs }`}),`, or turn it off\nwith `,_jsx(_components.code,{children:`false`}),`). Longer waits and other errors reject as before; `,_jsx(_components.code,{children:`bot.send()`}),` is\nnot retried (broadcasts have their own back-off).`]}),`\n`,_jsx(Heading,{level:`3`,id:`long-text-is-split-automatically`,children:`Long text is split automatically`}),`\n`,_jsxs(_components.p,{children:[`Every channel caps the length of one text message (`,_jsx(_components.code,{children:`capabilities.maxTextLength`}),` in UTF-16\ncode units, and `,_jsx(_components.code,{children:`capabilities.maxTextBytes`}),` in UTF-8 bytes on Instagram). A `,_jsx(_components.code,{children:`text`}),` send\nlonger than that — a `,_jsx(_components.code,{children:`ctx`}),` reply, a flow `,_jsx(_components.code,{children:`.say`}),`, `,_jsx(_components.code,{children:`bot.send`}),` or a broadcast — goes out as\nseveral messages, in order, cut at the most natural boundary that fits: paragraph, line,\nsentence, then word. A cut never splits an emoji (surrogate pairs, ZWJ sequences, flags,\nskin tones) or the chat’s markup: links and URLs stay whole, and a code block, inline\ncode, a `,_jsx(_components.code,{children:`*bold*`}),` run or an HTML element longer than the limit is closed at the end of\none part and reopened at the start of the next.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` sent`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`reply`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`longAnswer`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// 9000 chars on Telegram → 3 messages`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`sent`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // the last part`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`sent`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`parts`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // the ref of every part, in order (only set when the text was split)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`before('send')`}),` hooks run `,_jsx(_components.strong,{children:`once, on the whole text`}),`, before it is split: a hook that\nadds a footer or translates the text changes the whole message, and what it returns is\nwhat gets split, so every part still fits (a hook that makes a short text too long gets\nit split too). An `,_jsx(_components.code,{children:`abort()`}),` skips the whole text. Each part is then a send of its own:\n`,_jsx(_components.code,{children:`after('send')`}),` hooks, the message log and the durable outbox see every part. Only the\nfirst part keeps `,_jsx(_components.code,{children:`quoted`}),`; an explicit `,_jsx(_components.code,{children:`idempotencyKey`}),` gets a `,_jsx(_components.code,{children:`#2`}),`, `,_jsx(_components.code,{children:`#3`}),`… suffix from\nthe second part on (from `,_jsx(_components.code,{children:`#1`}),` when a hook made the text too long). If a part fails, the\nsend rejects and the remaining parts are not sent; with durability, a part the outbox\ndefers (`,_jsx(_components.code,{children:`SendDeferredError`}),`) is followed by the remaining parts in the outbox, so the\nsweeper delivers all of them, in order. `,_jsx(_components.code,{children:`bot.enqueue()`}),` splits too: it journals one\nrecord per part (`,_jsx(_components.code,{children:`key`}),`, `,_jsx(_components.code,{children:`key#2`}),`, …). Text that fits is sent untouched.\n`,_jsx(_components.code,{children:`ctx.edit`}),` is never split, and `,_jsx(_components.code,{children:`ctx.stream()`}),` splits on its own. Turn it off with\n`,_jsx(_components.code,{children:`new Bot({ splitLongText: false })`}),` (the provider then rejects a long text with\n`,_jsx(_components.code,{children:`PayloadTooLargeError`}),`). To split text yourself, use `,_jsx(_components.code,{children:`splitMessage(text, { maxLength, maxBytes, format })`}),` from `,_jsx(_components.code,{children:`@botmesh/core`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`send-photo`,children:`Send photo`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`photo`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'https://picsum.photos/400/300'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'📸 caption'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`photo`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'./photo.jpg'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'caption'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// local file`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`photo`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`buffer`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'caption'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Buffer`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`send-video`,children:`Send video`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`video`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`url`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'caption'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`video`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`url`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'caption'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`gifPlayback:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// GIF`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`video`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`url`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'caption'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ptv:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// circular video`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`send-audio-\u0026-voice`,children:`Send audio \u0026 voice`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`audio`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`url`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// audio`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`voice`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`url`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// voice note (PTT)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`send-file`,children:`Send file`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`file`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`url`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'document.pdf'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'caption'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`send-sticker`,children:`Send sticker`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`sticker`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`url`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`pack:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'My Pack'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`author:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'me'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` })`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`send-location`,children:`Send location`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`location`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`4.7110`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`74.0721`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Bogotá, Colombia 🇨🇴'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`send-contact`,children:`Send contact`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`contact`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'573001234567'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Support Bot'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`buttons-normalized-degraded-per-transport`,children:`Buttons: normalized, degraded per transport`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`ctx.buttons(text, buttons)`}),` sends normalized button content. How it lands\ndepends on the provider:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`@botmesh/baileys`})}),` — native interactive buttons are dead in the\ncurrent WhatsApp Web protocol, so buttons degrade to a `,_jsx(_components.strong,{children:`numbered text\nmenu`}),`. A numbered menu (`,_jsx(_components.code,{children:`.choose()`}),` in a flow, or `,_jsx(_components.code,{children:`c.choose()`}),` in a\nconversation — see `,_jsx(_components.a,{href:`/guide/flows`,children:`Flows`}),`) or a real poll usually reads better.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`@botmesh/meta`})}),` (Cloud API) — native interactive buttons/lists/templates.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`@botmesh/telegram`})}),` — native inline keyboards.`]}),`\n`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`11`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`11`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`buttons`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Choose one'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'a'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`title:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Option A'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'b'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`title:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Option B'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`])`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Polls are native on Baileys and Telegram. The Cloud API has no polls:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// there, ctx.poll() rejects with UnsupportedContentError — use buttons.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`poll`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'What do you prefer?'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Option A'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Option B'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`])`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Multi select`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`poll`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'What do you like?'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'🍕 Pizza'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'🍔 Burger'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`], `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`If a provider cannot honor a content kind at all, `,_jsx(_components.code,{children:`send`}),` rejects with a\ntyped `,_jsx(_components.code,{children:`UnsupportedContentError`}),` from `,_jsx(_components.code,{children:`@botmesh/core`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`typing-indicator-and-reply-delays`,children:`Typing indicator and reply delays`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`BotConfig.typing`}),` shows “typing…” before every text reply sent through `,_jsx(_components.code,{children:`ctx`}),`\n(`,_jsx(_components.code,{children:`reply`}),` and its deprecated aliases, `,_jsx(_components.code,{children:`quote`}),` and flow `,_jsx(_components.code,{children:`.say`}),`). The indicator lasts\n`,_jsx(_components.code,{children:`text length / charsPerSecond`}),`, clamped to `,_jsx(_components.code,{children:`[minMs, maxMs]`}),`. It is off by default.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` bot`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Bot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`provider`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`typing:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// defaults: { minMs: 800, maxMs: 3000, charsPerSecond: 20 }`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` tuned`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Bot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`provider`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`typing:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`enabled:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`minMs:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 500`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`maxMs:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } })`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Per reply: override typing and/or wait first`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`reply`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'One moment…'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`typing:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` false`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` })`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`reply`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Here it is'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`delay:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '1.5s'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`typing:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`maxMs:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } })`})]}),`\n`]})})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`typing: true`}),` uses the bot’s timing, `,_jsx(_components.code,{children:`typing: false`}),` suppresses it, and an\nobject enables it with those overrides. A per-reply `,_jsx(_components.code,{children:`maxMs`}),` below the bot’s\n`,_jsx(_components.code,{children:`minMs`}),` lowers the minimum instead of throwing.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`delay`}),` (ms or `,_jsx(_components.code,{children:`'500ms'`}),`, `,_jsx(_components.code,{children:`'1.5s'`}),`) runs before the indicator. `,_jsx(_components.code,{children:`cancelIf: () => boolean`}),`\nis checked after the wait: when it returns `,_jsx(_components.code,{children:`true`}),` the reply is dropped.`]}),`\n`,_jsx(_components.li,{children:`A failing indicator never fails the send; it is cosmetic and best effort.`}),`\n`,_jsxs(_components.li,{children:[`On providers without `,_jsx(_components.code,{children:`capabilities.typing`}),` there is no indicator `,_jsx(_components.strong,{children:`and no wait`}),`. `,_jsx(_components.code,{children:`delay`}),` is honored everywhere.`]}),`\n`,_jsxs(_components.li,{children:[`A paced reply is dropped (it resolves `,_jsx(_components.code,{children:`{ skipped: true }`}),`) if the bot stops, the chat is handed off or the flow is aborted during the wait. `,_jsx(_components.code,{children:`stop({ drain: true })`}),` waits for paced replies.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ctx.replyWithTyping(text, msPerChar?)`}),` is `,_jsx(_components.strong,{children:`deprecated`}),`: it paces itself (40 ms per\ncharacter by default) and ignores `,_jsx(_components.code,{children:`BotConfig.typing`}),`. Use `,_jsx(_components.code,{children:`ctx.reply(text, { typing: true })`}),`.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Long or AI-generated answers can be streamed instead of sent in one go: see\n`,_jsx(_components.a,{href:`/guide/streaming`,children:`Streaming`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`edit-a-message`,children:`Edit a message`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` msg`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`reply`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Processing…'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`edit`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Done ✅'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// edits this context's own last reply`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`edit`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`msg`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ref`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Done ✅'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// edits a given message`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`edit`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Done ✅'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`fallback:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'skip'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// never sends a new message`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`ctx.edit(content)`}),` only targets the last reply sent by `,_jsx(_components.strong,{children:`this same context`}),`\n(this handler run, or this flow) and only when it has the same content kind.\nIt never edits replies to an earlier message, replies of another participant’s\nflow in a group, or a reply followed by a `,_jsx(_components.code,{children:`bot.send`}),` to the chat.\nThe result has `,_jsx(_components.code,{children:`edited: true`}),` when the provider edited in place.`]}),`\n`,_jsxs(_components.p,{children:[`When the provider cannot edit (no `,_jsx(_components.code,{children:`capabilities.edit`}),`, a content kind it cannot\nedit, or nothing to edit), `,_jsx(_components.code,{children:`ctx.edit`}),` sends the content as a `,_jsx(_components.strong,{children:`new message`}),` in\nthe chat of the edited message (`,_jsx(_components.code,{children:`ref.chatId`}),`), or sends nothing with\n`,_jsx(_components.code,{children:`{ fallback: 'skip' }`}),`. Edits run the `,_jsx(_components.code,{children:`before`}),`/`,_jsx(_components.code,{children:`after('send')`}),` hooks (the payload\ncarries `,_jsx(_components.code,{children:`edit: ref`}),`, see `,_jsx(_components.a,{href:`/guide/hooks#edits-and-streamed-output`,children:`Hooks`}),`) and update the outbound ledger.`]}),`\n`,_jsx(Heading,{level:`2`,id:`react`,children:`React`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`react`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'👍'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`react`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'❤️'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`react`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'🔥'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`msg`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ref`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// react to another message`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`react`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`''`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// remove the reaction, where the transport allows it`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`On providers that cannot send reactions, `,_jsx(_components.code,{children:`ctx.react`}),` resolves `,_jsx(_components.code,{children:`{ skipped: true }`}),`\ninstead of rejecting.`]}),`\n`,_jsx(Heading,{level:`2`,id:`support-per-transport`,children:`Support per transport`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`ctx.supports(feature)`}),` returns `,_jsx(_components.code,{children:`'native'`}),`, `,_jsx(_components.code,{children:`'degraded'`}),` or `,_jsx(_components.code,{children:`'unsupported'`}),` for\n`,_jsx(_components.code,{children:`'typing'`}),`, `,_jsx(_components.code,{children:`'delay'`}),`, `,_jsx(_components.code,{children:`'edit'`}),` and `,_jsx(_components.code,{children:`'react'`}),`:`]}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Transport`}),_jsx(_components.th,{children:`typing`}),_jsx(_components.th,{children:`delay`}),_jsx(_components.th,{children:`edit`}),_jsx(_components.th,{children:`react`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`WhatsApp (Baileys)`}),_jsx(_components.td,{children:`native`}),_jsx(_components.td,{children:`native`}),_jsx(_components.td,{children:`degraded (new message)`}),_jsx(_components.td,{children:`native`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`WhatsApp Cloud API`}),_jsx(_components.td,{children:`unsupported`}),_jsx(_components.td,{children:`native`}),_jsx(_components.td,{children:`degraded (new message)`}),_jsx(_components.td,{children:`native`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Messenger`}),_jsx(_components.td,{children:`native`}),_jsx(_components.td,{children:`native`}),_jsx(_components.td,{children:`degraded (new message)`}),_jsx(_components.td,{children:`unsupported (skipped)`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Instagram`}),_jsx(_components.td,{children:`native`}),_jsx(_components.td,{children:`native`}),_jsx(_components.td,{children:`degraded (new message)`}),_jsx(_components.td,{children:`unsupported (skipped)`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Telegram`}),_jsx(_components.td,{children:`native`}),_jsx(_components.td,{children:`native`}),_jsx(_components.td,{children:`native`}),_jsx(_components.td,{children:`native`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Discord`}),_jsx(_components.td,{children:`native`}),_jsx(_components.td,{children:`native`}),_jsx(_components.td,{children:`native`}),_jsx(_components.td,{children:`native`})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`other-actions`,children:`Other actions`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`markRead`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// mark the inbound message as read`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`typing`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// show \"typing…\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`recording`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// show \"recording audio…\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`delete`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// delete the inbound message (if allowed)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Actions degrade to a no-op on providers that lack the capability.\n`,_jsx(_components.code,{children:`ctx.typing()`}),` and `,_jsx(_components.code,{children:`ctx.recording()`}),` are best-effort: they never reject. If the\nprovider fails to show the indicator, the error is logged at `,_jsx(_components.code,{children:`debug`}),` and your\nhandler continues, so a failing indicator never costs the reply after it.`]}),`\n`,_jsx(Heading,{level:`2`,id:`receive-media`,children:`Receive media`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`8`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`bot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`onType`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'image'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`reply`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'📸 Got your image!'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) })`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`bot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`onType`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'audio'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`reply`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'🎵 Got your audio'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) })`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`bot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`onType`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'video'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`reply`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'🎬 Got your video'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) })`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`bot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`onType`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'sticker'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`reply`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'🎨 Got your sticker!'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) })`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`bot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`onType`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'document'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`reply`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'📄 Got your file'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) })`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`bot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`onType`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'location'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`reply`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'📍 Got your location'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) })`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`bot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`onType`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'contact'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`reply`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'👤 Got your contact'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) })`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`bot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`onType`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'poll'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`reply`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'📊 Got your poll'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) })`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`bot.onType(...)`}),` handlers are low-specificity matchers (the old\n`,_jsx(_components.code,{children:`onImage`}),`/`,_jsx(_components.code,{children:`onAudio`}),`/… helpers are deprecated aliases): a more specific\n`,_jsx(_components.code,{children:`bot.when(...)`}),` that also matches wins first, unless it calls `,_jsx(_components.code,{children:`ctx.pass()`}),`.\nThe same matchers are available as trigger constants (`,_jsx(_components.code,{children:`IMAGE`}),`, `,_jsx(_components.code,{children:`VOICE_NOTE`}),`,\n`,_jsx(_components.code,{children:`LOCATION`}),`, `,_jsx(_components.code,{children:`CALL`}),`…; multi-type ones such as `,_jsx(_components.code,{children:`MEDIA`}),` rank just below): see\n`,_jsx(_components.a,{href:`/guide/triggers`,children:`Special triggers`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`receive-a-location`,children:`Receive a location`}),`\n`,_jsxs(_components.p,{children:[`A shared location arrives as `,_jsx(_components.code,{children:`ctx.type === 'location'`}),` with its coordinates\nnormalized on `,_jsx(_components.code,{children:`ctx.sharedLocation`}),` (it is not `,_jsx(_components.code,{children:`ctx.location`}),`, which `,_jsx(_components.strong,{children:`sends`}),`\none):`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`bot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`onType`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'location'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` loc`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`sharedLocation`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`loc`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`reply`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'I could not read that location'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`reply`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`📍 \"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`loc`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`latitude`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`loc`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`longitude`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"}${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`loc`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ?`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" ` (\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`loc`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`name`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\")`\"}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` :`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ''`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`sharedLocation`}),` is `,_jsx(_components.code,{children:`{ latitude, longitude, name?, address?, live? }`}),` (WGS84\ndecimal degrees; `,_jsx(_components.code,{children:`live: true`}),` on the first message of a live-location share).\n`,_jsx(_components.code,{children:`ctx.body`}),` keeps the place name or address (or `,_jsx(_components.code,{children:`''`}),`), so text triggers still\nwork. Providers that fill it: WhatsApp via Baileys (pins and live locations),\nWhatsApp Cloud API, Telegram (pins, live locations and venues), Messenger and\nInstagram (when Meta sends coordinates), Evolution API and WPPConnect (pins and\nlive locations), Gupshup and Twilio (`,_jsx(_components.code,{children:`Latitude`}),`/`,_jsx(_components.code,{children:`Longitude`}),`). Discord and\nHighLevel have no inbound locations. On other channels, or when the transport sends\nno coordinates, `,_jsx(_components.code,{children:`ctx.type`}),` is still `,_jsx(_components.code,{children:`'location'`}),` but `,_jsx(_components.code,{children:`sharedLocation`}),` is\n`,_jsx(_components.code,{children:`undefined`}),`. Provider authors map their payload with\n`,_jsx(_components.code,{children:`toInboundLocation({ latitude, longitude, name, address, live })`}),` from\n`,_jsx(_components.code,{children:`@botmesh/core/spi`}),`, which drops missing or out-of-range coordinates.`]}),`\n`,_jsxs(_components.p,{children:[`Inside a conversation, `,_jsx(_components.code,{children:`c.waitLocation(opts?)`}),` waits for one and resolves with\nthe `,_jsx(_components.code,{children:`InboundLocation`}),`; anything else re-prompts with `,_jsx(_components.code,{children:`otherwise`}),` (default: the\nlocalized `,_jsx(_components.code,{children:`core.wait.location`}),`). The stored inbound message keeps it too\n(`,_jsx(_components.code,{children:`StoredMessage.location`}),`).`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`bot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`conversation`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'delivery'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`say`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Share the delivery location 📍'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` loc`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`waitLocation`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`timeout:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '5m'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` })`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`say`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`We deliver to \"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`loc`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`latitude`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`loc`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`longitude`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`poll-votes`,children:`Poll votes`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`ctx.poll(question, options, multiSelect?)`}),` sends a native poll. Votes\narrive on the `,_jsx(_components.code,{children:`poll`}),` event with the full, current tally:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`poll`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Pizza or sushi?'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Pizza'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Sushi'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`])`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`bot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`on`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'poll'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`vote`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // vote.ref.id → the poll's message id`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // vote.ref.chatId → the chat where it was voted (same chatId its messages use)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // vote.senderId → who just voted, with the canonical id of their messages`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // vote.options → current tally: [{ name, votes, voters }]`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` picked`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` vote`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`options`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`filter`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`((`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`o`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` o`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`voters`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`?.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`includes`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`vote`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`senderId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)).`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`map`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`((`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`o`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` o`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`name`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`picked`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:`length`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ?`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" `Picked: \"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`picked`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`join`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`', '`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#D4D4D4`},children:`)`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` :`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Vote withdrawn'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`On `,_jsx(_components.strong,{children:`Baileys`}),`, WhatsApp encrypts every vote end to end; the provider\ndecrypts it itself. It remembers the 500 most recent polls it saw (the\nbot’s own and the ones others create in chats it listens to), only accepts\na vote that arrives in the poll’s own chat and names its creator, keeps\neach person’s latest vote, and counts each vote message once (Baileys’\noffline redelivery is not re-emitted). Limits: only polls seen by `,_jsx(_components.strong,{children:`this\nprocess`}),` can be decrypted (after a restart, votes on older polls are\ndropped with a `,_jsx(_components.code,{children:`debug`}),` log), and the bot cannot vote. A poll someone else\ncreates still arrives as a `,_jsx(_components.code,{children:`poll`}),` message (`,_jsx(_components.code,{children:`bot.onType('poll')`}),`, the\n`,_jsxs(_components.a,{href:`/guide/triggers#message-type-triggers`,children:[_jsx(_components.code,{children:`POLL`}),` trigger`]}),`); the encrypted vote no\nlonger does. Details in the `,_jsx(_components.code,{children:`@botmesh/baileys`}),` README.`]}),`\n`,_jsxs(_components.p,{children:[`On `,_jsx(_components.strong,{children:`Telegram`}),`, polls are sent non-anonymous, so each vote arrives as a\n`,_jsx(_components.code,{children:`poll_answer`}),` update and the provider tallies it into the same `,_jsx(_components.code,{children:`poll`}),` event\n(empty selection = vote withdrawn). Telegram only reports votes on polls the\nbot sent, and the provider remembers the 500 most recent ones it sent from this\nprocess. Members of the chat can see who voted; `,_jsx(_components.code,{children:`anonymousPolls: true`}),` sends\nanonymous polls, whose votes never reach the bot. A channel refuses public-voter\npolls: the poll is retried once as anonymous and the channel is remembered.`]}),`\n`,_jsx(Heading,{level:`2`,id:`access-media-content`,children:`Access media content`}),`\n`,_jsxs(_components.p,{children:[`Inbound media is downloaded `,_jsx(_components.strong,{children:`lazily`}),`: the context only carries a reference\nuntil you ask for the bytes with `,_jsx(_components.code,{children:`loadMediaOf(ctx)`}),`. It downloads once through\nthe provider and caches the result on `,_jsx(_components.code,{children:`ctx.media`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`15`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`15`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`loadMediaOf`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`MediaTooLargeError`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '@botmesh/core'`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`bot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`onType`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'image'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` try`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` media`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` loadMediaOf`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`maxBytes:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 5`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1024`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1024`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` })`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`media`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`return`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // no media, or the download failed`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`media`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`mimetype`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// 'image/jpeg'`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`media`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`buffer`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Buffer`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`media`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`size`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// bytes, when the provider declared it`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // ctx.media is now the same payload`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`catch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`err`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`err`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` instanceof`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` MediaTooLargeError`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`reply`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'That file is too large'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` else`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` throw`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` err`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})}),`\n`]})})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`It resolves `,_jsx(_components.code,{children:`undefined`}),` when the message has no media, the provider cannot\ndownload, or (by default) the download fails. `,_jsx(_components.code,{children:`{ throwOnError: true }`}),`\nrejects with the download error instead.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`maxBytes`}),` is checked against the size the provider declared, before\ndownloading anything, and again while reading; the download is cut as soon as\nit goes over. It rejects with `,_jsx(_components.code,{children:`MediaTooLargeError`}),` (a `,_jsx(_components.code,{children:`PayloadTooLargeError`}),`,\nwith `,_jsx(_components.code,{children:`bytes`}),` and `,_jsx(_components.code,{children:`maxBytes`}),`).`]}),`\n`,_jsxs(_components.li,{children:[`Call it in a `,_jsx(_components.code,{children:`before('message')`}),` hook to download before routing; the\n`,_jsx(_components.a,{href:`/guide/voice`,children:`voice`}),` plugin transcribes voice notes this way.`]}),`\n`]}),`\n`,_jsxs(Heading,{level:`2`,id:`the-full-messagecontext`,children:[`The full `,_jsx(_components.code,{children:`MessageContext`})]}),`\n`,_jsxs(_components.p,{children:[`Besides the reply helpers, every handler receives data fields on `,_jsx(_components.code,{children:`ctx`}),`:\n`,_jsx(_components.code,{children:`ctx.body`}),`, `,_jsx(_components.code,{children:`ctx.from`}),` (chat id), `,_jsx(_components.code,{children:`ctx.sender`}),` (user id; = `,_jsx(_components.code,{children:`from`}),` in DMs,\nparticipant in groups), `,_jsx(_components.code,{children:`ctx.senderInfo`}),`, `,_jsx(_components.code,{children:`ctx.pushName`}),`, `,_jsx(_components.code,{children:`ctx.chat`}),`\n(`,_jsx(_components.code,{children:`{ id, kind, name?, isGroup, isBroadcast, participants? }`}),`), `,_jsx(_components.code,{children:`ctx.type`}),`,\n`,_jsx(_components.code,{children:`ctx.isGroup`}),` / `,_jsx(_components.code,{children:`ctx.isPrivate`}),` / `,_jsx(_components.code,{children:`ctx.isFromMe`}),`, `,_jsx(_components.code,{children:`ctx.mentions`}),`,\n`,_jsx(_components.code,{children:`ctx.quoted?`}),`, `,_jsx(_components.code,{children:`ctx.media?`}),` (after `,_jsx(_components.code,{children:`loadMediaOf`}),`), `,_jsx(_components.code,{children:`ctx.timestamp`}),` (when the message was\nsent, in epoch `,_jsx(_components.strong,{children:`milliseconds`}),` on every channel: `,_jsx(_components.code,{children:`new Date(ctx.timestamp)`}),`), `,_jsx(_components.code,{children:`ctx.tools`}),` (DI registry),\n`,_jsx(_components.code,{children:`ctx.raw`}),` (provider-native payload), `,_jsx(_components.code,{children:`ctx.ref`}),` (the message reference —\n`,_jsx(_components.code,{children:`{ id, chatId, native? }`}),`, replaces v1’s `,_jsx(_components.code,{children:`ctx.key`}),`), `,_jsx(_components.code,{children:`ctx.user`}),` (the\nsender’s `,_jsx(_components.a,{href:`/guide/user-data`,children:`persistent profile`}),`), `,_jsx(_components.code,{children:`ctx.handoff()`}),` (pass the chat\nto a `,_jsx(_components.a,{href:`/guide/handoff`,children:`human`}),`), `,_jsx(_components.code,{children:`ctx.call`}),` (the `,_jsx(_components.code,{children:`CallEvent`}),`, on\n`,_jsx(_components.a,{href:`/guide/triggers#call`,children:_jsx(_components.code,{children:`CALL`})}),` contexts only) and the `,_jsx(_components.a,{href:`/guide/i18n`,children:`i18n`}),` members\n`,_jsx(_components.code,{children:`ctx.lang`}),`, `,_jsx(_components.code,{children:`ctx.langSource`}),`, `,_jsx(_components.code,{children:`ctx.t()`}),` and `,_jsx(_components.code,{children:`ctx.setLang()`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`identity-per-transport`,children:`Identity per transport`}),`\n`,_jsxs(_components.p,{children:[`Every provider resolves aliases before emitting, so `,_jsx(_components.code,{children:`ctx.sender`}),` is the\nsame for the same person (the identity contract):`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Baileys:`}),` LID and PN (phone) forms of a user are merged into one\ncanonical id (the PN when known). Messages, reactions, poll votes, calls,\ngroup and presence events, `,_jsx(_components.code,{children:`ctx.mentions`}),` and the bot’s own `,_jsx(_components.code,{children:`selfId`}),` all\nuse it, so `,_jsx(_components.code,{children:`groupMode: 'mentions'`}),` works whether the mention used the LID\nor the PN.`]}),`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[`Cloud API (`,_jsx(_components.code,{children:`@botmesh/meta`}),`):`]}),` users who turned on a WhatsApp\n`,_jsx(_components.strong,{children:`username`}),` may arrive without a phone number, only with a\nbusiness-scoped user id (`,_jsx(_components.strong,{children:`BSUID`}),`, e.g. `,_jsx(_components.code,{children:`US.13491208655302741918`}),`). The\nprovider keeps one stable id per person (the phone when known, otherwise\nthe BSUID), learns phone ↔ BSUID pairs (persist them with an\n`,_jsx(_components.code,{children:`identityMap`}),`), and sends to a BSUID through the `,_jsx(_components.code,{children:`recipient`}),` field\nautomatically. `,_jsx(_components.code,{children:`senderInfo.username`}),` and\n`,_jsx(_components.code,{children:`senderInfo.platformData.bsuid`}),` expose the details. Authentication\ntemplates require a phone: sending one to a BSUID fails with Graph error\n`,_jsx(_components.code,{children:`131062`}),`, mapped to `,_jsx(_components.code,{children:`UnsupportedContentError`}),`. See the `,_jsx(_components.code,{children:`@botmesh/meta`}),`\nREADME.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`sending-outside-a-handler`,children:`Sending outside a handler`}),`\n`,_jsxs(_components.p,{children:[`To message someone without waiting for them to write first — e.g. from a\n`,_jsx(_components.a,{href:`/guide/scheduler`,children:`scheduled task`}),` — use the bot instance directly. Content is\nthe transport-neutral tagged union (`,_jsx(_components.code,{children:`{ kind, ... }`}),`):`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` bot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`send`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'[email protected]'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'🌅 Good morning!'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` bot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`send`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'[email protected]'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` kind:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'image'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` media:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`url`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` caption:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'hi'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` bot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`send`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chatId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Hi, I am Ana from support'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// same path; a string is sent as text`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`broadcasts`,children:`Broadcasts`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`bot.broadcast(chatIds, content, options?)`}),` sends one content (a string is sent as\ntext) to many chats, in batches, without blocking the per-chat inbound queues:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`11`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`11`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` ac`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` AbortController`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` res`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` bot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`broadcast`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chatIds`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'🎉 New promo!'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` batchSize:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 10`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// chats per batch (default 10)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` delayBetween:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '2s'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// pause between batches (ms or '2s', '1m'; default 0)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` concurrency:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// parallel sends per batch (default 1)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` retries:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 3`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// retries per chat after a RateLimitedError (default 3)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` onProgress`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`done`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`total`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` bot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`logger`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`info`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`done`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`/`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`total`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` onFail`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`chatId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` bot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`logger`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`warn`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chatId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`err:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'broadcast failed'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` signal:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ac`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`signal`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// abort to stop early`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// → { total, sent, failed, skipped, errors: [{ chatId, error }], messages, cancelled, pending }`})}),`\n`]})})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`A `,_jsx(_components.code,{children:`RateLimitedError`}),` pauses `,_jsx(_components.strong,{children:`every`}),` worker for its `,_jsx(_components.code,{children:`retryAfterMs`}),` and retries that chat.`]}),`\n`,_jsxs(_components.li,{children:[`Other errors are recorded in `,_jsx(_components.code,{children:`errors`}),` and the broadcast goes on; it never rejects for a per-chat failure.`]}),`\n`,_jsxs(_components.li,{children:[`Aborting `,_jsx(_components.code,{children:`signal`}),` or calling `,_jsx(_components.code,{children:`bot.stop()`}),` starts no new send; chats never attempted come back in `,_jsx(_components.code,{children:`pending`}),` (`,_jsx(_components.code,{children:`cancelled: true`}),`).`]}),`\n`,_jsxs(_components.li,{children:[`Duplicate ids are sent once; sends skipped by a `,_jsx(_components.code,{children:`before('send')`}),` hook count as `,_jsx(_components.code,{children:`skipped`}),`.`]}),`\n`]}),`\n`,_jsxs(Warning,{children:[_jsx(_components.p,{children:_jsx(_components.strong,{children:`Breaking change`})}),_jsxs(_components.p,{children:[_jsx(_components.code,{children:`sent`}),` and `,_jsx(_components.code,{children:`failed`}),` are now `,_jsx(_components.strong,{children:`counts`}),`. The accepted sends moved to `,_jsx(_components.code,{children:`messages`}),` and the failures to `,_jsx(_components.code,{children:`errors`}),`.`]})]}),`\n`,_jsxs(_components.p,{children:[`From inside a handler, launch it with `,_jsx(_components.code,{children:`void bot.broadcast(...)`}),` so that chat’s queue is not held while it runs.`]}),`\n`,_jsx(Heading,{level:`2`,id:`starting-a-flow-programmatically`,children:`Starting a flow programmatically`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`bot.trigger(name, { chatId, userId?, isGroup?, data?, ifActive?, body? })`}),` starts a\nregistered flow or `,_jsx(_components.code,{children:`bot.conversation`}),` for someone who has not written: reminders,\nwebhooks, admin panels. `,_jsx(_components.code,{children:`data`}),` seeds `,_jsx(_components.code,{children:`c.state`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`bot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`schedule`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0 9 * * *'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` () `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` appt`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` of`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` db`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`appointmentsToday`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` bot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`trigger`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'reminder'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chatId:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` appt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chatId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`time:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` appt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`time`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } })`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`It goes through the access lists, the human handoff gate and the chat’s FIFO queue.\nIt resolves `,_jsx(_components.code,{children:`{ started, name, chatId, userId, reason? }`}),` as soon as the conversation is\n`,_jsx(_components.strong,{children:`entered`}),`, not when it ends (listen to `,_jsx(_components.code,{children:`'conversation:ended'`}),` for that). `,_jsx(_components.code,{children:`reason`}),` is\n`,_jsx(_components.code,{children:`'stopped' | 'blocked' | 'handoff' | 'busy'`}),`; an unknown `,_jsx(_components.code,{children:`name`}),` rejects.\nA subject with a live or dormant conversation is left alone unless `,_jsx(_components.code,{children:`ifActive: 'replace'`}),`.\nIt is safe to `,_jsx(_components.code,{children:`await bot.trigger(...)`}),` from a handler or command of the same chat: it runs in that message’s queue slot.`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`userId`}),` (default: `,_jsx(_components.code,{children:`chatId`}),`) and `,_jsx(_components.code,{children:`isGroup`}),` target one participant of a group;\n`,_jsx(_components.code,{children:`body`}),` sets the synthetic message’s `,_jsx(_components.code,{children:`ctx.body`}),` (default `,_jsx(_components.code,{children:`''`}),`).`]}),`\n`,_jsxs(_components.li,{children:[`No `,_jsx(_components.code,{children:`before('message')`}),` hooks, matchers or `,_jsx(_components.code,{children:`'message'`}),` event run, and nothing is\npersisted for the synthetic message (`,_jsx(_components.code,{children:`ctx.raw`}),` is `,_jsx(_components.code,{children:`{ synthetic: 'trigger', name }`}),`).`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`bot.triggerFlow(id, { chatId, userId?, isGroup? }, { data?, body? })`}),` is deprecated:\nit is `,_jsx(_components.code,{children:`bot.trigger(id, { chatId, userId, isGroup, data, body, ifActive: 'replace' })`}),`\nresolving `,_jsx(_components.code,{children:`result.started`}),`.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`runtime-metrics`,children:`Runtime metrics`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`bot.metrics()`}),`, `,_jsx(_components.code,{children:`bot.resetMetrics()`}),`, the Prometheus exporter `,_jsx(_components.code,{children:`toPrometheus()`}),` and\nthe `,_jsx(_components.code,{children:`'conversation:started'`}),` / `,_jsx(_components.code,{children:`'conversation:ended'`}),` events are documented in\n`,_jsx(_components.a,{href:`/guide/operations#runtime-metrics`,children:`Operations`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`next-steps`,children:`Next steps`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/guide/flows`,children:`Conversation flows`}),` — multi-step conversations`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/guide/streaming`,children:`Streaming`}),` — long and AI replies, piece by piece`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/guide/channels`,children:`Channels`}),` — what each transport supports`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/guide/operations`,children:`Operations`}),` — metrics and conversation events`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/examples/media`,children:`Examples`}),` — full media recipes`]}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Messages \u0026 Media","sidebarTitle":"Messages \u0026 media","description":"Everything you can send and receive.","href":"/guide/messages"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Reply helpers (inside a handler)","slug":"reply-helpers-inside-a-handler","depth":2,"children":[{"title":"Long text is split automatically","slug":"long-text-is-split-automatically","depth":3,"children":[]}]},{"title":"Send photo","slug":"send-photo","depth":2,"children":[]},{"title":"Send video","slug":"send-video","depth":2,"children":[]},{"title":"Send audio \u0026 voice","slug":"send-audio-\u0026-voice","depth":2,"children":[]},{"title":"Send file","slug":"send-file","depth":2,"children":[]},{"title":"Send sticker","slug":"send-sticker","depth":2,"children":[]},{"title":"Send location","slug":"send-location","depth":2,"children":[]},{"title":"Send contact","slug":"send-contact","depth":2,"children":[]},{"title":"Buttons: normalized, degraded per transport","slug":"buttons-normalized-degraded-per-transport","depth":2,"children":[]},{"title":"Typing indicator and reply delays","slug":"typing-indicator-and-reply-delays","depth":2,"children":[]},{"title":"Edit a message","slug":"edit-a-message","depth":2,"children":[]},{"title":"React","slug":"react","depth":2,"children":[]},{"title":"Support per transport","slug":"support-per-transport","depth":2,"children":[]},{"title":"Other actions","slug":"other-actions","depth":2,"children":[]},{"title":"Receive media","slug":"receive-media","depth":2,"children":[]},{"title":"Receive a location","slug":"receive-a-location","depth":2,"children":[]},{"title":"Poll votes","slug":"poll-votes","depth":2,"children":[]},{"title":"Access media content","slug":"access-media-content","depth":2,"children":[]},{"title":"The full MessageContext","slug":"the-full-messagecontext","depth":2,"children":[]},{"title":"Identity per transport","slug":"identity-per-transport","depth":2,"children":[]},{"title":"Sending outside a handler","slug":"sending-outside-a-handler","depth":2,"children":[]},{"title":"Broadcasts","slug":"broadcasts","depth":2,"children":[]},{"title":"Starting a flow programmatically","slug":"starting-a-flow-programmatically","depth":2,"children":[]},{"title":"Runtime metrics","slug":"runtime-metrics","depth":2,"children":[]},{"title":"Next steps","slug":"next-steps","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"afaya","siteName":"botmesh","title":"Messages \u0026 Media - botmesh","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{"en":{"href":"/guide/messages","matchLevel":0},"es":{"href":"/es/guide/messages","matchLevel":1}}},"lastModified":"2026-10-27T14:24:11.800Z","originalFileLocation":"guide/messages.mdx","locale":"en"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Everything you can send and receive.\">\u003cmeta data-mint-head name=\"application-name\" content=\"botmesh\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/afaya/omilwj1Ifh1eDwt5/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/afaya/omilwj1Ifh1eDwt5/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/afaya/omilwj1Ifh1eDwt5/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/afaya/omilwj1Ifh1eDwt5/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/afaya/omilwj1Ifh1eDwt5/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/afaya/omilwj1Ifh1eDwt5/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/afaya/omilwj1Ifh1eDwt5/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/afaya/omilwj1Ifh1eDwt5/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/afaya/omilwj1Ifh1eDwt5/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Messages \u0026amp; Media - botmesh\">\u003cmeta data-mint-head property=\"og:description\" content=\"Everything you can send and receive.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"botmesh\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://afaya.mintlify.app/guide/messages\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://afaya.mintlify.app/_mintlify/api/og/v2?division=Features\u0026amp;title=Messages+%26+Media\u0026amp;description=Everything+you+can+send+and+receive.\u0026amp;theme=dea9f3ba838ba9e4866bef64\u0026amp;signature=3b08d22acc947174734ec4c982972be46b00a66d248a923fce25523f2e204c16\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Messages \u0026amp; Media - botmesh\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Everything you can send and receive.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://afaya.mintlify.app/_mintlify/api/og/v2?division=Features\u0026amp;title=Messages+%26+Media\u0026amp;description=Everything+you+can+send+and+receive.\u0026amp;theme=dea9f3ba838ba9e4866bef64\u0026amp;signature=3b08d22acc947174734ec4c982972be46b00a66d248a923fce25523f2e204c16\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/afaya/omilwj1Ifh1eDwt5/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"botmesh\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#3451B2\">\u003clink data-mint-head rel=\"canonical\" href=\"https://afaya.mintlify.app/guide/messages\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/guide/messages.md\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"en\" href=\"https://afaya.mintlify.app/guide/messages\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"es\" href=\"https://afaya.mintlify.app/es/guide/messages\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"x-default\" href=\"https://afaya.mintlify.app/guide/messages\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://afaya.mintlify.app/#organization\",\"name\":\"botmesh\",\"url\":\"https://afaya.mintlify.app\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/afaya/32LyKbpS8BIF3Yl-/logo/light.svg?fit=max\u0026auto=format\u0026n=32LyKbpS8BIF3Yl-\u0026q=85\u0026s=5a9c4db10ba52bbd645a009cc009e31e\"}},{\"@type\":\"WebSite\",\"@id\":\"https://afaya.mintlify.app#website\",\"name\":\"botmesh\",\"url\":\"https://afaya.mintlify.app\",\"publisher\":{\"@id\":\"https://afaya.mintlify.app/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://afaya.mintlify.app/guide/messages#webpage\",\"url\":\"https://afaya.mintlify.app/guide/messages\",\"name\":\"Messages \u0026 Media\",\"description\":\"Everything you can send and receive.\",\"dateModified\":\"2026-10-27T14:24:11.800Z\",\"isPartOf\":{\"@id\":\"https://afaya.mintlify.app#website\"},\"breadcrumb\":{\"@id\":\"https://afaya.mintlify.app/guide/messages#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://afaya.mintlify.app/guide/messages#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"botmesh\",\"item\":\"https://afaya.mintlify.app\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Messages \u0026 Media\",\"item\":\"https://afaya.mintlify.app/guide/messages\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://afaya.mintlify.app/guide/messages#article\",\"headline\":\"Messages \u0026 Media\",\"name\":\"Messages \u0026 Media\",\"description\":\"Everything you can send and receive.\",\"url\":\"https://afaya.mintlify.app/guide/messages\",\"mainEntityOfPage\":{\"@id\":\"https://afaya.mintlify.app/guide/messages#webpage\"},\"dateModified\":\"2026-10-27T14:24:11.800Z\",\"publisher\":{\"@id\":\"https://afaya.mintlify.app/#organization\"},\"isPartOf\":{\"@id\":\"https://afaya.mintlify.app#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"botmesh\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"botmesh","nav":{"global":null,"languages":[{"language":"en","default":true,"tabs":[{"tab":"Guide","icon":"book-open","groups":[{"group":"Getting started","pages":[{"title":"botmesh","sidebarTitle":"Home","mode":"wide","href":""},{"title":"Getting Started","sidebarTitle":"Quick start","href":"/guide/getting-started"},{"title":"Your First Bot","sidebarTitle":"Your first bot","href":"/guide/first-bot"},{"title":"Core Concepts","sidebarTitle":"Core concepts","href":"/guide/concepts"},{"title":"Configuration reference","href":"/guide/configuration"},{"title":"Channels (providers)","sidebarTitle":"Channels","description":"The bot engine (@botmesh/core) does not know about any transport. A provider connects it to one channel: it receives the channel's events, turns them into neutral InboundEvents and sends OutboundContent back. The same flows, triggers and plugins run on every channel; only the constructor changes.","href":"/guide/channels"}]},{"group":"Features","pages":[{"title":"Messages \u0026 Media","sidebarTitle":"Messages \u0026 media","href":"/guide/messages"},{"title":"Conversation Flows","sidebarTitle":"Conversation flows","description":"Flows are multi-step conversations. flow(trigger) gives you a chainable DSL that compiles to a real async conversation under the hood: the bot asks, the user answers, the bot stores the answer in c.state and continues.","href":"/guide/flows"},{"title":"Special triggers: WELCOME, message types and CALL","sidebarTitle":"Special triggers","href":"/guide/triggers"},{"title":"Forms (WhatsApp Flows)","href":"/guide/forms"},{"title":"Persistent user data (`ctx.user`)","sidebarTitle":"Persistent user data","href":"/guide/user-data"},{"title":"Internationalization (i18n)","href":"/guide/i18n"},{"title":"Human handoff \u0026 access lists","sidebarTitle":"Handoff \u0026 access lists","href":"/guide/handoff"},{"title":"Hooks (Middleware)","sidebarTitle":"Hooks (middleware)","href":"/guide/hooks"},{"title":"Plugins","href":"/guide/plugins"},{"title":"AI plugin","href":"/guide/ai"},{"title":"AI tool calling","href":"/guide/ai-tools"},{"title":"AI memory \u0026 RAG","href":"/guide/ai-memory-rag"},{"title":"Streaming replies (`ctx.stream`)","sidebarTitle":"Streaming replies","href":"/guide/streaming"},{"title":"Voice (`@botmesh/voice`)","sidebarTitle":"Voice (STT/TTS)","href":"/guide/voice"},{"title":"Integrations","href":"/guide/integrations"},{"title":"Dependency Injection","sidebarTitle":"Dependency injection","href":"/guide/di"},{"title":"Scheduler","href":"/guide/scheduler"},{"title":"Rate Limiting (Anti-Ban)","sidebarTitle":"Rate limiting (anti-ban)","href":"/guide/rate-limiting"},{"title":"Persistent store","href":"/guide/store"},{"title":"Control plane","href":"/guide/control-plane"},{"title":"Webhook server (`@botmesh/server`)","sidebarTitle":"Webhook server","href":"/guide/server"},{"title":"24-hour window and pricing (Cloud API)","sidebarTitle":"WhatsApp 24h window","href":"/guide/session-window"},{"title":"Operations: metrics, events, inbox and delivery","sidebarTitle":"Operations","href":"/guide/operations"},{"title":"Tracing (OpenTelemetry)","href":"/guide/tracing"},{"title":"Durable message processing","sidebarTitle":"Durable processing","href":"/guide/durability"}]},{"group":"Develop \u0026 test","pages":[{"title":"Terminal simulator (`botmesh dev`)","sidebarTitle":"Terminal simulator","href":"/guide/dev-simulator"},{"title":"Platform sandbox","href":"/guide/sandbox"},{"title":"Testing","href":"/guide/testing"},{"title":"Inspect \u0026 lint flows","href":"/guide/flow-tools"},{"title":"JSON flow schema","href":"/guide/flow-schema"},{"title":"MCP server","href":"/guide/mcp"},{"title":"Golden transcripts","href":"/guide/golden-transcripts"},{"title":"ESLint plugin","href":"/guide/eslint"}]},{"group":"Advanced","pages":[{"title":"Sub-APIs (v1) → transport escape hatches (v2)","sidebarTitle":"Sub-APIs","href":"/guide/sub-apis"},{"title":"Going to production","href":"/guide/production"},{"title":"Deployment","href":"/guide/deploy"},{"title":"Running N replicas","href":"/guide/replicas"},{"title":"Architecture","href":"/guide/architecture"},{"title":"Redis Cluster","href":"/guide/redis-cluster"},{"title":"Security","href":"/guide/security"},{"title":"Threat model","href":"/guide/threat-model"},{"title":"Upgrade to stable: checklist and API changes","sidebarTitle":"Upgrade to stable: checklist \u0026 API","href":"/guide/stable-migration"},{"title":"Upgrade to stable: dependencies","href":"/guide/migration"},{"title":"Upgrade to stable: behaviour changes","sidebarTitle":"Upgrade to stable: behaviour","href":"/guide/migration-2"},{"title":"Upgrade notes: channels and plugins","sidebarTitle":"Upgrade notes: channels \u0026 plugins","href":"/guide/upgrade-channels-plugins"},{"title":"Troubleshooting","href":"/guide/troubleshooting"},{"title":"FAQ","href":"/guide/faq"}]}]},{"tab":"Examples","icon":"chef-hat","pages":[{"title":"Examples","href":"/examples"}]},{"tab":"API reference","icon":"code","pages":[{"title":"API reference","href":"/api/core"}]}]},{"language":"es","footer":{"socials":{"github":"https://github.com/andresayac/botmesh"},"links":[{"header":"Proyecto","items":[{"label":"GitHub","href":"https://github.com/andresayac/botmesh"},{"label":"npm","href":"https://www.npmjs.com/package/@botmesh/core"},{"label":"Licencia MIT","href":"https://github.com/andresayac/botmesh/blob/main/LICENSE"},{"label":"Changelog","href":"https://github.com/andresayac/botmesh/blob/main/CHANGELOG.md"}]}]},"pages":[{"title":"es","href":"/es/guide/messages"}]}]},"title":"Messages \u0026 Media - botmesh","buildId":"dpl_DFJrtvUi8HS5F9nkooKuDJsuD5BM","deploymentId":"dpl_DFJrtvUi8HS5F9nkooKuDJsuD5BM","dynamics":[],"chunks":[]}