Contents
On this page

Duplicate Widget - Plugixa Chat

POST /plugixa-chat/v1/widgets/{id}/duplicate

Copy a widget with its appearance, channels and rules. The copy is named after the original with “(copy)” added, and starts inactive.

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

Request

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

Path parameters

Name Type Description
id integer The widget to copy’s id

Responses

201 Created. data is the new widget.

{
  "success": true,
  "data": {
    "id": 5,
    "name": "Main widget (copy)",
    "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": 40,
        "widget_id": 5,
        "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": 12,
        "widget_id": 5,
        "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

Errors

Status Code When
404 plugixa_chat_not_found No widget has this id, or it is in the trash.
409 plugixa_chat_widget_limit The site already has as many widgets as the plugixa_chat_max_widgets filter allows.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-chat/v1/widgets/2/duplicate" \
  -u "admin:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-chat/v1/widgets/2/duplicate');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => 'admin:' . getenv('WP_APP_PASSWORD'),
]);
$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/duplicate', {
  method: 'POST',
  headers: {
    'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
  },
});
const { data } = await response.json();

Quick Links

Share