Contents
On this page

Create Webhook - Plugixa Chat

POST /plugixa-chat/v1/webhooks

Add an endpoint that receives a signed POST for every new lead. A signing secret is made for it.

Needs Plugixa Chat Pro. The signed-in user needs the plugixa_chat_create capability. Administrators have it.

Request

POST https://your-site.example/wp-json/plugixa-chat/v1/webhooks

Request body

Content type: application/json

Field Type Required Description
url string Yes An http or https address this site can reach. Local and private addresses are refused.
events array Yes At least one known event. Only lead.created exists in 1.0.0; unknown names are dropped.
name string No Your label for it. Up to 191 characters.
is_active boolean No Whether deliveries are sent. Left out, the webhook is saved switched off.

The request each delivery makes, and how to check its signature, are described in Webhooks. Use Test Webhook to send a sample.

{
  "name": "Zapier",
  "url": "https://hooks.zapier.com/hooks/catch/123/abc/",
  "events": [
    "lead.created"
  ],
  "is_active": true
}

Responses

201 Created. data is the new webhook, with its secret.

{
  "success": true,
  "data": {
    "id": 3,
    "name": "Zapier",
    "url": "https://hooks.zapier.com/hooks/catch/123/abc/",
    "secret": "q8Xv2LmT0bWc9RkZ4nYp7HsA1eJdU5gF3iKoNr6V",
    "events": [
      "lead.created"
    ],
    "is_active": true,
    "last_status": 0,
    "last_error": "",
    "last_sent_at": null,
    "failures": 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"
  }
}
Field Type Meaning
data.id integer The webhook’s id
data.url string Where deliveries are posted
data.secret string The signing secret: 40 letters and digits, made when the webhook is created and never changed by an update
data.events array The events it receives. Only lead.created exists in 1.0.0
data.is_active boolean Whether deliveries are sent
data.last_status integer HTTP status of the last delivery or test, 0 before the first or when the request failed
data.last_error string Why the last one failed, empty when it worked
data.last_sent_at string|null When the last one was sent, in the site’s timezone (not UTC), or null
data.failures integer Failures in a row since the last success
data.created_at string UTC datetime

Errors

Status Code When
400 plugixa_chat_webhook_url url is missing, not http or https, or points at a local or private address.
400 plugixa_chat_webhook_events events has no known event.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-chat/v1/webhooks" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"name":"Zapier","url":"https://hooks.zapier.com/hooks/catch/123/abc/","events":["lead.created"],"is_active":true}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-chat/v1/webhooks');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => 'admin:' . getenv('WP_APP_PASSWORD'),
    CURLOPT_HTTPHEADER     => [
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS     => json_encode([
        'name'      => 'Zapier',
        'url'       => 'https://hooks.zapier.com/hooks/catch/123/abc/',
        'events'    => ['lead.created'],
        'is_active' => true,
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-chat/v1/webhooks', {
  method: 'POST',
  headers: {
    'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ name: 'Zapier', url: 'https://hooks.zapier.com/hooks/catch/123/abc/', events: ['lead.created'], is_active: true }),
});
const { data } = await response.json();

Quick Links

Share