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.
Type Parameters
Section titled “Type Parameters”ContentTypes
Section titled “ContentTypes”ContentTypes = unknown
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”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.
Parameters
Section titled “Parameters”string
options?
Section titled “options?”Returns
Section titled “Returns”ActionWizard<ContentTypes>
Methods
Section titled “Methods”isActive()
Section titled “isActive()”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.
Parameters
Section titled “Parameters”conversationId
Section titled “conversationId”string
senderInboxId
Section titled “senderInboxId”string
Returns
Section titled “Returns”boolean
middleware()
Section titled “middleware()”middleware():
AgentMiddleware<ContentTypes>
Defined in: sdks/js/agent-sdk/src/middleware/ActionWizard.ts:234
Return middleware that starts and advances wizard sessions.
Returns
Section titled “Returns”AgentMiddleware<ContentTypes>
onCancel()
Section titled “onCancel()”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.
Parameters
Section titled “Parameters”handler
Section titled “handler”ActionWizardCancelHandler<ContentTypes>
Returns
Section titled “Returns”this
onComplete()
Section titled “onComplete()”onComplete(
handler):this
Defined in: sdks/js/agent-sdk/src/middleware/ActionWizard.ts:148
Register the callback invoked after the final answer.
Parameters
Section titled “Parameters”handler
Section titled “handler”ActionWizardCompleteHandler<ContentTypes>
Returns
Section titled “Returns”this
select()
Section titled “select()”select(
id,options):this
Defined in: sdks/js/agent-sdk/src/middleware/ActionWizard.ts:110
Add a button-selection step.
Parameters
Section titled “Parameters”string
options
Section titled “options”actions
Section titled “actions”Action[]
Action buttons offered for this step.
description
Section titled “description”string
Prompt shown with the action buttons.
Returns
Section titled “Returns”this
start()
Section titled “start()”start(
ctx):Promise<void>
Defined in: sdks/js/agent-sdk/src/middleware/ActionWizard.ts:160
Start or replace the session for the message sender.
Parameters
Section titled “Parameters”MessageContext<unknown, ContentTypes>
Returns
Section titled “Returns”Promise<void>
text()
Section titled “text()”text(
id,options):this
Defined in: sdks/js/agent-sdk/src/middleware/ActionWizard.ts:129
Add a free-text step.
Parameters
Section titled “Parameters”string
options
Section titled “options”description
Section titled “description”string
Prompt shown before the user enters text.
isMarkdown?
Section titled “isMarkdown?”boolean
Send the prompt as Markdown when true.
Returns
Section titled “Returns”this
sessionKey()
Section titled “sessionKey()”
staticsessionKey(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.
Parameters
Section titled “Parameters”conversationId
Section titled “conversationId”string
senderInboxId
Section titled “senderInboxId”string
Returns
Section titled “Returns”string
stepKey()
Section titled “stepKey()”
staticstepKey(wizardId,stepId):string
Defined in: sdks/js/agent-sdk/src/middleware/ActionWizard.ts:105
Build the action id used for a wizard step.
Parameters
Section titled “Parameters”wizardId
Section titled “wizardId”string
stepId
Section titled “stepId”string
Returns
Section titled “Returns”string

