Update a web chat

SDK platic.webchats.update()

Update the web chat fields you send:

  • name, agentId, mode, and allowedDomains apply right away.
  • config changes are saved in the draft. Your site shows them when you publish.

Example

await platic.webchats.update("webchat_123", { config: { content: { welcomeTitle: "How can we help?" } } });

Path parameters

ParameterTypeDescriptionRequired
webchatIdstringWeb chat id (wc-…)✓

Query parameters

ParameterTypeDescriptionRequired
workspacestringOnly if your credential has several workspaces: which one the web chat is in—

Request body

Send at least one.

FieldTypeDescriptionWhen it applies
namestringName of the web chat, 1 to 200 characters. It is only seen in Platica: what the visitor sees is config.content.assistantNameRight away
agentIdstring | nullThe agent that answers its conversations. null leaves it without an agentRight away: the next conversation is already answered by that agent
modestringembed, page, or bothRight away. embed changes in the same response
allowedDomainsstring[]The domains where the chat may open. Replaces the whole listRight away
configobjectOnly the parts that change. See the configurationWhen you publish

In config, objects are merged with what is already there, lists are replaced whole, and null removes an optional field.

Change the main color and the greeting:

{
  "config": {
    "appearance": { "primary": "#E4572E" },
    "content": { "welcomeTitle": "Hi! Looking for anything in particular?" }
  }
}

If you change the domains

Display rules (config.behavior.displayRules) apply per domain. If you change allowedDomains without sending rules, Platica adjusts the draft:

  • It keeps the rule of each domain that stays in the list.
  • It adds one for each new domain, covering all its pages.

Domains apply right away, but those rules wait for you to publish. With mode: "page" they are not touched.

Response

data is the web chat. When you changed config, hasUnpublishedChanges is true and message says so.

{
  "status": "success",
  "message": "Web chat saved; the changes to config are not published",
  "data": {
    "id": "wc-7Hq2LmN4pR8sT1vX",
    "name": "Acme Store",
    "agentId": "tVKljCHCNiebQdasHeit",
    "mode": "both",
    "allowedDomains": ["example.com"],
    "config": {
      "enabled": true,
      "content": {
        "assistantName": "Acme Store",
        "welcomeTitle": "Hi! Looking for anything in particular?",
        "welcomeMessage": "Inicia una conversación con nuestro equipo.",
        "placeholder": "Escribe un mensaje…",
        "onlineLabel": "En línea",
        "offlineLabel": "Fuera de horario",
        "offlineMessage": "Estamos fuera de horario. Déjanos un mensaje y te responderemos pronto.",
        "prechatTitle": "Antes de comenzar",
        "startButtonLabel": "Iniciar conversación"
      },
      "availability": { "status": "online" }
    },
    "published": true,
    "hasUnpublishedChanges": true,
    "embed": {
      "publicKey": "wc_pub_7Hq2LmN4pR8sT1vX",
      "script": "<script\n  src=\"https://chat.platica.mx/widget.js\"\n  data-webchat=\"wc_pub_7Hq2LmN4pR8sT1vX\"\n  defer>\n</script>",
      "inline": "<div id=\"platica-chat\"></div>\n\n<script\n  src=\"https://chat.platica.mx/widget.js\"\n  data-webchat=\"wc_pub_7Hq2LmN4pR8sT1vX\"\n  data-target=\"#platica-chat\"\n  defer>\n</script>",
      "pageUrl": "https://chat.platica.mx/chat?webchat=wc_pub_7Hq2LmN4pR8sT1vX"
    },
    "health": { "state": "ok", "reason": null, "since": "2026-11-12T18:30:00.000Z" },
    "creationDate": "2026-11-12T18:30:00.000Z",
    "lastUpdate": "2026-11-12T19:05:00.000Z",
    "nextStep": "Saved. name, agentId, mode and allowedDomains already apply; the changes to config wait until you publish with POST /v1/webchats/wc-7Hq2LmN4pR8sT1vX/publish."
  }
}

The example shows only three parts of config; the response has all twelve. The fields are in get a web chat.

If you send the values it already has, the response returns the unchanged web chat.

Errors

Statusdetails.codeWhen it happens
400INVALID_REQUESTYou sent no field, there is an extra one, or one is not valid. Also if an image in config could not be processed. details.issues says which
403FORBIDDENThe credential does not have write permission on Integrations, or the agent is not within its reach
404WEBCHAT_NOT_FOUNDThe web chat does not exist in this workspace
404AGENT_NOT_FOUNDThe agentId agent does not exist
409WEBCHAT_CONFLICTThe web chat does not accept that change in its current state
503WEBCHAT_SERVICE_UNAVAILABLE, WEBCHAT_SERVICE_TIMEOUTThe web chat service did not respond. Get the web chat to see whether the change was saved

For example, if you send a field that does not exist, such as color:

{
  "code": 400,
  "error": "Bad Request - The request has validation errors",
  "details": {
    "code": "INVALID_REQUEST",
    "message": "The change is not valid.",
    "issues": [
      { "path": "color", "code": "unrecognized_keys", "message": "Unknown field." }
    ]
  }
}

Notes

  • update does not turn the web chat off or on. To turn it off, disconnect the channel. To turn it on, publish it.
  • To pause it from the configuration, send config.enabled: false and publish.
  • Needs a workspace API key, or an OAuth token with write access to Integrations and the platica:write scope.