Skip to content

WidgetsOption

type WidgetsOption = {
onAction?: (
action: {
payload?: Record<string, unknown>;
type: string;
},
widgetItem: {
id: string;
widget: Card | ListView;
},
) => Promise<void>;
};
optional onAction: (action: {
payload?: Record<string, unknown>;
type: string;
}, widgetItem: {
id: string;
widget: | Card
| ListView;
}) => Promise<void>;

Called when a widget action is triggered. See https://openai.github.io/chatkit/guides/widget-actions/ for details.

Parameter Type

action

{ payload?: Record<string, unknown>; type: string; }

action.payload?

Record<string, unknown>

action.type

string

widgetItem

{ id: string; widget: | Card | ListView; }

widgetItem.id

string

widgetItem.widget

| Card | ListView

Promise<void>