Skip to main content

1. Create your account and API key

Register for AdMesh, complete onboarding, and select Bridge in your platform’s ad formats. Create an API key in the dashboard.

2. Install the SDK

3. Wrap your chat with AdMeshProvider

Use a unique sessionId for each conversation and keep it unchanged across turns.
Implement these callbacks in your chat and pass them to recommendations below each assistant response. Use the original user query and its user message ID.
  • handleDelegationConsent(recommendation): show your consent dialog using the supplied consent requirements. Return true only when the user agrees, or false when they decline.
  • handleDelegationActivated(payload): save the delegation_session_id, brand details, and mcp_endpoint in your host’s session state, then activate your backend’s brand runtime.
The SDK calls activation after consent. Your app must implement the dialog and runtime connection; rendering the component alone does not route brand messages.

5. Route brand conversations

While the brand session is active, route subsequent turns through your backend’s brand runtime using the activation payload. Identify the brand in your chat UI. Hide recommendations on turns generated during the brand session. If an action requires contact or checkout details, collect them through a form with explicit consent before submitting them to the brand runtime.

6. Connect the stop action

Call useAdMesh inside a component wrapped by AdMeshProvider. Wire this handler to your chat’s stop-brand-conversation button:
Resume recommendations only for new user queries after the brand session stops.

7. Test your integration

  1. Send a query that returns an eligible Bridge recommendation.
  2. Click Talk to Agent and decline consent; no brand session should start.
  3. Try again and accept; verify the next turn reaches the brand runtime.
  4. Stop the brand conversation and verify normal chat routing resumes.