Contents
On this page

Update Widget - Plugixa Chat

PUT /plugixa-chat/v1/widgets/{id}

Change a widget. PUT and PATCH behave the same.

The signed-in user needs the plugixa_chat_edit capability. Administrators have it.

Note. Top-level fields you leave out are kept. But appearance, channels and rules are each replaced whole when present: send the full appearance, and the full list of channels or rules, not just the part that changed. Read the widget first with Get Widget.

Request

PUT https://your-site.example/wp-json/plugixa-chat/v1/widgets/2

Path parameters

Name Type Description
id integer The widget’s id

Request body

Content type: application/json

Field Type Required Description
name string No Sending it blank is refused.
status string No active or inactive. Anything else gives inactive.
sort_order integer No Position among the widgets.
appearance object No Replaces the whole appearance. Keys you leave out go back to their defaults.
channels array No Replaces every channel row. [] removes them all.
rules array No Replaces every rule. [] removes them all.

The keys inside appearance, channels and rules are the ones listed in Create Widget. Channel rows are written again on every save that includes channels, so their ids change.

{
  "status": "inactive"
}

Responses

200 OK. data is the updated widget.

{
  "success": true,
  "data": {
    "id": 2,
    "name": "Main widget",
    "status": "inactive",
    "appearance": {
      "position": "right",
      "layout": "vertical",
      "animation": "none",
      "trigger": "click",
      "size": 56,
      "offset_x": 24,
      "offset_y": 24,
      "color": "#0f766e",
      "icon_color": "#ffffff",
      "cta": "",
      "label": "",
      "icon": null,
      "badge": 0,
      "show_delay": 0,
      "show_scroll": 0,
      "show_exit": false
    },
    "sort_order": 0,
    "deleted_at": null,
    "created_at": "2026-11-12 09:30:00",
    "modified_at": "2026-11-12 09:30:00",
    "created_by": "1",
    "modified_by": "1",
    "channels": [
      {
        "id": 31,
        "widget_id": 2,
        "slug": "whatsapp",
        "label": "",
        "value": "+15550001234",
        "message": "Hi! I'm on {title}",
        "is_active": true,
        "sort_order": 0,
        "deleted_at": null,
        "created_at": "2026-11-12 09:30:00",
        "modified_at": "2026-11-12 09:30:00",
        "created_by": "1",
        "modified_by": "1",
        "color": "#25d366",
        "new_tab": false,
        "devices": "all",
        "icon": null,
        "hover": "",
        "qr": false,
        "settings": []
      }
    ],
    "rules": [
      {
        "id": 8,
        "widget_id": 2,
        "kind": "url",
        "mode": "hide",
        "operator": "contains",
        "value": "[\"\\/checkout\"]",
        "sort_order": "0",
        "deleted_at": null,
        "created_at": "2026-11-12 09:30:00",
        "modified_at": "2026-11-12 09:30:00",
        "created_by": "1",
        "modified_by": "1",
        "values": [
          "/checkout"
        ]
      }
    ],
    "channel_count": 1
  }
}
Field Type Meaning
data.id integer The widget’s id
data.name string Its name, shown only in the admin
data.status string active or inactive
data.channels array Every channel row, switched on or not, in display order
data.channels[].id integer The row’s id. Rows get new ids each time the channels are saved
data.rules[].values array The rule’s values, as a list of strings. value holds the same list as a JSON string

Errors

Status Code When
400 plugixa_chat_widget_name_required name was sent blank.
404 plugixa_chat_not_found No widget has this id, or it is in the trash.

Plus the errors every endpoint can return.

Examples

curl -s -X PATCH "https://your-site.example/wp-json/plugixa-chat/v1/widgets/2" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"status":"inactive"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-chat/v1/widgets/2');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'PATCH',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => 'admin:' . getenv('WP_APP_PASSWORD'),
    CURLOPT_HTTPHEADER     => [
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS     => json_encode([
        'status' => 'inactive',
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-chat/v1/widgets/2', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ status: 'inactive' }),
});
const { data } = await response.json();

Quick Links

Share