This tutorial shows how to trigger a user tour flow in a userโs active browser session from your backend. The flow is:Documentation Index
Fetch the complete documentation index at: https://developers.autoplay.ai/llms.txt
Use this file to discover all available pages before exploring further.
- Register your product with Autoplay.
- Subscribe your frontend to the product event stream with
EventSource. - Create a server endpoint that publishes a
usertour_triggerevent for a specific user session and flow.
Prerequisites
- An Autoplay product ID.
- A registered Autoplay product with stream credentials.
- Your chosen user tour provider installed and initialized in your frontend.
- A way to identify the active browser session. Autoplay uses the PostHog session ID in the examples below.
- The flow ID you want to start (from your tour providerโs dashboard).
- product_id:
{product_id_entered} - webhook_url:
https://{connecter-url}/webhook/{product_id} - stream_url:
https://{connecter-url}/stream/{product_id} - webhook_secret:
{secret} - unkey_key:
{secret}
2. Proxy the Stream (Security)
To keep yourunkey_key hidden from users, do not connect the browser directly to Autoplay.
Instead, create a server-side route. This acts as the bridge between Autoplay and your frontend while keeping your credentials secure.
3. Connect the Event Stream
Use the standardEventSource API to listen to your proxy route.
4. Understanding the Payload
The โlast mileโ is handling the data that arrives through the stream. When a tour is triggered, your frontend receives a JSON object. You need to verify thesession_id to ensure the tour starts for the correct user.
Payload structure
When ausertour_trigger event hits your stream, event.data looks like this:
- Check the type โ ensure
type === "usertour_trigger". - Match the session โ compare
payload.session_idwith the current userโs session ID (e.g. from PostHog). - Trigger the tour โ if they match, pass
flow_idto your tour providerโs SDK.











