Team Chat
Embed the team-chat workspace and react to message lifecycle events.
Mounts the team-chat workspace as an iframe and relays message lifecycle events back to your page. Optionally scope it to a single agent.
Quick start
<div id="embed" style="height: 600px"></div>
<script src="https://new.theultimate.io/embed.js" defer></script>
<script>
Embed.render("teamChat", {
target: "#embed",
authToken: "<jwt>", // or apiKey: "pm_xxx"
agentId: "agent_123", // optional
theme: "system",
on: {
ready: function (m) {},
messageSent: function (m) {},
messageDelivered: function (m) {},
messageIncoming: function (m) {},
conversationChanged: function (m) {},
},
});
</script>Options
All common options apply, plus:
| Option | Type | Required | Description |
|---|---|---|---|
agentId | string | no | Scope the workspace to one agent. |
Events
| Event | Fires when |
|---|---|
ready | The workspace has loaded and authenticated. |
messageSent | An outbound message was sent. |
messageDelivered | A sent message was delivered. |
messageIncoming | An inbound message arrived. |
conversationChanged | The agent opened a different conversation, or cleared the selection. |
conversationChanged payload
Fires whenever the open conversation changes, so your page can stay in sync with what the agent is viewing. Every field is null when the selection is cleared.
| Field | Type | Description |
|---|---|---|
customerId | string | null | Id of the customer whose conversation is now open. |
name | string | null | Customer display name. |
identifier | string | null | Customer phone number, in E.164 form. |
conversationStatus | string | null | Conversation status, e.g. OPEN. |
unreadCount | number | null | Unread messages in this conversation. |
wabaId | string | null | WhatsApp Business Account the conversation belongs to. |
Notification sound
Team chat plays the incoming-message sound, so its iframe is granted
autoplay in addition to clipboard-write. No microphone or camera access is
requested.
Teardown
render returns an instance; call destroy() when you remove the embed (required in SPAs):
var instance = Embed.render("teamChat", {
target: "#embed",
authToken: "<jwt>",
});
// later…
instance.destroy();How is this guide?


