Skip to main content

Messaging API

Send different types of WhatsApp messages, and read the ones your instance receives.

Sending requests are POST with Content-Type: application/json. All requests must include the X-API-KEY header. Responses follow {message: string, success: boolean, code: number, data: any}.

Receivers use the international format, digits only, without the leading plus sign (e.g., 14155552671), or a group ID with group: true. The instance must be connected.

Common Parameters​

Every message endpoint accepts these optional parameters in the request body to control delivery and tracking:

  • group (boolean): Set this to true if the receiver is a WhatsApp Group ID rather than a phone number. This ensures the message is correctly routed to the group chat.
  • sendsAt (string | null): An ISO 8601 date with a timezone (e.g., 2026-12-25T10:00:00Z). If it is in the future, Communiktor schedules the message and sends it at that time; it can be cancelled until then. Use null or omit it for immediate delivery.
  • metadata (object): A custom JSON object of your choice. This data is not sent to the WhatsApp recipient but is stored by Communiktor. When a webhook event (like message.sent or message.read) is triggered for this message, your metadata will be included in the webhook payload, allowing you to easily link the event back to your internal systems (e.g., an order ID or a customer UUID).

Response​

Every message endpoint answers as soon as the message is accepted, with its identifier in data.message:

{
"success": true,
"code": 200,
"message": "The message has been scheduled successfully",
"data": {
"message": "0193a6a2-5c1e-7c43-9a59-3f0f5a6f2b1d"
}
}
  • Keep data.message: it identifies the message in the webhooks (data.message.message) and is needed to cancel a scheduled message.
  • The delivery happens right after the response. Its outcome is reported by the message.sent or message.sent.failed webhooks, then message.received and message.read.
  • Messages of one instance are sent one at a time, in the order they were accepted.
  • The request is refused with HTTP 400 when the receiver is not on WhatsApp or the instance is not connected (see message).

Text​

POST /messages/text

When to use it

  • Send plain text updates, OTPs, and quick replies.
  • Ideal for low-latency transactional notifications.

Body

  • instance: string — Your instance identifier.
  • receiver: string — E.164 digits without plus.
  • text: string — The message text.
  • group?: boolean — Set to true if the receiver is a WhatsApp group.
  • sendsAt?: string | null — Optional ISO 8601 date to schedule the message.
  • metadata?: object — Optional JSON object that will be returned in webhooks.
curl -X POST https://api.communiktor.com/messages/text \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-d '{
"instance": "my-instance-1",
"receiver": "14155552671",
"text": "Hello from Communiktor!",
"group": false,
"sendsAt": "2024-12-25T10:00:00Z",
"metadata": {"orderId": "ORD-12345"}
}'

Image​

POST /messages/image

When to use it

  • Send product photos, tickets, receipts, or screenshots.
  • Use viewOnce for sensitive content that should not persist in the chat.

Body

  • instance: string — Your instance identifier.
  • receiver: string — E.164 digits without plus.
  • url: string — Publicly accessible image URL.
  • viewOnce?: boolean — If true, the media disappears after being viewed once.
  • caption?: string — Optional text shown below the image.
  • group?: boolean — Set to true if the receiver is a WhatsApp group.
  • sendsAt?: string | null — Optional ISO 8601 date to schedule the message.
  • metadata?: object — Optional JSON object that will be returned in webhooks.
curl -X POST https://api.communiktor.com/messages/image \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-d '{
"instance": "my-instance-1",
"receiver": "14155552671",
"url": "https://example.com/image.jpg",
"caption": "Order #12345",
"viewOnce": false,
"group": false,
"sendsAt": "2024-12-25T10:00:00Z",
"metadata": {"orderId": "ORD-12345"}
}'

Video​

POST /messages/video

When to use it

  • Send feature demos, announcements, or short clips.
  • Use asGif/asNote for lightweight previews when appropriate.

Body

  • instance: string — Your instance identifier.
  • receiver: string — E.164 digits without plus.
  • url: string — Publicly accessible video URL.
  • asGif?: boolean — Send as short looping preview (no sound).
  • asNote?: boolean — Send as a circular video note (like push-to-talk style).
  • caption?: string — Optional text shown below the video.
  • viewOnce?: boolean — If true, the media disappears after being viewed once.
  • group?: boolean — Set to true if the receiver is a WhatsApp group.
  • sendsAt?: string | null — Optional ISO 8601 date to schedule the message.
  • metadata?: object — Optional JSON object that will be returned in webhooks.
