Publish a web chat

SDK platic.webchats.publish()

Publish the saved config changes on your site and the chat's page. You do not need to replace the installation code.

It also turns on a web chat that you turned off. In that case, if it had unpublished changes, they are published too.

Example

await platic.webchats.publish("webchat_123");

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

It has no body.

Response

data is the published web chat: published is true and hasUnpublishedChanges is false.

{
  "status": "success",
  "message": "Web chat published",
  "data": {
    "id": "wc-7Hq2LmN4pR8sT1vX",
    "name": "Acme Store",
    "agentId": "tVKljCHCNiebQdasHeit",
    "mode": "both",
    "allowedDomains": ["example.com"],
    "config": {
      "enabled": true,
      "appearance": {
        "mode": "light",
        "primary": "#E4572E",
        "radius": 16,
        "font": "system",
        "colors": {
          "canvas": "#f7f8f5",
          "surface": "#ffffff",
          "surfaceMuted": "#f4f5f1",
          "text": "#343434",
          "textMuted": "#666666",
          "border": "#111111",
          "headerBackground": "#ffffff",
          "headerText": "#343434",
          "headerIcons": "#666666",
          "visitorBackground": "#eef0e9",
          "visitorText": "#343434",
          "composerBackground": "#ffffff",
          "composerInput": "#ffffff",
          "sendBackground": "#00C577",
          "sendIcon": "#111111",
          "error": "#ef4444",
          "online": "#00C577"
        },
        "visualEffects": { "enabled": true, "intensity": 60, "blur": 80, "motion": true }
      },
      "availability": { "status": "online" }
    },
    "published": true,
    "hasUnpublishedChanges": false,
    "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:10:00.000Z",
    "nextStep": "Published: the saved configuration is live."
  }
}

The config example is partial; the response includes all twelve sections. Change colors.sendBackground and colors.online too if you want them to use the new primary: those colors are saved separately.

The fields are in get a web chat.

If it was turned off

  • It turns it on and publishes it in the same call. It loads again on your site and on its page, with the same code.
  • The response has health as ok, unless config.enabled is false. Then it is turned on but paused (paused) until you publish with enabled: true.
  • After a 503, the chat may be on but not yet loading on your site. Repeat the call to finish turning it on.

Errors

Statusdetails.codeWhen it happens
400INVALID_REQUESTwebchatId does not start with wc-
403FORBIDDENThe credential does not have write permission on Integrations
404WEBCHAT_NOT_FOUNDThe web chat does not exist in this workspace
409WEBCHAT_CONFLICTThe web chat cannot be published in its current state
503WEBCHAT_SERVICE_UNAVAILABLE, WEBCHAT_SERVICE_TIMEOUTThe web chat service did not respond. You can publish again

Notes

  • Publishing without changes publishes the same thing again. You can repeat the call if it failed.
  • Needs a workspace API key, or an OAuth token with write access to Integrations and the platica:write scope.