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)
curl -X POST https://api.platic.ai/v1/webchats \
-H "Authorization: Bearer $PLATIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Site support", "agentId": "'"$AGENT_ID"'", "allowedDomains": ["example.com"]}'
# 2. Update the config (it stays as a draft) and publish
curl -X PATCH https://api.platic.ai/v1/webchats/$WEBCHAT_ID \
-H "Authorization: Bearer $PLATIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"config": {"appearance": {"primary": "#E4572E"}}}'
curl -X POST https://api.platic.ai/v1/webchats/$WEBCHAT_ID/publish \
-H "Authorization: Bearer $PLATIC_API_KEY" // 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, andmodeapply right away. Changes inconfigare 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.comandlocalhost: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, sendconfig.enabled: falseand publish (health: paused). - Permissions: requires Integrations (write access and
platica:writewith 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.fieldsorsuggestedMessages.cards, are replaced in full. nullclears 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
| Method | Endpoint | What it does |
|---|---|---|
GET | /v1/webchats | List the workspace's web chats |
POST | /v1/webchats | Create 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}/publish | Publish 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.