Context Item Format
This format is shared by page context and individual message context.
Pass only data this visitor is allowed to see. Do not include secrets, tokens, or payment data. Context does not grant permission to perform actions.
Describe Each Item
| Field | Type | Required | What to pass |
|---|---|---|---|
id |
string |
Yes | Stable item ID, such as order:123. |
kind |
string |
Yes | Entity type, such as page, order, or product. |
role |
string |
Yes | Item purpose from the list below. |
hidden |
boolean |
No | true hides the item in the widget UI. Defaults to false. Data remains stored and is sent to the agent. |
display.label |
string |
Yes | Short, readable chip label. |
display.subtitle |
string |
No | Additional explanation in the chip. |
display.icon |
string |
No | A supported icon name, such as box for an order or workflow for an automation. See the list below. |
display.avatar_url |
string |
No | Image URL to display instead of the icon. If the image fails to load, the widget displays the icon. |
ref |
object |
No | Stable IDs, a route, or URL used to locate the current object. |
snapshot |
object |
No | Object values captured at send time. |
payload |
object |
No | Additional JSON data defined by your integration. |
role value |
When to use it |
|---|---|
technical |
The current page or a service part of the scenario. |
user_selected |
An object explicitly selected by the visitor. |
business_context |
The order, product, project, or other business object in the question. |
action_target |
The object that the visitor intends to change. |
A role describes the purpose of an item; it does not grant permission to perform an action. After persistent context, one-time context, and a selected element are combined, a message must contain no more than 12 items.
Limits: id up to 120 characters, kind up to 80, display.label up to 80, display.subtitle up to 140, display.icon up to 40, and display.avatar_url up to 2048. ref, snapshot, and payload must be JSON-compatible objects.
Hidden context
To send data to the agent without a chip beside the message, add hidden: true to the item:
{
id: "order:123",
kind: "order",
role: "business_context",
hidden: true,
display: { label: "Order 123" },
payload: { orderId: 123, status: "processing" },
}
The flag works for persistent page context and one-time contextItems, including ask({ text, contextItems }). An array can mix visible and hidden items. Hidden items do not appear in the context menu, counts, or message chips, including after reloading history. Sending, retrying, and delivery to the agent preserve the complete context.
hidden controls widget presentation: the data remains in the API and server-side history. display.label is required even for hidden items, and hidden items count toward the total limit of 12. false or an omitted flag means normal display. The technical role does not hide an item by itself.
In Dialogs, operators see all context items. For an item with hidden: true, “Hidden in widget” appears inside its expanded dropdown; the chip itself keeps only the name. Sending a message requires text or an attachment: context alone, visible or hidden, cannot send an empty message.
Item icon
For example, pass this item in contextItems for an order:
{
id: "order:123",
kind: "order",
role: "business_context",
display: {
label: "Order 123",
icon: "box",
},
ref: { url: "/orders/123" },
}
Supported display.icon values:
activity, app-window, blocks, book-headphones, book-open, bot,
bot-message-square, box, braces, chart-column-increasing,
chart-no-axes-column, chart-no-axes-combined, component, credit-card,
file-text, filter, folder, history, key-round, layers-3, lightbulb,
link-2, list-checks, list-filter, mail, messages-square, mouse-pointer,
panels-top-left, plug, radio, radio-tower, scan-text, scroll-text,
send, server, settings-2, shield-user, sparkle, table, tag, user,
user-round, user-round-check, user-round-cog, users, variable,
webhook, workflow, wrench
If the name is unsupported or display.icon is omitted, the widget chooses an icon from kind, then ref.entity_type. If neither type is recognized, it displays a tag icon. Arbitrary icon-library names and SVG code are not supported.
Page links from history
To link from a tag, provide ref.url or ref.route. A non-empty ref.url takes priority. When passed through the loader, a relative address such as /orders/123 becomes an absolute URL relative to your website's page. A link in the saved conversation therefore opens the order on your website, not the same path inside Senler.
When passing data directly without the loader, use a full URL starting with https:// or http://. If saved context contains only a relative route without a domain, it cannot be opened as a link: the original website cannot be identified reliably. Other protocols, including javascript:, do not become links in history. The context itself remains available to read.
Check the Chips Before Sending
Use IDs such as page:/orders/123, project:019..., and order:123. If the same object comes from both page context and contextItems, a matching id leaves one tag. Give different entities different kind and id values even when their labels are similar.
When sending from the composer, persistent context, one-time draft context, and selected-element context are combined in that order and deduplicated by id: a later item with the same ID replaces the earlier one. A one-time item can therefore refine a persistent item, and the selected element can refine either. Before sending, the visitor can open Context in the message field and remove an unwanted visible item with the cross in its row.
For a programmatic ask(), pass the required array explicitly in contextItems. Chips from contextProvider, setPageContext, the draft, and element selection are not included automatically. The request also receives JSON context from setContext and its own context option.
After sending, visible chips appear in dialog history as read-only information. They can be expanded and, when links are supplied, open ref.url or ref.route. Only supported details are displayed, so do not rely on every arbitrary payload field being visible.