SDK reference

Two packages: @ivorycom/embed (browser) and @ivorycom/embed-node (server).

Attributes

attributemeaning
client-idPublic embed app id
tokenMinted embed session token
viewSingle-surface view (optional)
record-idDeep-link a record (optional)
themelight · dark · auto
originOverride the embed origin (optional)

Commands

element.command(name, payload)navigate, openRecord, prefill, setTheme, runAgent.

Events

element.on(name, handler) returns an unsubscribe; also emitted as DOM CustomEvents ivory:ready and ivory:event (detail: { event, payload }). Events include ready, navigate, lead.created, deal.won, agent.reply, error.

React

import { IvoryCrm } from "@ivorycom/embed/react";
<IvoryCrm clientId="iem_your_app" token={token} view="pipeline"
  onReady={() => {}} onEvent={(name, payload) => {}} />

Server (mint)

import { createEmbedClient } from "@ivorycom/embed-node";
const { embed_token } = await createEmbedClient({ clientId, secret })
  .mintSession({ sub, email, name, scopes });