Send session message API's

Sends a WhatsApp message to a recipient using the configured WhatsApp account for the authenticated user. Supports text, media, location, contacts, interactive, reaction, and template payloads in Meta-style format.


Send Session Message

Endpoint

POST https://wa20.nuke.co.in/v6/api/whatsapp/24/{{username}}/messages

Replace {{username}} in the URL with your account username.


Authentication

Required. Send a JWT in one of these ways:

MethodExample
HeaderAuthorization: Bearer <jwt_token>
Cookieauth_token=<jwt_token>

The {{username}} in the URL must match the username inside your JWT. If they don't match, the request is rejected with 401 Route username does not match authenticated user.


Headers

HeaderValue
Content-Typeapplication/json
AuthorizationBearer <jwt_token>

Body Parameters

ParameterTypeRequiredDescription
messaging_productstringYesMust always be "whatsapp".
recipient_typestringNoDefaults to "individual".
tostringYesRecipient phone number with country code. +, spaces, and dashes are cleaned automatically.
typestringYesMessage type. Supported: text, image, audio, video, document, sticker, location, contacts, interactive, reaction, template.
textobjectConditionallyRequired when type = "text".
imageobjectConditionallyRequired when type = "image". Must contain id or link.
audioobjectConditionallyRequired when type = "audio". Must contain id or link.
videoobjectConditionallyRequired when type = "video". Must contain id or link.
documentobjectConditionallyRequired when type = "document". Must contain id or link.
stickerobjectConditionallyRequired when type = "sticker". Must contain id or link.
locationobjectConditionallyRequired when type = "location". Must contain latitude and longitude.
contactsarrayConditionallyRequired when type = "contacts". Must be a non-empty array.
interactiveobjectConditionallyRequired when type = "interactive".
reactionobjectConditionallyRequired when type = "reaction". Must contain message_id and emoji.
templateobjectConditionallyRequired when type = "template". If used here, the request is internally handled by the template-message flow.

Payload Examples

1. Text message

{
  "messaging_product": "whatsapp",
  "to": "919912345678",
  "type": "text",
  "text": {
    "body": "Hello Rahul"
  }
}

2. Image message

{
  "messaging_product": "whatsapp",
  "to": "919912345678",
  "type": "image",
  "image": {
    "link": "https://example.com/sample.jpg"
  }
}

3. Document message

{
  "messaging_product": "whatsapp",
  "to": "919912345678",
  "type": "document",
  "document": {
    "link": "https://example.com/invoice.pdf"
  }
}

4. Location message

{
  "messaging_product": "whatsapp",
  "to": "919912345678",
  "type": "location",
  "location": {
    "latitude": 28.6139,
    "longitude": 77.2090,
    "name": "New Delhi",
    "address": "Delhi, India"
  }
}

5. Reaction message

{
  "messaging_product": "whatsapp",
  "to": "919912345678",
  "type": "reaction",
  "reaction": {
    "message_id": "wamid.HBgM...",
    "emoji": "👍"
  }
}

6. Interactive message

{
  "messaging_product": "whatsapp",
  "to": "919912345678",
  "type": "interactive",
  "interactive": {
    "type": "button",
    "body": {
      "text": "Choose an option"
    },
    "action": {
      "buttons": [
        {
          "type": "reply",
          "reply": {
            "id": "yes",
            "title": "Yes"
          }
        }
      ]
    }
  }
}

Example Response — 200 OK

On success, the provider response is passed through directly.

{
  "messaging_product": "whatsapp",
  "contacts": [
    {
      "input": "919912345678",
      "wa_id": "919912345678"
    }
  ],
  "messages": [
    {
      "id": "wamid.HBgM..."
    }
  ]
}

Error Responses

StatusMessageReason
400Invalid Authorization tokenJWT missing/invalid.
401Route username does not match authenticated userRoute username and JWT username mismatch.
404No WhatsApp account found for this usernameNo WhatsApp account mapped to this username.
400messaging_product must be whatsappInvalid or missing messaging_product.
400`to is required`Recipient missing.
400`type is required`Message type missing.
400Recipient phone number is invalidNumber invalid after cleanup.
400Recipient phone number must be between 8 and 20 digitsNumber length invalid.
400`text.body is required`Missing text body for text message.
400`image is required`Image object missing.
400`image.id or image.link is required`Image source missing.
400`audio.id or audio.link is required`Audio source missing.
400`video.id or video.link is required`Video source missing.
400`document.id or document.link is required`Document source missing.
400`sticker.id or sticker.link is required`Sticker source missing.
400`location.latitude and location.longitude are required`Location coordinates missing.
400`contacts must be a non-empty array`Contacts payload invalid.
400`interactive is required`Interactive payload missing.
400`reaction.message_id and reaction.emoji are required`Reaction payload invalid.
404Missing phone-number ID for this WhatsApp accountAccount config incomplete.
404Missing account token for this WhatsApp accountProvider token missing.
500Unable to resolve provider endpointCould not build provider API endpoint.
502(provider error message)Provider rejected the request or returned an error.

Notes

  • Phone numbers are normalized before sending.
  • For non-template messages, the request is sent directly to the provider.
  • If type = "template" is sent on this endpoint, it is internally redirected to template-message handling.