The Whisky Exchange
Integration preview / V2

FOR THE TWE DEVELOPMENT TEAM

Integration workbench

Developer Mode

Public API

Demo basket only. Recommendations always come from Constructor.

Event console 0

Every named callback is mirrored here through onEvent. Select an event to inspect its payload and Constructor identifiers.

Event Console (Raw) 0 events / 0 requests

Loading raw capture…

Native EventSource events (original data strings) — Constructor responses observed before SDK processing, not onEvent callbacks or a byte-for-byte SSE capture. Passive listeners observe the same native request; transport, parsing and rendering are unchanged. Status unavailable via EventSource. Only event types the SDK subscribes to can be observed; unregistered types, SSE comments, framing and incomplete frames are unavailable. An end row means a real native event was observed, not an inferred SDK close.

Expand a request, then an event, for full event data, products and metadata. Match Turn labels and intent_result_id across both consoles. Receipt timestamps include milliseconds; application timestamps above are later callback times. Request URLs retain supplied domain, guard, thread_id, num_result_events and num_results_per_event; these counts are limits, not promises. Sensitive values are redacted consistently; no request headers or bodies are logged. BFF responses are captured without additional upstream requests. Use synthetic prompts, not customer information.

INTEGRATION REFERENCE

Host Application Callbacks

Callbacks available to the host application when integrating the AI Shopping Agent.

Example host integration

Complete example: all callbacks and onEvent

IMPLEMENTATION

Host Application Integration

Production-ready embed

Use the shared ContainerInit embed to render the introduction, quick links and existing chatbot. One script loads missing dependencies automatically; no host React installation, separate chatbot mount or manual launcher is required.

Required assets

Load the versioned ASA script shown below. TWE shared CSS, images and fonts are served by TWE; the loader adds only missing dependencies.

  • https://asa-demo.thewhiskyexchange.com/twe-shopping-agent.js

No separate React, configuration file or package installation is required for the published TWE bundle.

The component inherits original TWE CTA and quick-link appearance, with scoped ASA layout overrides. Font CORS must permit the demo origin.

Initialisation and callbacks

window.TweShoppingAgent.ContainerInit(options)
Renders into twe-asa-container. Returns the shared controller with a ready promise. Repeated calls return the same handle; first-call options win until destroy. Legacy create()/init() remain supported.
Agent name and visible copy
Are resolved by the React application from its central content settings. Optional host controls include dialogWidth, persistence, debug, basketUiMode and asaRequestConfig.
config.EnableBetaFeedbackForms
Shows the temporary name suggestion and feedback forms. It defaults to true; set it to false to remove the whole feature.
events.onAgentOpen(event)
Registers a named callback. The corresponding event envelope has eventName: "agent_open".
onEvent(event)
Receives every event after its named callback. See the callback reference above for the complete event list.

Public instance methods

open(), close(), expand(), restore(), setDialogWidth(width), resetConversation() and destroy().

The application loads its approved runtime settings from the BFF. Hosts must not supply Constructor credentials or upstream URLs.

twe-shopping-agent.js contains the React application used by the host page. Load it before initialising or calling the AI Shopping Agent. See the configuration and callback references above for all supported options.