Contents
On this page
Test Webhook - Plugixa Chat
POST /plugixa-chat/v1/webhooks/{id}/test
Post a sample lead.created delivery to the webhook now, signed like a real one, and return what the endpoint answered.
Needs Plugixa Chat Pro. The signed-in user needs the plugixa_chat_edit capability. Administrators have it.
Note. The test is sent even when the webhook is switched off, and it updates
last_status,last_error,last_sent_atandfailureslike a real delivery. The sample carries"test": trueindata.
Request
POST https://your-site.example/wp-json/plugixa-chat/v1/webhooks/3/test
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The webhook’s id |
Responses
200 OK. The test was attempted; data.ok says whether it worked.
{
"success": true,
"data": {
"ok": true,
"status": 200,
"error": ""
}
}
| Field | Type | Meaning |
|---|---|---|
data.ok |
boolean |
Whether the endpoint answered with a 2xx status |
data.status |
integer |
The status it answered, 0 when the request itself failed |
data.error |
string |
The reason it failed, empty on success |
A failed delivery still answers 200 here: read data.ok. Redirects are not followed, and the request times out after 10 seconds.
Errors
| Status | Code | When |
|---|---|---|
404 |
plugixa_chat_webhook_missing |
No webhook has this id, or it is in the trash. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-chat/v1/webhooks/3/test" \
-u "admin:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-chat/v1/webhooks/3/test');
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/webhooks/3/test', {
method: 'POST',
headers: {
'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
},
});
const { data } = await response.json();
Quick Links
Share