Skip to content

ActionWizard

Defined in: sdks/agent/src/middleware/ActionWizard.ts:74

Multi-step interactive wizard using XMTP actions and intents.

Supports two step types:

  • select — presents action buttons, the user responds by clicking one (triggers an intent)
  • text — prompts the user for free-text input

The wizard activates when a user sends /{id} (e.g. /api-setup). Sending the command again while a session is active restarts the wizard from the first step.

ContentTypes = unknown

new ActionWizard<ContentTypes>(id, options?): ActionWizard<ContentTypes>

Defined in: sdks/agent/src/middleware/ActionWizard.ts:84

Create a wizard identified by the slash command id.

string

ActionWizardOptions

ActionWizard<ContentTypes>

isActive(conversationId, senderInboxId): boolean

Defined in: sdks/agent/src/middleware/ActionWizard.ts:172

Return whether this sender has an active session in the conversation.

string

string

boolean


middleware(): AgentMiddleware<ContentTypes>

Defined in: sdks/agent/src/middleware/ActionWizard.ts:234

Return middleware that starts and advances wizard sessions.

AgentMiddleware<ContentTypes>


onCancel(handler): this

Defined in: sdks/agent/src/middleware/ActionWizard.ts:150

Register the callback invoked when a session is cancelled or restarted.

ActionWizardCancelHandler<ContentTypes>

this


onComplete(handler): this

Defined in: sdks/agent/src/middleware/ActionWizard.ts:144

Register the callback invoked after the final answer.

ActionWizardCompleteHandler<ContentTypes>

this


select(id, options): this

Defined in: sdks/agent/src/middleware/ActionWizard.ts:106

Add a button-selection step.

string

Action[]

Action buttons offered for this step.

string

Prompt shown with the action buttons.

this


start(ctx): Promise<void>

Defined in: sdks/agent/src/middleware/ActionWizard.ts:156

Start or replace the session for the message sender.

MessageContext<unknown, ContentTypes>

Promise<void>


text(id, options): this

Defined in: sdks/agent/src/middleware/ActionWizard.ts:125

Add a free-text step.

string

string

Prompt shown before the user enters text.

boolean

Send the prompt as Markdown when true.

this


static sessionKey(conversationId, senderInboxId): string

Defined in: sdks/agent/src/middleware/ActionWizard.ts:96

Build the key used to isolate one sender’s session in one conversation.

string

string

string


static stepKey(wizardId, stepId): string

Defined in: sdks/agent/src/middleware/ActionWizard.ts:101

Build the action id used for a wizard step.

string

string

string