Reference
Send a message
Sends one template message to one WhatsApp number, using an API campaign. Send one request for each person.
https://qmessage.gatiq.in/api/v1/send| Header | Value |
|---|---|
Authorization | Bearer YOUR_API_KEY |
Content-Type | application/json |
The key can also be sent as X-Api-Key or as apiKey in the body. See API keys.
Example
curl -X POST https://qmessage.gatiq.in/api/v1/send \
-H "Authorization: Bearer $QMESSAGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"campaignName": "order_update",
"destination": "919876543210",
"userName": "Priya Sharma",
"templateParams": [
"Priya",
"#10234",
"Friday"
],
"source": "Website order",
"tags": [
"customer"
],
"attributes": {
"city": "Jaipur"
}
}'Main fields
campaignNamestringRequiredThe name of a live API campaign in this project. Capital letters don’t matter. Also accepted as campaign.
destinationstringRequiredThe customer’s WhatsApp number with the country code, for example 919876543210 or +91 98765 43210. Spaces, dashes and a leading + or 00 are fine.
A 10-digit number without a country code is taken as an Indian number. Numbers from other countries must include their country code. Also accepted as to.
templateParamsstring[]If the template has valuesValues for the template’s {{1}}, {{2}}… in the message text, in order. Send exactly as many as the template has, and none may be empty. Numbers are fine too. Also accepted as values.
Each value can be up to 1,024 characters. Line breaks and tabs are turned into spaces, because WhatsApp doesn’t allow them inside values.
paramsFallbackValueobjectValues to use when one in templateParams is empty or missing, for example when your system doesn’t know the customer’s name. Give them by placeholder or position: { "1": "there" } fills {{1}}.
If no key matches and you send exactly one fallback per value, they are used in order. So AiSensy-style { "FirstName": "there" } works for a template with one value.
userNamestringThe customer’s name, up to 80 characters. Saved on the contact if they don’t have a name in QMessage yet. Also accepted as name.
Contact fields
These are saved on the customer’s contact in QMessage. See Contacts and opt-out.
attributesobjectCustom fields to save on the contact, for example { "city": "Jaipur", "plan": "Gold" }. Names up to 40 characters, values up to 500. A field with the same name is replaced; other fields stay. You can use these fields in normal campaigns later.
sourcestringWhere the lead came from, for example Website lead or Facebook form. Saved as the contact field source. If attributes also has source, that one is used.
Fields for special templates
Send these only if the template needs them. Examples by template shows each one in a full request.
headerParamsstring[]The value for a {{1}} in a text header, up to 60 characters. One value.
media{ url, filename? }The image, video or PDF at the top of the message. url must be a public link that starts with https://. WhatsApp downloads the file from it. filename is the name a PDF shows on the customer’s phone. Leave it out to use the API campaign’s default file.
location{ latitude, longitude, name?, address? }For templates with a location at the top. Latitude from -90 to 90, longitude from -180 to 180. Leave it out to use the API campaign’s default location.
couponCodestringThe code for a “Copy offer code” button, up to 15 characters.
offerExpiresAtnumber | stringWhen a limited-time offer ends: milliseconds since 1970 (for example 1767225599000) or a date and time with a time zone (for example 2026-12-31T23:59:59+05:30). Must be in the future.
otpstringThe one-time code for an authentication template, up to 15 characters and no spaces. You can also send it as code or as the first value in templateParams.
cardsobject[]For carousel templates: one entry per card, in order. Each card has media.url (its image or video), templateParams (values for the card’s text, up to 160 characters each) and buttonParams (link endings for the card’s website buttons).
Send every card, in order. If you leave out a card’s media.url, the API campaign’s default file for that card is used. When the cards have no values and the campaign has default files, you can leave out cards completely.
carouselCardsobject[]The same as cards, in WhatsApp’s own format as AiSensy accepts it: card_index and components with header, body and button parts. Card files must be https links, not media ids. If both are sent, cards wins.
Testing
dryRunbooleanSet to true to check the request without sending anything. QMessage runs every check and returns the final message, so you can see exactly what the customer would get. Nothing is sent and nothing is charged.
{
"success": true,
"dryRun": true,
"to": "919876543210",
"template": {
"name": "order_update",
"language": "en",
"category": "UTILITY",
"type": "standard"
},
"message": {
"header": null,
"body": "Hi Priya, your order #10234 will arrive on Friday.",
"footer": "Reply STOP to opt out"
},
"note": "Checked only: nothing was sent."
}Response
When WhatsApp accepts the message:
{
"success": true,
"messageId": "6f1c2a9e-0d3b-4c71-9a55-2b7d8e4f1c20",
"waMessageId": "wamid.HBgMOTE5ODc2NTQzMjEwFQIAERgSQ0Y3",
"contactId": "c2b1f0e4-7a8d-4e2b-b1c3-5d6e7f8a9b0c",
"status": "sent"
}| Field | Meaning |
|---|---|
messageId | QMessage’s id for the message. Search for it in the API campaign’s messages. |
waMessageId | WhatsApp’s id for the message. |
contactId | The customer’s contact in QMessage. |
status | Always sent here: WhatsApp accepted it. Delivered and read follow in QMessage. |
Anything else returns success: false with an error that says what to fix. See Responses and errors.
Note