Sending Interactions
Usehandler.sendInteractionRequest() to send interactive UI elements to users. The method takes a channel ID and a payload object that defines the interaction type.
Forms (Buttons & Text Inputs)
Forms display buttons and text inputs that users can interact with. Use forms for menus, confirmations, polls, feedback collection, and multi-step flows. Setrecipient to target a specific user, or omit it for public interactions anyone can respond to.
| Type | Properties |
|---|---|
button | id, type: 'button', label |
textInput | id, type: 'textInput', placeholder |
Transaction Requests
Prompt users to sign and execute blockchain transactions from their wallets. Use transactions for payments, token transfers, NFT minting, contract interactions, and DeFi operations. Settx.signerWallet to require a specific wallet, or omit it to let users choose.
Signature Requests
Request cryptographic signatures without executing transactions. Use signatures for authentication, permissions, off-chain agreements, and gasless interactions. Supports EIP-712 typed data ('typed_data') and personal sign ('personal_sign').
Handling Responses
Usebot.onInteractionResponse() to handle user interactions. This callback fires whenever a user clicks a button, submits a form, completes a transaction, or signs a message.
Available properties:
event.userId- The user who respondedevent.channelId- Channel where interaction occurredevent.response.payload.content?.case- Type:'form','transaction', or'signature'event.response.payload.content?.value- Response data
Complete Example: Poll
Reference
Form Request
| Field | Type | Required | Description |
|---|---|---|---|
type | 'form' | Yes | Interaction type |
id | string | Yes | Unique ID for matching responses |
components | array | Yes | Buttons and text inputs |
recipient | string | No | Target user address (omit for public) |
Transaction Request
| Field | Type | Required | Description |
|---|---|---|---|
type | 'transaction' | Yes | Interaction type |
id | string | Yes | Unique ID for matching responses |
title | string | Yes | Heading shown to user |
subtitle | string | Yes | Description of transaction |
tx.chainId | string | Yes | Chain ID (e.g., '8453' for Base) |
tx.to | string | Yes | Contract or recipient address |
tx.value | string | Yes | ETH amount in wei |
tx.data | string | Yes | Encoded function call |
tx.signerWallet | string | No | Required wallet (omit for user choice) |
recipient | string | No | Target user address |
Signature Request
| Field | Type | Required | Description |
|---|---|---|---|
type | 'signature' | Yes | Interaction type |
id | string | Yes | Unique ID for matching responses |
chainId | string | Yes | Chain ID |
data | string | Yes | JSON stringified EIP-712 typed data |
method | string | Yes | 'typed_data' or 'personal_sign' |
signerWallet | string | Yes | Wallet address to sign |
title | string | No | Heading shown to user |
subtitle | string | No | Description |
recipient | string | No | Target user address |
Next Steps
- Learn about onchain integrations for bot blockchain operations
- Explore slash commands
- Read about event handlers