Web chat

Create a chat for your site or a page hosted by Platica. Creating it publishes it and returns the installation code. Its conversations reach your inbox.

Assign an agent for automatic replies, or receive messages through your webhooks to integrate them with your product. You can create the chat without an agent.

Quick example

// 1. Create the web chat (it is born published with embed.script and embed.pageUrl)
const webchat = await platic.webchats.create({
  name: 'Site support',
  agentId,
  allowedDomains: ['example.com', '*.example.com']
});
console.log(webchat.embed.script);

// 2. Change appearance/texts (draft) and publish
await platic.webchats.update(webchat.id, {
  config: { appearance: { primary: '#E4572E' }, content: { assistantName: 'Support' } }
});
await platic.webchats.publish(webchat.id);

What you need to know

  • Live vs draft: name, agentId, allowedDomains, and mode apply right away. Changes in config are saved as a draft (hasUnpublishedChanges: true) until you publish; the script pasted on your site does not change.
  • Allowed domains: the chat only opens on allowedDomains (it accepts subdomains like *.example.com and localhost:5173). Without domains, it does not load on any site.
  • Turning off and on: to turn it off instantly use disconnect the channel (health: disconnected); to turn it on again, publish it. To pause it through the draft, send config.enabled: false and publish (health: paused).
  • Permissions: requires Integrations (write access and platica:write with OAuth to create, edit, publish, or delete).

The configuration

Send only the parts of config you want to change:

  • Objects merge with the saved values.
  • Arrays, such as prechat.fields or suggestedMessages.cards, are replaced in full.
  • null clears an optional field.

Its sections are enabled, interactiveResponses, attachments, launcher, window, inline, appearance, content, suggestedMessages, prechat, availability, and behavior. Read the structure and current values with get a web chat.

Endpoints

MethodEndpointWhat it does
GET/v1/webchatsList the workspace's web chats
POST/v1/webchatsCreate a web chat (it is born published)
GET/v1/webchats/{webchatId}Get the full configuration and the embed code
PATCH/v1/webchats/{webchatId}Update the data or the config as a draft
POST/v1/webchats/{webchatId}/publishPublish the config or turn it on if it was off
DELETE/v1/webchats/{webchatId}Delete the web chat for good

The full guide is in Put a chat on your site, how to paste it in Embed it on your site, errors in Errors, and AI tools in Web chat MCP.