Contents
On this page

List Channels - Plugixa Chat

GET /plugixa-chat/v1/channels

Read the channel catalogue: every channel a widget row can use, with the slug to send and what its value looks like.

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

Request

GET https://your-site.example/wp-json/plugixa-chat/v1/channels

Responses

200 OK. data is the catalogue.

{
  "success": true,
  "data": {
    "channels": [
      {
        "slug": "phone",
        "label": "Phone call",
        "group": "contact",
        "color": "#21b573",
        "input": "phone",
        "placeholder": "+1 555 000 1234",
        "help": "The number visitors will call.",
        "pattern": "^\\+?[0-9][0-9\\s\\-().]{5,24}$",
        "supports": [
          "agents"
        ],
        "defaultIcon": null,
        "panel": false
      },
      {
        "slug": "contact_form",
        "label": "Contact form",
        "group": "contact",
        "color": "#0f766e",
        "input": "none",
        "placeholder": "",
        "help": "Collect a message without leaving your site.",
        "pattern": "",
        "supports": [],
        "defaultIcon": null,
        "panel": true
      }
    ],
    "groups": [
      "messaging",
      "contact",
      "location",
      "booking",
      "social",
      "custom"
    ],
    "scriptSchemes": [
      "javascript",
      "data",
      "vbscript"
    ]
  }
}
Field Type Meaning
data.channels[].slug string What a widget’s channel row sends as slug
data.channels[].label string The channel’s name, in the site’s language
data.channels[].group string One of data.groups
data.channels[].color string The default brand colour
data.channels[].input string What kind of value the row takes, such as phone, or none for no value
data.channels[].pattern string A regular expression the admin checks the value against. Empty when there is none
data.channels[].supports array Extras the channel accepts, such as message, qr or agents
data.channels[].defaultIcon object|null The icon shown when the row has none, or null for the generic one
data.channels[].panel boolean true when the channel opens a panel inside the widget instead of a link
data.scriptSchemes array URL schemes a value may never start with

The example shows two of the channels. Developers can add channels with the plugixa_chat_channels filter, so read the list rather than hard-coding it.

Errors

Plus the errors every endpoint can return.

Examples

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

Quick Links

Share