Skip to content

Step: Add Widget to Message

  • Key: add-widget-to-message
  • Category: Widgets
  • Description: Attach a custom widget to the assistant response message and prefill its initial state.

Inputs

  • widgetId (select, required): Widget to attach from your workspace widgets.
  • initialState (object, optional): Initial state passed to the widget. Values support template rendering and are normalized against the widget's initial state schema when one exists.

Outputs

  • messageWidgetId (string): ID of the created message widget record.
  • widgetId (string): ID of the attached widget.
  • widgetName (string): Name of the attached widget.
  • initialState (object): Initial state stored for the widget.

Notes

  • This step requires responseMessageId in the flow context, so it is intended for peer/chat executions.
  • Custom widgets are managed in workspace widget settings.
  • Use initialState to prefill charts, tables, product cards, forms, or other interactive UI with data from previous steps.

Example Use Case

After an agent step retrieves a list of products:

  1. Use add-widget-to-message with a product grid widget.
  2. Set initialState.products from the agent output.
  3. The user sees the text response and the interactive widget in the same message.

Built with VitePress