TRaw. The
reply helpers keep IDENTICAL signatures to v1 — internally each now builds an
OutboundContent descriptor and calls provider.send, instead of hand-rolling
Baileys JSON. from/sender/body/type/isGroup are read straight off the
normalized InboundMessage, so user code and keyFor are unchanged.
Type Parameters
Properties
body
from
sender
senderInfo
pushName?
chat
type
isGroup
isPrivate
isFromMe
mentions
quoted?
media?
sharedLocation?
type === 'location'), normalized by the provider;
undefined otherwise. Named sharedLocation because ctx.location() SENDS one.
ref
raw
timestamp
new Date(ctx.timestamp) works).
A provider that still reports epoch seconds is converted.
interaction?
acknowledge() is a safe no-op on transports without ack (WhatsApp). On a transport
with capabilities.interactionsRequireAck the core acks on its own; once that ack
went out (after the first send or near the deadline), acknowledge(text) sends
text as a regular reply instead.
id
data
respondBy?
call?
CALL trigger receives (type === 'call'):
the provider’s normalized call notification.
capabilities?
textFormat?
textFormatFor(chatId), else
capabilities.textFormat. Unset = unknown (send Markdown untouched). Use it,
not capabilities.textFormat, to format text for the chat (@botmesh/ai does).
user
ctx.sender), shared across chats — see
UserData. ctx.user.ns('game') scopes it to a namespace.
lang
'es', 'en').
Order: ctx.user preference → provider-reported language → i18n.detect → default.
defaultLang?
lang / i18n.defaultLocale, 'en' unless configured), whatever
lang resolved to. Plugins that ship their own built-in texts for a few
languages use it as the fallback for a lang they do not cover.
langSource?
'user' | 'provider' | 'detector' | 'default');
undefined while i18n is off (then lang is just the default locale). Plugins
that want a real language signal (e.g. a speech-to-text hint) should ignore
'default'. A hook that assigns ctx.lang directly does not update it.
tools
Methods
acknowledge()
Parameters
Returns
Promise<void>
say()
Parameters
Returns
Promise<SentMessage<unknown>>
Deprecated
Use MessageContext.reply (ctx.reply(text)). The flow DSL’s .say() step is not affected.
reply()
ctx.from). The canonical text reply.
Parameters
Returns
Promise<SentMessage<unknown>>
answer()
Parameters
Returns
Promise<SentMessage<unknown>>
Deprecated
Use MessageContext.reply (ctx.reply(text)).
text()
Parameters
Returns
Promise<SentMessage<unknown>>
Deprecated
Use MessageContext.reply (ctx.reply(text)).
photo()
Parameters
Returns
Promise<SentMessage<unknown>>
video()
Parameters
Returns
Promise<SentMessage<unknown>>
audio()
Parameters
Returns
Promise<SentMessage<unknown>>
voice()
Parameters
Returns
Promise<SentMessage<unknown>>
file()
Parameters
Returns
Promise<SentMessage<unknown>>
sticker()
Parameters
Returns
Promise<SentMessage<unknown>>
location()
Parameters
Returns
Promise<SentMessage<unknown>>
contact()
Parameters
Returns
Promise<SentMessage<unknown>>
poll()
Parameters
Returns
Promise<SentMessage<unknown>>
buttons()
Parameters
Returns
Promise<SentMessage<unknown>>
react()
target). On a provider without
capabilities.reactions it resolves a skipped result instead of rejecting.
An empty emoji removes the reaction where the transport supports it.
Parameters
Returns
Promise<SentMessage<unknown>>
quote()
Parameters
Returns
Promise<SentMessage<unknown>>
edit()
Call Signature
ctx.edit(content), only when it has the same
content kind and no bot.send/bot.sendTo went to the chat since; replies of other
handler runs or other participants’ flows are never targeted) or a given one
(ctx.edit(ref, content); a fallback send goes to ref.chatId). Native when the provider has capabilities.edit and
editMessage; otherwise (or when the kind is not editable there) it falls back
to sending a new message — { fallback: 'skip' } sends nothing instead. Edits run
the before/after('send') hooks (payload edit: ref); a hook abort resolves skipped.
Parameters
Returns
Promise<EditResult>
Call Signature
Parameters
Returns
Promise<EditResult>
supports()
native / degraded / unsupported).
Parameters
Returns
MessagingSupport
replyWithTyping()
msPerChar ms per character (40 by default, capped at 5 s),
then send text. Ignores BotConfig.typing.
Parameters
Returns
Promise<SentMessage<unknown>>
Deprecated
Usectx.reply(text, { typing: true }) (or a TypingConfig object
such as { typing: { charsPerSecond: 25, maxMs: 5000 } }): it shares the bot-wide
typing policy, refreshes the indicator and is dropped on stop/handoff like every paced reply.
sendNative()
Parameters
Returns
Promise<SentMessage<unknown>>
stream()
capabilities.streaming):
native drafts, throttled edits, or sentence chunks with typing. Long text is
split so no message exceeds capabilities.maxTextLength. See StreamOptions.
Parameters
Returns
Promise<StreamResult>
form()?
OutboundContent kind 'form'). Only meaningful when
capabilities.forms === 'native'; other providers reject it with
UnsupportedContentError. The submission arrives as an inbound message of
type 'form' (see parseFormReply()); flow().form() handles all of this.
Set on contexts built by a Bot.
Parameters
Returns
Promise<SentMessage<unknown>>
canRenderForm()?
definition natively right now (see
IProvider.canRenderForm). Set on contexts built by a Bot whose provider
implements it; absent = assume yes when capabilities.forms === 'native'.
Parameters
Returns
boolean
markRead()
Returns
Promise<void>
typing()
Returns
Promise<void>
recording()
Returns
Promise<void>
delete()
Returns
Promise<void>
handoff()
from) over to a human: the bot stops routing its messages until
bot.resume(chatId), and any conversation in the chat is cancelled silently.
Resolves true if the chat was not already handed off. Safe to call without
awaiting (the state flips synchronously). See bot.handoff().
Parameters
Returns
Promise<boolean>
pass()
Returns
void
abort()
Returns
void
next()?
Returns
Promise<void>
t()
key (dot path) in lang, interpolating {param} placeholders;
params.count picks plural forms. Missing keys fall back to the default locale,
then to the key itself. See bot.locale().
Parameters
Returns
string
setLang()
code
('en-GB' → 'en' when only en exists) to ctx.user (key 'lang' by default)
and updates lang for this message. Rejects with TypeError on an empty code
or one no registered locale serves (nothing is stored), with Error while i18n is
not enabled (no bot.locale() call and no BotConfig.i18n), and with
UserDataError when the profile cannot be written.
Parameters
Returns
Promise<void>