When to use it
Context Sync works when the YuAskMe chat widget is embedded on a page you control, such as your online ordering or booking site. Your page sends data to the widget, and the AI uses it in its answers.
- A customer places an order and later asks the chatbot about it.
- You want the AI to know about a customer's reservation, tier, or points.
Enable it
Context Sync is off by default for each workspace.
- In the dashboard, go to Settings → Chatbot → Widget Configuration.
- Set External Context Sync to Enabled and save.
Sync data
The widget script adds one function to your page:
js
window.yuaskmeSyncContext(contextType, data);
// When several YuAskMe widgets are on one page, name the workspace:
window.yuaskmeSyncContext(contextType, data, identifier);| Parameter | Type | Description |
|---|---|---|
contextType | string | A name for the data, e.g. orders, reservation, customer |
data | any | The data itself: an object, array, or simple value |
identifier | string (optional) | Workspace identifier. Defaults to the widget's own; pass it when a page has several widgets |
Call it whenever the data changes. The latest value for each contextType is sent with the customer's next message.
Examples
js
// After the customer places an order
window.yuaskmeSyncContext("orders", [
{
id: "ORD-001",
status: "preparing", // pending | preparing | ready | delivered
items: [
{ name: "Pork Humba", quantity: 2, price: 150 },
{ name: "Iced Tea", quantity: 1, price: 50 },
],
total: 350,
},
]);
// A reservation
window.yuaskmeSyncContext("reservation", {
date: "2026-06-01",
time: "7:00 PM",
guests: 4,
table: "Table 3",
});
// Loyalty details
window.yuaskmeSyncContext("customer", { tier: "gold", points: 1240 });You can also send it with postMessage:
js
window.postMessage(
{
type: "yuaskme_context_sync",
contextType: "orders",
data: [/* ... */],
identifier: "my-restaurant-identifier", // optional
},
window.location.origin,
);How the AI uses it
- Order status questions ("what's my order?") get a formatted order card straight from your
ordersdata, without an AI call. With no orders synced, the chatbot says it doesn't see any active orders. - Everything else ("when is my reservation?"): the synced data is added to the AI's context, and it uses it in a natural reply.
Security
- Data only reaches the widget whose workspace identifier matches, so two businesses' widgets on one page can't see each other's data.
- When Context Sync is disabled, both the widget and the server ignore synced data.
The sync call isn't authenticated: anything running on your page can call it. Only sync data the signed-in customer is already allowed to see, and never send passwords, card numbers, or other secrets.
Something unclear or out of date? Report a docs issue.
YuAskMe