DiceXDiceX/ Blog

WhatsApp messaging API: send WhatsApp and Telegram messages from your own software

A developer's overview of the DiceX WhatsApp messaging API: authentication, sending messages, files and polls, checking status and reading incoming messages, and how it relates to the panel.

4 min read

The DiceX WhatsApp messaging API lets your own software send WhatsApp messages from your number, and messages through your messaging bots, without anyone opening a panel. You can send texts, files, polls, contact cards, locations and reactions, check the status of each message, and read the messages you received. It is the same service as DiceX Social Messaging, so everything you send by API shows up in the same account, reports and wallet.

This guide is an overview for developers. The complete, generated reference is at docs.dicex.me.

When to use the API instead of the panel

The panel suits campaigns that a person prepares and schedules. The API suits messages that your system triggers:

  • an order confirmation or an invoice file as soon as payment succeeds
  • a shipping update when a parcel status changes
  • a poll after a support ticket closes
  • pulling customer replies into your own CRM or helpdesk

Many teams use both: marketing runs campaigns from the panel, while the shop or CRM sends transactional messages through the API from the same lines.

How the WhatsApp messaging API is organised

Requests go to the DiceX gateway, https://gateway.dicex.me, and are authenticated with your API key in an ApiKey header.

The messaging endpoints sit in two sections of the reference:

  • WhatsApp (/api/v1/WhatsApp/...): sending from your connected WhatsApp lines, plus WhatsApp-specific calls.
  • Social (/api/v1/Social/...): the general messaging section for social messaging platforms. Its requests carry a providerName field alongside the line number.

What you want to do

WhatsApp endpoint

Social endpoint

Send a text message

POST WhatsApp/SendMessage

POST Social/SendMessage

Send a file

POST WhatsApp/SendFile

POST Social/SendFile

Send a poll

POST WhatsApp/SendPoll

POST Social/SendPoll

Send a contact card

POST WhatsApp/SendContact

POST Social/SendContact

Send a location

POST WhatsApp/SendLocation

POST Social/SendLocation

Send a reaction

POST WhatsApp/SendReaction

POST Social/SendReaction

Check a message's status

GET WhatsApp/GetMessageStatus

GET Social/GetMessageStatus

Read received messages

GET WhatsApp/GetReceivedWhatsApps

GET Social/GetReceiveds

Get a message's data

GET WhatsApp/GetMessageData

GET Social/GetMessageData

The WhatsApp section also has calls named CheckStatus (for a line), IsWhatsAppUser (for a line and a mobile number), GetChats, GetGroups and GetProfileImage. Check the reference for their exact parameters and responses.

Sending a message

A send request names the line it goes from, the receiver and the content. The main fields of a text message are:

  • lineNumber: the line you connected in the panel
  • receiver: who gets the message
  • message: the text
  • scheduleDate (optional): when to send it, as a date-time
  • messageId (optional)

A minimal request looks like this:

```bash
curl -X POST "https://gateway.dicex.me/api/v1/WhatsApp/SendMessage"
-H "ApiKey: YOUR_API_KEY"
-H "Content-Type: application/json"
-d '{
"lineNumber": "<your connected line>",
"receiver": "<recipient>",
"message": "Your order has shipped. The invoice follows in the next message."
}'
```

Replace the placeholders with values in the format the reference describes. Keep your API key on the server; never ship it in a browser or mobile app.

Files, polls and more

The other send calls share the same base fields and add their own:

  • Files: fileName, fileData, mimeType and an optional caption.
  • Polls: pollName, pollOptions (a list of strings), allowMultipleAnswers and an optional caption.
  • Contacts and locations: their own fields for the card or the place.

Because a message is not split into parts like an SMS, you can send a long text or a document in one request. Each app still has its own limits on text length, file size and sending rate, so handle errors and do not assume sending is unlimited.

Checking status and reading replies

After a send, call GetMessageStatus with the message's id to see whether it was sent, delivered to the device or read. GetMessageData returns the data of a message by id.

To read incoming messages, GetReceivedWhatsApps (WhatsApp) and GetReceiveds (Social) take a lineNumber, a lastMessageId and a total. Passing the last ID you processed lets you work through new messages in order, for example on a schedule from a background job.

Working with bots

Bots behave differently from phone numbers, and your integration should expect that:

  • A Telegram bot can only message people who started a chat with it or added it to their group. A phone number alone is not enough.
  • A Discord bot messages channels on your Discord server, not phone numbers.

Design your flows around those rules: for Telegram, invite customers to the bot first; for Discord, treat messages as channel posts and alerts.

Before you go live

  1. Create a DiceX account and connect your WhatsApp number or bot as a line in the panel. Each line's activation cost is shown before you confirm.
  2. Top up your wallet. Usage is paid from your DiceX wallet.
  3. Send to yourself first and check the status call returns what you expect.
  4. Log message IDs so you can match statuses and replies to your own records.
  5. Respect consent. Send business messages only to people who expect them, and give them a way to stop.

Next step

Open the full API reference at docs.dicex.me and the developers hub for related guides. For product features, see the Social Messaging hub and the product page. If you also need SMS for login codes, the SMS hub covers it.

Frequently asked questions

How do I authenticate with the DiceX messaging API?

Requests go to the DiceX gateway at gateway.dicex.me with your API key in an ApiKey header. The full reference is at docs.dicex.me.

What can the messaging API send?

Messages, files, polls, contact cards, locations and reactions. You can also check the status of each message and read the messages you received.

Do I need to set up lines in the panel first?

Yes. You connect your WhatsApp number or messaging bot as a line in the DiceX panel, and API requests name the line they send from.

Can the API reach a Telegram user who never contacted my bot?

No. With a Telegram bot, the person must first have started a chat with the bot or added it to their group; having their phone number is not enough.

For developers

Related articles