Contents
List CRM Lists - Plugixa Chat
POST /plugixa-chat/v1/crm/lists
Ask a service for its lists, with a key you send or the key of a saved connection, to find the list_id to save.
Needs Plugixa Chat Pro. The signed-in user needs the plugixa_chat_edit capability. Administrators have it.
Request
POST https://your-site.example/wp-json/plugixa-chat/v1/crm/lists
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
provider |
string |
Without id |
mailchimp, brevo or fluentcrm. |
api_key |
string |
Without id |
The key to try. When id is also sent, a key sent here wins over the stored one. |
id |
integer |
No | A saved connection: its service is used, and its stored key when api_key is empty. |
Mailchimp returns up to 100 lists.
{
"provider": "mailchimp",
"api_key": "YOUR_MAILCHIMP_KEY-us21"
}
Responses
200 OK. data is the list of lists.
{
"success": true,
"data": [
{
"id": "a1b2c3d4e5",
"name": "Newsletter"
},
{
"id": "f6g7h8i9j0",
"name": "Customers"
}
]
}
| Field | Type | Meaning |
|---|---|---|
data[].id |
string |
The value to save as list_id |
data[].name |
string |
The value to save as list_name |
Errors
| Status | Code | When |
|---|---|---|
400 |
plugixa_chat_crm_provider |
The service is not one of the three. |
400 |
plugixa_chat_crm_key |
Mailchimp or Brevo did not accept the key. |
400 |
plugixa_chat_crm_fluent |
FluentCRM is not active on this site. |
502 |
plugixa_chat_crm_unreachable |
Mailchimp or Brevo answered with an error. 500 with the same code when FluentCRM fails. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-chat/v1/crm/lists" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"provider":"mailchimp","api_key":"YOUR_MAILCHIMP_KEY-us21"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-chat/v1/crm/lists');
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([
'provider' => 'mailchimp',
'api_key' => 'YOUR_MAILCHIMP_KEY-us21',
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-chat/v1/crm/lists', {
method: 'POST',
headers: {
'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
'Content-Type': 'application/json',
},
body: JSON.stringify({ provider: 'mailchimp', api_key: 'YOUR_MAILCHIMP_KEY-us21' }),
});
const { data } = await response.json();
Quick Links
Share