Skip to main content

⚡ Add this skill

One command

Add the Autoplay Ada skill for an existing Ada AI support agent setup.
View the docs →

Agent onboarding

Fetch this skill when a customer already uses Ada and wants its AI support agent to consume Autoplay live user activity.
View the skill →
Pull a user’s live activity from Autoplay on demand and inject it into Ada’s AI Agent via metaFields — so every conversation is grounded in what the user is actually doing in your product.

✨ Final result

No idea the user has already done this manually 9 times. Forces a follow-up.
How this works — PostHog or Amplitude sends events to Autoplay’s ingest endpoint as users act in your product. There’s no stream to subscribe to: your backend pulls a user’s recent activity on demand — a single REST call to Autoplay’s live-activity endpoint, keyed by product_id + user_id — the moment a user opens Ada. That response is formatted into metaFields and passed to the Ada embed before — or during — a chat session. Ada’s AI Agent reads these variables inside your bot’s Processes to personalise responses.

📋 Prerequisites

Before starting, confirm the following:
  • Ada already integrated on your web app — the Ada embed script is installed, your bot handle is configured, and Ada is opening chat sessions successfully.
  • PostHog or Amplitude already set up — complete the Quickstart first, with posthog.identify(user.id) (or amplitude.setUserId(user.id)) setting a stable user_id on login.
  • Your product_id and mcp_key — printed by onboard_product in the Quickstart.
  • autoplay-sdk installedpip install autoplay-sdk
  • A backend you can add one route to — FastAPI is shown below, but any framework that can make an outbound HTTP call works.
How identity works — Autoplay keys a user’s live activity by the stable user_id your activity source identifies them with — the same id you pass to posthog.identify(user.id) or amplitude.setUserId(user.id). There’s no session id in the read API: every lookup is GET /users/{product_id}/{user_id}/live-activity, scoped only by product and user.When the user opens Ada, your frontend passes that same user_id to your /context/{user_id} endpoint (Step 2 below), which fetches their live activity and returns it as metaFields.If a user is anonymous (not yet identified), your activity source still records events under an anonymous id — Autoplay will have context for that id, but it won’t be linked to a real user account until you call identify / setUserId.
How the pieces fit: your app identifies the user in PostHog/Amplitude → Autoplay stores activity under that user_id → your frontend passes the same user_id to /context/{user_id} before opening Ada → the returned metaFields are populated with that user’s real activity.

The building blocks

  1. Define Variables in Ada — Create the Variables your bot Processes will read. Done once in the Ada dashboard.
  2. Serve context to the Ada SDK — Expose a lightweight endpoint that pulls a user’s live activity from Autoplay on demand (a single REST call — no listener process, no local cache) and passes it as metaFields.
  3. Use Variables in your Ada Processes (Step 2 — coming soon) — Reference the injected variables in your bot’s Process conditions and responses.

🔧 Step 1 — Define Variables in Ada

When you pass metaFields to the Ada embed, those keys become Variables your bot Processes can read. Create these in your Ada dashboard under Build → Variables → + New Variable.
Variable name (= metaFields key)TypeDescription
user_idStringStable id from your activity source — keys the backend lookup
current_pageStringURL the user is on, taken from their most recent action
recent_actionsStringUser’s recent in-app actions as a numbered list
Ada metaFields keys must not include whitespace, emojis, special characters, or periods. Use underscores as shown above. Keys are case-sensitive and must match exactly between the backend response and the frontend metaFields object.
We dropped session_summary from this table. The live-activity endpoint already returns a bounded, recent window (the limit query param), so there’s no separate summarisation step to run or store. If you want a narrative summary for longer histories, generate it inside your own /context/{user_id} handler and add it back as a metaField — it’s optional, not required for this integration to work.

🌐 Step 2 — Serve context to the Ada SDK

Your backend exposes one route: GET /context/{user_id}. It calls Autoplay’s live-activity endpoint synchronously, formats the result, and returns it. No stream to consume, no worker process, no Redis — the call happens the moment your frontend needs it.

Install dependencies

FastAPI context endpoint

Protect this endpoint in production. Validate with a session cookie or short-lived signed token tied to the logged-in user — not the raw user_id alone, which would let any caller read any user’s context.

Add the Ada embed script

Add data-lazy to your Ada embed script. This prevents Ada from initialising until you call adaEmbed.start(), so you can fetch the user’s live activity context first and pass it in on the first open.

Open Ada with live context


📋 What the context looks like

The recent_actions string your /context/{user_id} endpoint builds from the live-activity response (Ada reads this as a Variable):

📣 Useful Ada events to subscribe to

Wire these in onAdaEmbedLoaded for guaranteed delivery:
Event keyWhenUseful for
ada:end_conversationUser closes or ends chatClear or archive session context on the backend
ada:agent:joinedLive agent joinsStop pushing setMetaFields updates (human agent has context)
ada:agent:leftLive agent leavesResume setMetaFields updates
ada:conversation:messageNew message receivedPush a fresh context snapshot via setMetaFields
ada:minimize_chatUser minimises chatPause non-critical context updates

Next: Step 2 — Define proactive triggers (coming soon)Step 2 will cover using Autoplay’s proactive trigger system to automatically open Ada with a targeted greeting when a user performs a high-signal action — for example, surfacing a retention message when recent_actions indicates cancellation intent.