Setting Up Dynamic Context Ingestion

Last updated: July 22, 2026

Configure Dynamic Context Ingestion when your website should pass known visitor information to a Marketing Agent before a conversation starts.

Before You Begin

  • Create the Marketing Agent.

  • Install the Docket widget script on the website where you will send context.

  • Identify the smallest set of visitor fields the agent needs.

  • Decide how the agent should use each field.

Open Dynamic Context Ingestion

  1. Open Marketing Agent Configuration.

  2. Select the agent.

  3. Open the Agent tab.

  4. Expand Dynamic Context Ingestion.

  5. Turn on the Dynamic Context Ingestion switch.

Dynamic Context Ingestion controls with the enable switch, configured variables, and Add Variable action highlighted

Add a Variable

Add Variable control in the real Dynamic Context Ingestion panel
  1. Select Add Variable.

  2. Enter the key your website will send, such as company_name.

  3. Add a description explaining what the value means and how the agent should use it.

  4. Save the variable.

Keep variable names stable and match them exactly in your website code. Use clear descriptions such as: "This is the visitor's company. Use it to make examples relevant, but do not repeat it unnecessarily."

Pass Context from Your Website

Call setContext() before the conversation starts and inspect the returned result.

const result = await window.AISeller.setContext({
  name: "Jordan",
  company_name: "Northstar Labs",
  isCustomer: true
});

if (result.success) {
  window.AISeller.showAndConnect();
} else {
  console.warn(result.message);
}

Values must be strings, numbers, booleans, or null. Nested objects, arrays, files, functions, dates, and undefined values are rejected.

Reset Context

Call resetContext() when the visitor logs out, changes identity, or when stored context is no longer valid.

const result = await window.AISeller.resetContext();

Resetting prepares an empty context object for the next conversation. It does not change a conversation already in progress.

Verify the Setup

  1. Open the deployed experience in a private browser window.

  2. Call setContext() with documentation-only values.

  3. Confirm the returned success value is true.

  4. Start a new conversation.

  5. Ask a question that should use one configured variable.

  6. Confirm the agent uses the value according to its description.

  7. Reset context and confirm the next conversation does not reuse the previous values.

Troubleshooting

Problem

What to check

A variable is ignored

Confirm the JavaScript key exactly matches the variable configured in Docket.

success is false

Read result.message and confirm every value is a supported simple type.

Context appears one conversation late

Call setContext() before the conversation starts.

Old visitor data appears

Call resetContext() when identity changes.

window.AISeller is unavailable

Confirm the Docket widget script loaded before your code runs.

Related Articles