curl -X POST https://api.communiktor.com/messages/video \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-d '{
"instance": "my-instance-1",
"receiver": "14155552671",
"url": "https://example.com/video.mp4",
"caption": "Feature demo",
"asGif": false,
"asNote": false,
"viewOnce": false,
"group": false,
"sendsAt": "2024-12-25T10:00:00Z",
"metadata": {"orderId": "ORD-12345"}
}'

Audio​

POST /messages/audio

When to use it

  • Share voice notes, short audio confirmations, or hotline messages.
  • Use asNote for a push-to-talk style waveform.

Body

  • instance: string — Your instance identifier.
  • receiver: string — E.164 digits without plus.
  • url: string — Publicly accessible audio URL.
  • asNote?: boolean — Send as a voice note (push-to-talk style).
  • viewOnce?: boolean — If true, the media disappears after being viewed once.
  • group?: boolean — Set to true if the receiver is a WhatsApp group.
  • sendsAt?: string | null — Optional ISO 8601 date to schedule the message.
  • metadata?: object — Optional JSON object that will be returned in webhooks.
curl -X POST https://api.communiktor.com/messages/audio \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-d '{
"instance": "my-instance-1",
"receiver": "14155552671",
"url": "https://example.com/audio.mp3",
"asNote": false,
"viewOnce": false,
"group": false,
"sendsAt": "2024-12-25T10:00:00Z",
"metadata": {"orderId": "ORD-12345"}
}'

Document​

POST /messages/document

When to use it

  • Send PDFs, invoices, contracts, or other business files.
  • Set filename to control how the file appears to the recipient.

Body

  • instance: string — Your instance identifier.
  • receiver: string — E.164 digits without plus.
  • url: string — Publicly accessible document URL.
  • viewOnce?: boolean — If true, the media disappears after being viewed once.
  • caption?: string — Optional text shown below the document.
  • filename?: string — File name shown to the recipient.
  • group?: boolean — Set to true if the receiver is a WhatsApp group.
  • sendsAt?: string | null — Optional ISO 8601 date to schedule the message.
  • metadata?: object — Optional JSON object that will be returned in webhooks.
curl -X POST https://api.communiktor.com/messages/document \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-d '{
"instance": "my-instance-1",
"receiver": "14155552671",
"url": "https://example.com/invoice.pdf",
"caption": "Invoice May",
"filename": "invoice-may.pdf",
"viewOnce": false,
"group": false,
"sendsAt": "2024-12-25T10:00:00Z",
"metadata": {"orderId": "ORD-12345"}
}'

Location​

POST /messages/location

When to use it

  • Share store locations, delivery coordinates, or meeting points.
  • Include name/address to display a readable pin name.

Body

  • instance: string — Your instance identifier.
  • receiver: string — E.164 digits without plus.
  • location: object — Coordinates and label to pin on the map:
    • latitude: number — Latitude in decimal degrees.
    • longitude: number — Longitude in decimal degrees.
    • name?: string — Pin title shown to the user.
    • address?: string — Human‑readable address for the pin.
  • group?: boolean — Set to true if the receiver is a WhatsApp group.
  • sendsAt?: string | null — Optional ISO 8601 date to schedule the message.
  • metadata?: object — Optional JSON object that will be returned in webhooks.
curl -X POST https://api.communiktor.com/messages/location \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-d '{
"instance": "my-instance-1",
"receiver": "14155552671",
"location": {"latitude": 37.7749, "longitude": -122.4194, "name": "Communiktor HQ", "address": "1 Market St, San Francisco"},
"group": false,
"sendsAt": "2024-12-25T10:00:00Z",
"metadata": {"orderId": "ORD-12345"}
}'

vCard​

POST /messages/vcard

When to use it

  • Share a contact card for sales agents, stores, or support lines.
  • Ensure the contact phone is E.164 digits to allow immediate messaging.

