# eCommunicate Messaging APIs

Put **WhatsApp, SMS, and Live Chat** in front of your agents. Two-way conversations, full history, tickets, and bot-to-agent handover through one API — plus templates, delivery receipts, and automatic SMS fallback when you need to reach customers first.

[Get Started](/guides/getting-started) [Live Chat](/guides/live-chat) [Omnichannel API](/apis/omnichannel) [SMS Gateway](/apis/sms)

## Bring WhatsApp and SMS into your contact centre (CCaaS)

Contact centre as a service (CCaaS) platforms let a customer service team handle interactions across every channel from one place — self-service or agent-assisted — with the customer experience and the agent experience treated as one problem.

Our WhatsApp and SMS platform integrates with a CCaaS over **APIs and webhooks**, so both channels appear in the agent desktop alongside voice, email, and everything else you already route.

### What the platform gives your CCaaS

| Capability | Where it comes from |
|  --- | --- |
| Two-way WhatsApp messaging | Run the conversation on our side ([chatbot webhook](/guides/webhooks#chatbot-conversation-payload) + [live-chat send](/guides/live-chat#send-a-reply)) or your side ([incoming webhook](/guides/webhooks#incoming-message-payload) + [`messageType: CHAT`](/guides/whatsapp-messaging#chat-message)) — see [Two ways to run the conversation](#two-ways-to-run-the-conversation) |
| Conversation start | A [template send](/guides/whatsapp-messaging#template-messaging-rules) to prompt the customer, or their inbound message — either way their reply opens the 24-hour window |
| Conversation history | [Get messages by participant](/guides/live-chat#step-3-get-the-conversation-messages), or [by tracking number](/guides/live-chat#alternative-get-messages-by-tracking-number) |
| Routing metadata | [Chat participants](/guides/live-chat#chat-participants) with scope filters — unassigned, my, team, missed, closed |
| Bot-to-agent handover | [Chatbot conversation webhook](/guides/webhooks#chatbot-conversation-payload) — optionally stops emitting once an agent is assigned |
| Delivery and read receipts | [Status update webhook](/guides/webhooks#status-update-payload), plus [mark-as-read](/guides/live-chat#mark-a-conversation-as-read) to send a receipt back to the customer |
| Media — images, documents, audio, video | [Agent media replies](/guides/live-chat#send-media) and [media templates](/guides/whatsapp-messaging#media-template) |
| Customer-session handling | The 24-hour WhatsApp session window, or [long-lived conversations](/guides/conversations) that stay open for days or months |
| Pre-approved templates | [Template messaging](/guides/whatsapp-messaging#template-messaging-rules) for the notifications your agents don't type |


Who runs the conversation?
You can let **our chatbot** drive the conversation and mirror everything to your side over the chatbot webhook, or **run it yourself** and use us as the WhatsApp transport. The choice decides which webhook you listen to and which endpoint you send on — [Two ways to run the conversation](#two-ways-to-run-the-conversation) lays out both.

### Measuring the engagement

Premium customer service experiences come from premium employee assistance and follow-up, so the platform also lets you monitor and rate the quality of each engagement:

- **Customer ratings** — [terminating a chat](/guides/live-chat#terminate-or-reopen-a-chat) sends the rating widget, and the response comes back as a `RATING` message
- **Follow-up tracking** — [tickets](/guides/live-chat#tickets) with status workflows (`OPEN`, `AWAITING_AGENT`, `AWAITING_CUSTOMER`, `RESOLVED`, `CLOSED`), searchable by agent or by rating
- **Reporting** — [conversation analytics](/guides/conversations#conversation-analytics) and exports as XLSX or CSV


## Start building in minutes

A WhatsApp conversation only becomes two-way once the **customer** messages you — that message opens the **24-hour customer service window**, and until it closes your agents can send free-form replies. So there are two ways in: wait for the customer to message first, or send a template to prompt them.

```
Template send ──> Customer replies ──> 24h window opens ──> Free-form messaging
   (business)         (webhook)                              (until it closes)
```

### Two ways to run the conversation

Decide who owns the conversation logic before you write any code — it determines which webhook you listen to and which endpoint you send on.

|  | **We manage it** | **You manage it** |
|  --- | --- | --- |
| Conversation logic | A chatbot you build on our platform | Your own bot, agent desktop, or CCaaS |
| Listen to | [`chatbotWebhookURL`](/guides/webhooks#chatbot-conversation-payload) — customer messages **and** your chatbot's own outbound replies | [`incomingMessageURL`](/guides/webhooks#incoming-message-payload) — customer messages |
| Send free-form | [`POST /pl4chat-service/api/v2/messages`](/guides/live-chat#send-a-reply) — appears in the live-chat thread | [`POST /whatsapp-api-service/v2/messages`](/guides/whatsapp-messaging#chat-message) with `messageType: CHAT` |
| Agent handover | Built in — chat participants, tickets, ratings | Yours to build |


Both models send templates the same way, and both get [delivery receipts](/guides/webhooks#status-update-payload) on `statusUpdateURL`.

Outbound bot replies are opt-in
The chatbot webhook emits `INCOMING` events by default. Set [`chatbotIncludeOutgoing`](/guides/webhooks#chatbot-behavior-and-flags) to `true` to also receive your chatbot's `OUTGOING` widget replies, so your side sees the full transcript. `chatbotStopOnAgentAssignment` controls whether events keep firing after a human agent takes over.

### 1. Open the conversation with a template

Same for both models.

Reach a customer who hasn't messaged you yet. Templates are pre-approved, so they can be sent at any time — outside the window included.

cURL
```bash
curl -X POST https://api.payless4messaging.com/whatsapp-api-service/v2/messages \
  -H "Authorization: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 8f14e45f-ceea-467a-9f2c-4b1d3e5a7c90" \
  -d '{
    "channel": "WHATSAPP",
    "payload": {
      "sender": "+27123456789",
      "templateName": "seasonal_promo_text",
      "templateId": "your-template-uuid",
      "messageType": "NOTIFICATION",
      "messages": [
        {
          "recipients": [{ "to": "+27987654321", "customerUserId": "ZA.1021033720668862" }],
          "components": [
            { "type": "body", "parameters": ["John"] }
          ]
        }
      ]
    }
  }'
```

Node.js
```javascript
// Generate once and store it with the send — reuse the same value on every retry
const idempotencyKey = crypto.randomUUID();

const response = await fetch(
  'https://api.payless4messaging.com/whatsapp-api-service/v2/messages',
  {
    method: 'POST',
    headers: {
      'Authorization': process.env.ECOMM_API_KEY,
      'Content-Type': 'application/json',
      'Idempotency-Key': idempotencyKey,
    },
    body: JSON.stringify({
      channel: 'WHATSAPP',
      payload: {
        sender: '+27123456789',
        templateName: 'seasonal_promo_text',
        templateId: 'your-template-uuid',
        messageType: 'NOTIFICATION',
        messages: [
          {
            recipients: [{ to: '+27987654321' }],
            components: [{ type: 'body', parameters: ['John'] }],
          },
        ],
      },
    }),
  }
);

const data = await response.json();
console.log(data);
// { status: "ACCEPTED", requestId: "c3a1f8e2-...", channel: "WHATSAPP" }
```

Python
```python
import os
import uuid

import requests

# Generate once and store it with the send — reuse the same value on every retry
idempotency_key = str(uuid.uuid4())

response = requests.post(
    "https://api.payless4messaging.com/whatsapp-api-service/v2/messages",
    headers={
        "Authorization": os.environ["ECOMM_API_KEY"],
        "Content-Type": "application/json",
        "Idempotency-Key": idempotency_key,
    },
    json={
        "channel": "WHATSAPP",
        "payload": {
            "sender": "+27123456789",
            "templateName": "seasonal_promo_text",
            "templateId": "your-template-uuid",
            "messageType": "NOTIFICATION",
            "messages": [
                {
                    "recipients": [{"to": "+27987654321"}],
                    "components": [{"type": "body", "parameters": ["John"]}],
                }
            ],
        },
    },
)

print(response.json())
```

Java
```java
import java.net.URI;
import java.net.http.*;
import java.net.http.HttpResponse.BodyHandlers;
import java.util.UUID;

HttpClient client = HttpClient.newHttpClient();

// Generate once and store it with the send — reuse the same value on every retry
String idempotencyKey = UUID.randomUUID().toString();

String json = """
    {
      "channel": "WHATSAPP",
      "payload": {
        "sender": "+27123456789",
        "templateName": "seasonal_promo_text",
        "templateId": "your-template-uuid",
        "messageType": "NOTIFICATION",
        "messages": [
          {
            "recipients": [{ "to": "+27987654321" }],
            "components": [
              { "type": "body", "parameters": ["John"] }
            ]
          }
        ]
      }
    }
    """;

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.payless4messaging.com/whatsapp-api-service/v2/messages"))
    .header("Authorization", System.getenv("ECOMM_API_KEY"))
    .header("Content-Type", "application/json")
    .header("Idempotency-Key", idempotencyKey)
    .POST(HttpRequest.BodyPublishers.ofString(json))
    .build();

HttpResponse<String> response = client.send(request, BodyHandlers.ofString());
System.out.println(response.body());
```

**Response (202 Accepted):**

```json
{
  "status": "ACCEPTED",
  "message": "Request accepted",
  "requestId": "c3a1f8e2-4b6d-11ee-be56-0242ac120002",
  "channel": "WHATSAPP",
  "timestamp": "2026-01-15T10:30:00Z"
}
```

`Idempotency-Key` makes the send safe to retry
Supply a unique value — a UUID works — per distinct send. If a request with the same key was already accepted for your account, the original response is replayed and the message is **not** sent or charged again, so a retry after a network error or timeout can't double-send.

Generate the key **before** the first attempt and store it with the send, then reuse that same value on every retry — a key generated fresh inside the retry loop defeats the whole mechanism. Omit the header to disable deduplication and have each request treated as new.

The header works on both send endpoints, so the free-form `CHAT` send in step 3 takes it too.

### 2. Catch the reply

The customer's reply opens the window. Which webhook you read it from depends on the model you picked.

#### We manage it — the chatbot webhook

Your [`chatbotWebhookURL`](/guides/webhooks#create-webhook-configuration) receives a POST carrying **`chatParticipantId`** — the id every live-chat call needs — plus conversation status and the assigned agent:

```json
{
  "eventId": "741f73c4-d8f9-4553-ae71-938b56d9ce90",
  "direction": "INCOMING",
  "timestamp": 1779878219796,
  "chatParticipantId": "aef65b5a-23a4-462a-a275-9aa2f3e0e56e",
  "conversationStatus": "ACTIVE",
  "conversationClosed": false,
  "chatBotConversation": true,
  "clientRef": "your-client-ref",
  "senderMsisdn": "27987654321",
  "receiverMsisdn": "+27123456789",
  "messageType": "BUTTON",
  "messageText": "Track my order",
  "templateId": "9874dc22-d4f7-4b81-b991-cd7f364faa2c",
  "templateName": "seasonal_promo_text"
}
```

`templateId` and `templateName` are present when the reply follows a template send, so you can correlate the response back to the campaign that triggered it. With `chatbotIncludeOutgoing` on, your chatbot's own replies arrive here too as `OUTGOING` events — the full transcript, not just the customer's half.

#### You manage it — the incoming message webhook

Your [`incomingMessageURL`](/guides/webhooks#incoming-message-payload) receives the customer's message with the sender's identity and the text:

```json
{
  "profileName": "John Smith",
  "sender": "+27987654321",
  "senderUserId": "ZA.1021033720668862",
  "receiver": "+27123456789",
  "text": "Hi, I need help with my order",
  "messageType": "INTERACTION",
  "messageContentType": "TEXT",
  "sentTime": "2026-01-15T10:30:00.000+00:00",
  "status": "RECEIVED"
}
```

`participantId` here is not the live-chat id
The incoming-message payload also carries a `participantId`, but it identifies a participant in the conversation engine — it is **not** the `chatParticipantId` that `/pl4chat-service` endpoints expect. If you need live chat, read the chatbot webhook, or [resolve the participant by phone number](/guides/live-chat#step-2-get-the-chat-participant-by-sender-number) first.

Both webhooks fire independently when a customer message arrives, so you can run both while you migrate from one model to the other.

### 3. Reply within the window

The window is open, so free-form messages are allowed until it closes.

#### We manage it — reply as an agent through Live Chat

One endpoint sends on every channel — WhatsApp, Web, or Facebook — and the agent is resolved from your API key. Only messages sent this way appear in the live-chat thread.

cURL
```bash
curl -X POST https://api.payless4messaging.com/pl4chat-service/api/v2/messages \
  -H "Authorization: $ECOMM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "participantId": "participant-uuid",
    "channel": "WHATSAPP",
    "text": "Here is the information you requested."
  }'
```

Node.js
```javascript
const response = await fetch(
  'https://api.payless4messaging.com/pl4chat-service/api/v2/messages',
  {
    method: 'POST',
    headers: {
      'Authorization': process.env.ECOMM_API_KEY,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      participantId: 'participant-uuid',
      channel: 'WHATSAPP',
      text: 'Here is the information you requested.',
    }),
  }
);

const message = await response.json();
console.log(message.id, message.messageOwner); // "c9d01234-..." "agent"
```

Python
```python
import os
import requests

response = requests.post(
    "https://api.payless4messaging.com/pl4chat-service/api/v2/messages",
    headers={
        "Authorization": os.environ["ECOMM_API_KEY"],
        "Content-Type": "application/json",
    },
    json={
        "participantId": "participant-uuid",
        "channel": "WHATSAPP",
        "text": "Here is the information you requested.",
    },
)

print(response.json())
```

Java
```java
import java.net.URI;
import java.net.http.*;
import java.net.http.HttpResponse.BodyHandlers;

HttpClient client = HttpClient.newHttpClient();

String json = """
    {
      "participantId": "participant-uuid",
      "channel": "WHATSAPP",
      "text": "Here is the information you requested."
    }
    """;

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.payless4messaging.com/pl4chat-service/api/v2/messages"))
    .header("Authorization", System.getenv("ECOMM_API_KEY"))
    .header("Content-Type", "application/json")
    .POST(HttpRequest.BodyPublishers.ofString(json))
    .build();

HttpResponse<String> response = client.send(request, BodyHandlers.ofString());
System.out.println(response.body());
```

`participantId` is the `chatParticipantId` from the chatbot webhook in step 2.

**Response:**

```json
{
  "id": "c9d01234-e5f6-a7b8-c9d0-1234e5f6a7b8",
  "sequenceNumber": 42,
  "direction": "OUTGOING",
  "contentType": "TEXT",
  "channel": "WHATSAPP",
  "text": "Here is the information you requested.",
  "createdTime": "2026-01-15T10:30:00Z",
  "userOriginated": true,
  "messageOwner": "agent",
  "sender": "+27123456789",
  "receiver": "+27987654321"
}
```

#### You manage it — free-form send with `messageType: CHAT`

Running your own bot or agent desktop? Send free-form session messages through the **same endpoint you used for the template** in step 1 — swap `messageType` from `NOTIFICATION` to `CHAT`, drop the template fields, and put your text in `messageText`:

```json
POST /whatsapp-api-service/v2/messages

{
  "channel": "WHATSAPP",
  "payload": {
    "sender": "+27123456789",
    "messageType": "CHAT",
    "messages": [
      {
        "recipients": [{ "to": "+27987654321" }],
        "messageText": "Hello, this is a standard session message."
      }
    ]
  }
}
```

Same auth, same client code as step 1 — only the payload changes. Add a `media` object with `url` and `caption` to attach a file. See [Chat message](/guides/whatsapp-messaging#chat-message) for the media variant and the WhatsApp-specific endpoint.

These sends bypass the chat service
Messages sent this way reach the customer but **do not** appear in the live-chat UI — agents on our side won't see them. That's the right trade-off when you own the agent desktop; it's a bug when you don't. See [Agent messaging](/guides/live-chat#agent-messaging).

WhatsApp Lite has no window
The 24-hour limit is a WhatsApp Cloud rule. On [WhatsApp Lite](/guides/whatsapp-messaging#message-types), `CHAT` messages can be sent at any time.

### The rest of the agent loop

Everything an agent desktop needs, in the order you'd call it:

```
GET  /pl4chat-service/api/v2/chats?scope=unassigned&search=27987654321  # queue view (no webhook id)
GET  /pl4chat-service/api/v2/messages?participantId={id}                # load the history
POST /pl4chat-service/api/v2/messages/typing?participantId={id}         # show a typing bubble
POST /pl4chat-service/api/v2/messages                                   # reply
POST /pl4chat-service/api/v2/messages/read?participantId={id}           # clear unread + read receipt
POST /pl4chat-service/api/v2/chats/{id}/terminate                       # close + send rating widget
```

The first call is only needed when you're building a queue view or don't have a `chatParticipantId` to hand — the chatbot webhook already gives you one. Scope it to `my`, `team`, `unassigned`, `missed-agent`, or `closed` to drive the agent's tabs.

Full walkthrough: [Live Chat guide](/guides/live-chat).

### Send an SMS

Plain SMS over the dedicated [SMS Gateway](/apis/sms) — authenticate with an API key and post your recipients:

```bash
curl -X POST https://api.payless4sms.co.za/sms/json \
  -H "Content-Type: application/json" \
  -H "X-API-Key: ecomm_your_api_key" \
  -d '{
    "messages": [
      { "recipients": [{ "to": "27821234567" }], "messageText": "Hello from eCommunicate" }
    ]
  }'
```

Need WhatsApp fallback, bulk sending, or two-way campaigns? See [Which SMS product should I use?](#which-sms-product-should-i-use).

## Channels

Live Chat
Agent-based conversations with ticket management, team assignment, and full message history across WhatsApp, Web, and Facebook.

[Live Chat Guide](/guides/live-chat)

WhatsApp Cloud
Meta's official Cloud API. Send pre-approved templates, session messages, and media with automatic SMS fallback and real-time delivery receipts.

[Messaging Guide](/guides/whatsapp-messaging)

WhatsApp Lite
Direct connection via QR code. No template restrictions — send any message at any time, manage groups, and sync contacts.

[API Reference](/apis/omnichannel)

SMS
Direct SMS with GSM 7-bit or Unicode encoding. Also works as automatic fallback when WhatsApp delivery fails.

[SMS Guide](/guides/sms-messaging)

## Everything you need to build

Agent Chat & Tickets
Chat participants with scope filters, typing indicators, read receipts, media replies, and support tickets with status workflows.

Real-time Webhooks
Get notified instantly when messages are delivered, read, or when customers reply. Five webhook types cover every event.

Conversations API
Persistent WhatsApp conversations that stay open for days or months — not limited to the standard 24-hour session window.

Template Messaging
Send pre-approved WhatsApp templates with dynamic variables, media headers, interactive buttons, and multi-card carousels.

Analytics & Reports
Track delivery rates, message volumes, and conversation metrics. Export reports as XLSX or CSV.

Batch Messaging
Send messages at scale with configurable throttling, daily schedules, and full control to pause, resume, or cancel batches.

Contact Management
Manage customer records and block/blacklist controls — all via API.

## Platform comparison

| Feature | WhatsApp Cloud | WhatsApp Lite | SMS |
|  --- | --- | --- | --- |
| Template messages | Yes | Yes | N/A |
| Session (chat) messages | Yes (24h window) | Yes (unrestricted) | N/A |
| SMS fallback | Yes | Yes | N/A |
| QR code connection | No | Yes | N/A |
| Group management | No | Yes | N/A |
| Contact sync | No | Yes | N/A |
| Direct messaging | N/A | N/A | Yes |
| Typing indicators | Yes | Yes | N/A |
| Delivery receipts | Yes | Yes | Yes |


Live Chat sits on top of these — it carries conversations from WhatsApp (Cloud or Lite), Web, and Facebook into the same agent inbox.

## Which SMS product should I use?

We offer three ways to send SMS. Pick based on how you want to integrate:

| If you want to… | Use | Style | Base URL |
|  --- | --- | --- | --- |
| Send SMS alongside WhatsApp, or as automatic **WhatsApp fallback**, through one unified API | **Omnichannel API** — [SMS channel](/guides/sms-messaging) | JSON | `api.payless4messaging.com` |
| Send **plain SMS** (single or bulk) over a simple JSON API with delivery tracking and replies | **[SMS Gateway](/guides/sms-gateway)** (Payless4SMS) | JSON | `api.payless4sms.co.za` |
| Run **high-volume, two-way campaigns** with virtual-number replies, batch receipts and scheduling | **[Biz SMS](/guides/biz-sms)** | Form-encoded, XML responses | `messaging.ecommunicate.biz` |


Not sure?
If you already use WhatsApp or want SMS to kick in only when WhatsApp fails, use the **Omnichannel API**. For a dedicated SMS integration, choose the **SMS Gateway** (modern JSON) unless you specifically need Biz SMS's virtual-number reply model or already integrate against it.

## Server environments

| Environment | Base URL | API / Channel |
|  --- | --- | --- |
| **Production** | `https://api.payless4messaging.com` | Omnichannel — WhatsApp Cloud, Live Chat |
| **Production** | `https://api.payless4messages.com` | Omnichannel — WhatsApp Lite |
| **Production** | `https://api.payless4sms.co.za` | SMS Gateway (Payless4SMS) |
| **Production** | `https://messaging.ecommunicate.biz` | Biz SMS |


## Explore the docs

| Resource | Description |
|  --- | --- |
| [Getting Started](/guides/getting-started) | Set up your account and send your first message |
| [Authentication](/guides/authentication) | API key management, security, and best practices |
| [Live Chat](/guides/live-chat) | Agent chat, chatbot flow, tickets, and team management |
| [Webhooks](/guides/webhooks) | Incoming messages, delivery receipts, and chatbot handover |
| [Conversations](/guides/conversations) | Long-lived WhatsApp conversations beyond 24 hours |
| [WhatsApp Messaging](/guides/whatsapp-messaging) | Templates, media, buttons, carousels, and SMS fallback |
| [SMS Messaging](/guides/sms-messaging) | SMS via the Omnichannel API, encoding, and character limits |
| [SMS Gateway (Payless4SMS)](/guides/sms-gateway) | Standalone bulk & transactional SMS over a JSON API |
| [Biz SMS](/guides/biz-sms) | High-volume batch SMS with two-way replies and virtual numbers |
| [Error Handling](/guides/error-handling) | Status codes, error format, and troubleshooting |
| [Rate Limits](/guides/rate-limits) | Throughput limits, pagination, and best practices |


## Need help?

Our team is here to help you integrate.

- **Email** — [support@ecommunicate.co.za](mailto:support@ecommunicate.co.za)
- **Website** — [ecommunicate.co.za](https://www.ecommunicate.co.za/)
- **API Status** — Include the `requestId` from any error response when contacting support