Skip to main content
This guide creates an edit-mode embed with the secondary toolbar and Moda’s hosted chat panel inside the iframe.

Prerequisites

  • A Moda API key enabled for Canvas Embed SDK
  • A canvas ID, for example cvs_01HT9WK8N3M2J4A5Z6P7Q8R9TV
  • The exact origin of the page that will host the iframe, for example https://app.example.com
Never create embed sessions directly from browser code. Your Moda API key must stay on your backend.

1. Create a session on your backend

server/create-moda-embed-session.ts

2. Return only the embed URL to your frontend

app/api/moda-embed/route.ts

3. Load the iframe

ModaCanvasEmbed.tsx

4. Listen for results

At minimum, handle these events:

Common first configuration

Create session body
Use chat: "external" when you want your application to own the chat UI and send chat.send, chat.stop, and chat.newThread commands itself. For the full session contract, see Session API.