Body

  • instance: string — Your instance identifier.
  • receiver: string — E.164 digits without plus.
  • name: string — Title of the card shown in the chat.
  • contact: object with fields:
    • fullname: string — Contact full name.
    • phone: string — E.164 digits without plus.
    • waid?: string — WhatsApp ID of the contact (if known).
    • organization?: string — Company or organization name.
    • title?: string — Role or job title.
    • email?: string — Contact email address.
    • url?: string — Website or profile URL.
    • address?: string — Postal address.
    • note?: string — Additional notes.
  • group?: boolean — Set to true if the receiver is a WhatsApp group.
  • sendsAt?: string | null — Optional ISO 8601 date to schedule the message.
  • metadata?: object — Optional JSON object that will be returned in webhooks.
curl -X POST https://api.communiktor.com/messages/vcard \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-d '{
"instance": "my-instance-1",
"receiver": "14155552671",
"name": "Sales Contact",
"contact": {
"fullname": "Jane Doe",
"phone": "14155552671",
"organization": "ACME Inc.",
"title": "Account Executive",
"email": "jane.doe@example.com",
"url": "https://example.com",
"address": "1 Market St, San Francisco",
"note": "VIP client handler"
},
"group": false,
"sendsAt": "2024-12-25T10:00:00Z",
"metadata": {"orderId": "ORD-12345"}
}'

Cancel a scheduled message​

POST /messages/cancel

When to use it

  • Cancel a message scheduled with sendsAt before it is sent (an appointment was moved, an order was cancelled).

Body

  • instance: string — Your instance identifier.
  • message: string — The message identifier returned when the message was created (data.message).

Only messages that have not been sent yet can be cancelled. Otherwise, the API answers HTTP 404 with the message Message not found or already sent.

curl -X POST https://api.communiktor.com/messages/cancel \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-d '{
"instance": "my-instance-1",
"message": "0193a6a2-5c1e-7c43-9a59-3f0f5a6f2b1d"
}'

Response

{
"success": true,
"code": 200,
"message": "Message cancelled successfully",
"data": {
"message": "0193a6a2-5c1e-7c43-9a59-3f0f5a6f2b1d"
}
}

Received messages​

GET /messages/incoming

When to use it

  • Give a chatbot or an AI agent the recent conversation with a customer.
  • Catch up on the messages your server missed while it was down, instead of relying only on the message.incoming webhook.

Communiktor keeps the messages your instance receives in direct conversations for 30 days, with their files, whether the webhook is enabled or not. Group messages are not kept. The messages you send are tracked through their own identifiers and webhooks.

Query parameters

  • instance: string — Your instance identifier.
  • phone: string (optional) — Only the messages from this phone number (international format, digits only).
  • since: string (optional) — Only the messages received at or after this ISO 8601 date (e.g. 2026-11-26T00:00:00Z).
  • until: string (optional) — Only the messages received before this ISO 8601 date.
  • limit: number (optional) — Messages per page, from 1 to 100. Default: 50.
  • cursor: string (optional) — The next_cursor of the previous page.

Messages come newest first. When data.next_cursor is not null, pass it as cursor to get the older ones. Each message has the same fields as data.message in the message.incoming webhook, except the group fields. File links (media.url) are valid one hour: call the endpoint again to get a fresh one.

curl -G https://api.communiktor.com/messages/incoming \
-H "X-API-KEY: YOUR_API_KEY" \
--data-urlencode "instance=my-instance-1" \
--data-urlencode "phone=14155552671" \
--data-urlencode "limit=20"

Response

{
"success": true,
"code": 200,
"message": "Received messages",
"data": {
"messages": [
{
"id": "3EB0A1B2C3D4E5F60718",
"type": "image",
"text": "Do you have this one in blue?",
"mime": "image/jpeg",
"sender": "14155552671",
"name": "Ana",
"timestamp": "2026-11-26T10:16:42Z",
"reply_to": null,
"media": {
"url": "https://…/incoming/…?X-Amz-Expires=3600&X-Amz-Signature=…",
"expires_at": "2026-11-26T11:20:03Z",
"mime": "image/jpeg",
"size": 81234,
"file_name": null
},
"location": null,
"contact": null
},
{
"id": "3EB0C767D26A1D8B4F3A",
"type": "text",
"text": "Hello, is the red dress still available?",
"mime": null,
"sender": "14155552671",
"name": "Ana",
"timestamp": "2026-11-26T10:15:00Z",
"reply_to": null,
"media": null,
"location": null,
"contact": null
}
],
"next_cursor": "5b0d7a3e-8f8f-4a52-9a3c-0c9a6f1f2e11"
}
}

The request is refused with HTTP 400 when limit is out of range or phone is not a phone number.