Skip to content
View as Markdown
Enter your site to enable Send. Requests are sent from your browser, so the site must allow cross-origin calls (CORS).

POST Send Subscriber WhatsApp Message​

POST
/whatsapp/subscribers/{id}/send

Send one WhatsApp message to a contact right now through the configured provider, and record it on the contact's thread (a failed attempt is recorded as failed with the provider's error in meta). Checks, in order: contact exists, has a phone, and has not opted out / bounced on WhatsApp (fcrm_manage_emails callers still cannot override consent), then a configured driver.

Two modes, chosen by message_type (default session; any value other than template is treated as session):

  • template: requires an APPROVED template of the current provider, looked up by template_name (+ optional template_language to pin a variant). The provider must support templates. template_variables maps each body placeholder position to a FluentCRM smartcode string (for example {"1": "{{contact.first_name|there}}"}) which is resolved for this contact. It is refused with 422 when a placeholder is unmapped or resolves to empty with no fallback, or when the template has a header variable or a dynamic-URL button (not supported yet). Works at any time, inside or outside the window.
  • session: free-form message text (smartcodes are parsed). Allowed only while the 24-hour window is open; otherwise 422 The 24-hour reply window is closed for this contact. Send an approved template instead.

All failures are 422 with a message. Note: the session branch does not reject an empty message.

PRO (FluentCampaign Pro). The route exists only while the Messaging module (the messaging_module experimental setting) is switched on, and the policy answers 403 unless at least one channel (SMS or WhatsApp) is active.

Required capability: fcrm_manage_emails

Enforced by MessagePolicy::sendCustomMessage().

Requires: FluentCampaign Pro with the Messaging module enabled. While no messaging channel (SMS or WhatsApp) is switched on the route is not registered at all and returns a 404.

Authorizations​

ApplicationPasswords

WordPress Application Passwords — use Basic auth with your WordPress username and an application password in the format: username:application_password

Type
API Key (header: Authorization)

Parameters​

Path Parameters

id*

Contact (subscriber) ID.

Type
integer
Required

Request Body​

application/json
JSON
{
"message_type": "session",
"message": "string",
"template_name": "string",
"template_language": "string",
"template_variables": {
"additionalProperties": "string"
}
}

Responses​

Message sent and recorded.

application/json
JSON
{
"message": "string",
"wa_message": {
"id": 0,
"thread_id": 0,
"direction": "string",
"content": "string",
"message_content": "string",
"message_type": "string",
"template_name": "string",
"ref_type": "string",
"ref_id": 0,
"status": "string",
"provider_message_id": "string",
"scheduled_at": "string",
"sent_at": "string",
"timestamp": "string",
"meta": {
},
"media": [
{
"type": "string",
"url": "string",
"mime_type": "string",
"filename": "string",
"caption": "string",
"filesize": 0,
"stored": true
}
],
"created_by": 0,
"created_at": "string",
"updated_at": "string"
}
}

Playground​

Authorization
Variables
Key
Value
Body

Samples​

Powered by VitePress OpenAPI