Optionalbackend: Pick<CrashableBackend, "crashed">ReadonlyidStable transport tag (e.g. 'baileys', 'telegram') — used to namespace conversation keys if one Bot ever runs multiple providers concurrently.
ReadonlycapabilitiesThe bot's own user id once connected (for group mention matching). Optional.
Chronological journal of inbound messages/interactions (as emitted, before any chaos
wrapper) and of every send with the ref it returned. Bounded by maxJournal.
Edits recorded by editMessage (enabled by streaming 'edit'/'draft' or supports.edit).
Draft previews recorded by sendDraft (enabled by streaming: 'draft' or supports.drafts).
Messages deleted through deleteMessage (enabled by streaming not 'none' or supports.delete).
Interaction acks recorded by acknowledgeInteraction, in order.
OptionaltextPer-chat text format — present only when MockProviderOptions.textFormatFor is given.
ReadonlymaxJournal cap (MockProviderOptions.maxJournal).
start() calls so far.
stop() calls so far.
Records the edit in edits. Hidden (undefined) unless enabled — see MockProviderOptions.supports.
Records the ack in acks (button/callback interactions).
Optionalopts: { text?: string; defer?: boolean }Records the ref in deleted. Hidden (undefined) unless enabled — see MockProviderOptions.supports.
Records the draft in drafts. Hidden (undefined) unless enabled — see MockProviderOptions.supports.
Optionalopts: DraftOptionsSimulate the user pressing "stop" on the latest draft that offered it.
Subscribe to the normalized event stream. Returns an unsubscriber.
Bytes of a simulated media: a copy of the bytes behind the ref (incomingMedia,
chat.sendMedia); an empty buffer for a legacy token: null ref
(incoming(text, { type: 'image' })). A { url } token without bytes rejects with
MediaUnavailableError — the mock never touches the network.
Optionalref: MediaRefForget the journal (the seq counter keeps growing; outbox is untouched).
Simulate an inbound media message (type: kind, body = caption). source bytes are
what downloadMedia returns; { url } alone is metadata only, and the download
then rejects with MediaUnavailableError.
Simulate a shared location (type: 'location', ctx.sharedLocation). The body is
the place name, else the address, else '' — as the real providers set it.
Simulate a UI interaction (button/list row/slash command; kind defaults to 'button').
Simulate a reaction to a message (bot.on('reaction'), 'reaction' hooks). to is
the reacted message; the sender defaults to from (the chat), as in a DM.
Simulate an inbound call notification (what bot.on('call') and the CALL
trigger receive). Reuse the same id to emit later updates of one call. For a
group call pass chatId (the group) and isGroup: true; from is the caller.
Stop delivering sends: every later send hangs forever.
Send normalized content. Rejects with a typed error (section 8) on failure.
Optionaloptions: SendOptions
A MockProvider whose sends hang once
crash()was called (or oncebackendcrashed).