Widget Actions
Actions allow widget components to trigger dynamic behaviors like sending messages, showing notifications, or making network requests.Action Format
Actions are objects with atype and optional payload:
Standard Action Types
lyzn.sendMessage
Send collected form data as a chat message.| Property | Type | Description |
|---|---|---|
message | string | Optional custom message. If omitted, sends form data as JSON |
includeFormData | boolean | Whether to include form data (default: true) |
lyzn.showToast
Display a toast notification to the user.| Property | Type | Description |
|---|---|---|
message | string | Required. Toast message text |
type | ’success’ | ‘error’ | ‘info’ | Toast type (default: ‘info’) |
lyzn.openLink
Open a URL in webview or external browser.| Property | Type | Description |
|---|---|---|
url | string | Required. URL or deeplink to open |
external | boolean | Open in external browser (default: false) |
lyzn.resetState
Reset the widget’s form state.| Property | Type | Description |
|---|---|---|
fields | string[] | Optional. Specific fields to reset. Resets all if omitted |
lyzn.fetch
Make a network request.| Property | Type | Description |
|---|---|---|
url | string | Required. Request URL |
method | string | HTTP method (default: ‘GET’) |
body | object | Request body for POST/PUT |
headers | object | Additional headers |
Using Actions
On Buttons
UseonClickAction or action prop:
On Form Components
Form components likeSelect, RadioGroup, and Checkbox support the action prop to trigger actions on value change:
On Cards
Useconfirm and cancel props to add action buttons:
Form State Management
When a form component has aname prop, it updates the widget’s form state instead of sending a message immediately:
Value Placeholders
Use{{value}} in action payloads to inject the current value:

