Skip to main content
Defined in: core/provider.ts:972 The ergonomic context handed to every handler. Generic over 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

Defined in: core/provider.ts:974

from

Defined in: core/provider.ts:975

sender

Defined in: core/provider.ts:976

senderInfo

Defined in: core/provider.ts:977

pushName?

Defined in: core/provider.ts:978

chat

Defined in: core/provider.ts:979

type

Defined in: core/provider.ts:980

isGroup

Defined in: core/provider.ts:981

isPrivate

Defined in: core/provider.ts:982

isFromMe

Defined in: core/provider.ts:983

mentions

Defined in: core/provider.ts:984

quoted?

Defined in: core/provider.ts:985

media?

Defined in: core/provider.ts:986

sharedLocation?

Defined in: core/provider.ts:991 The location the user shared (type === 'location'), normalized by the provider; undefined otherwise. Named sharedLocation because ctx.location() SENDS one.

ref

Defined in: core/provider.ts:992

raw

Defined in: core/provider.ts:993

timestamp

Defined in: core/provider.ts:998 When the message was sent, in epoch milliseconds (new Date(ctx.timestamp) works). A provider that still reports epoch seconds is converted.

interaction?

Defined in: core/provider.ts:1007 Present only when this context projects an interaction (Telegram/Discord). 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?

Defined in: core/provider.ts:1014 Present only on the context the CALL trigger receives (type === 'call'): the provider’s normalized call notification.

capabilities?

Defined in: core/provider.ts:1093 Capabilities of the provider this message came from (set on contexts built by a Bot).

textFormat?

Defined in: core/provider.ts:1099 Rich-text dialect of THIS chat: the provider’s 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

Defined in: core/provider.ts:1126 Persistent profile of the sender (ctx.sender), shared across chats — see UserData. ctx.user.ns('game') scopes it to a namespace.

lang

Defined in: core/provider.ts:1132 Resolved language of this message (normalized locale code, e.g. 'es', 'en'). Order: ctx.user preference → provider-reported language → i18n.detect → default.

defaultLang?

Defined in: core/provider.ts:1138 The bot’s default locale (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?

Defined in: core/provider.ts:1145 Where lang came from ('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

Defined in: core/provider.ts:1162

Methods

acknowledge()

Defined in: core/provider.ts:1008

Parameters

Returns

Promise<void>

say()

Defined in: core/provider.ts:1023 Send text to this chat. Same as MessageContext.reply.

Parameters

Returns

Promise<SentMessage<unknown>>

Deprecated

Use MessageContext.reply (ctx.reply(text)). The flow DSL’s .say() step is not affected.

reply()

Defined in: core/provider.ts:1025 Send text to this chat (ctx.from). The canonical text reply.

Parameters

Returns

Promise<SentMessage<unknown>>

answer()

Defined in: core/provider.ts:1027

Parameters

Returns

Promise<SentMessage<unknown>>

Deprecated

Use MessageContext.reply (ctx.reply(text)).

text()

Defined in: core/provider.ts:1029

Parameters

Returns

Promise<SentMessage<unknown>>

Deprecated

Use MessageContext.reply (ctx.reply(text)).

photo()

Defined in: core/provider.ts:1030

Parameters

Returns

Promise<SentMessage<unknown>>

video()

Defined in: core/provider.ts:1031

Parameters

Returns

Promise<SentMessage<unknown>>

audio()

Defined in: core/provider.ts:1032

Parameters

Returns

Promise<SentMessage<unknown>>

voice()

Defined in: core/provider.ts:1033

Parameters

Returns

Promise<SentMessage<unknown>>

file()

Defined in: core/provider.ts:1034

Parameters

Returns

Promise<SentMessage<unknown>>

sticker()

Defined in: core/provider.ts:1035

Parameters

Returns

Promise<SentMessage<unknown>>

location()

Defined in: core/provider.ts:1036

Parameters

Returns

Promise<SentMessage<unknown>>

contact()

Defined in: core/provider.ts:1037

Parameters

Returns

Promise<SentMessage<unknown>>

poll()

Defined in: core/provider.ts:1038

Parameters

Returns

Promise<SentMessage<unknown>>

buttons()

Defined in: core/provider.ts:1039

Parameters

Returns

Promise<SentMessage<unknown>>

react()

Defined in: core/provider.ts:1045 React to the inbound message (or 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()

Defined in: core/provider.ts:1046

Parameters

Returns

Promise<SentMessage<unknown>>

edit()

Call Signature

Defined in: core/provider.ts:1056 Edit this context’s own last reply (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

Defined in: core/provider.ts:1057
Parameters
Returns
Promise<EditResult>

supports()

Defined in: core/provider.ts:1059 How the current provider supports a messaging feature (native / degraded / unsupported).

Parameters

Returns

MessagingSupport

replyWithTyping()

Defined in: core/provider.ts:1068 Show “typing…” for about msPerChar ms per character (40 by default, capped at 5 s), then send text. Ignores BotConfig.typing.

Parameters

Returns

Promise<SentMessage<unknown>>

Deprecated

Use ctx.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()

Defined in: core/provider.ts:1070 Escape hatch for transport-native content (templates, components).

Parameters

Returns

Promise<SentMessage<unknown>>

stream()

Defined in: core/provider.ts:1077 Stream a reply that is still being generated (e.g. LLM tokens) to this chat, using the best strategy the provider supports (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()?

Defined in: core/provider.ts:1085 Send a native 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()?

Defined in: core/provider.ts:1091 Whether the provider can render 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()

Defined in: core/provider.ts:1102

Returns

Promise<void>

typing()

Defined in: core/provider.ts:1104 Show the typing indicator. Best-effort: never rejects (a provider failure is logged at debug).

Returns

Promise<void>

recording()

Defined in: core/provider.ts:1106 Show the recording-audio indicator. Best-effort like typing.

Returns

Promise<void>

delete()

Defined in: core/provider.ts:1107

Returns

Promise<void>

handoff()

Defined in: core/provider.ts:1115 Hand this chat (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()

Defined in: core/provider.ts:1118

Returns

void

abort()

Defined in: core/provider.ts:1119

Returns

void

next()?

Defined in: core/provider.ts:1120

Returns

Promise<void>

t()

Defined in: core/provider.ts:1151 Translate 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()

Defined in: core/provider.ts:1160 Switch the sender’s language: persists the registered locale serving 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>