Skip to content

ActionWizard

Defined in: sdks/js/agent-sdk/src/middleware/ActionWizard.ts:78

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/js/agent-sdk/src/middleware/ActionWizard.ts:88

Create a wizard identified by the slash command id.

string

ActionWizardOptions

ActionWizard<ContentTypes>

isActive(conversationId, senderInboxId): boolean

Defined in: sdks/js/agent-sdk/src/middleware/ActionWizard.ts:176

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

string

string

boolean


middleware(): AgentMiddleware<ContentTypes>

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

Return middleware that starts and advances wizard sessions.

AgentMiddleware<ContentTypes>


onCancel(handler): this

Defined in: sdks/js/agent-sdk/src/middleware/ActionWizard.ts:154

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

ActionWizardCancelHandler<ContentTypes>

this


onComplete(handler): this

Defined in: sdks/js/agent-sdk/src/middleware/ActionWizard.ts:148

Register the callback invoked after the final answer.

ActionWizardCompleteHandler<ContentTypes>

this


select(id, options): this

Defined in: sdks/js/agent-sdk/src/middleware/ActionWizard.ts:110

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/js/agent-sdk/src/middleware/ActionWizard.ts:160

Start or replace the session for the message sender.

MessageContext<unknown, ContentTypes>

Promise<void>


text(id, options): this

Defined in: sdks/js/agent-sdk/src/middleware/ActionWizard.ts:129

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/js/agent-sdk/src/middleware/ActionWizard.ts:100

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

string

string

string


static stepKey(wizardId, stepId): string

Defined in: sdks/js/agent-sdk/src/middleware/ActionWizard.ts:105

Build the action id used for a wizard step.

string

string

string