Voice Notes Message

Use this API to send a Audio Voice Notes Message to a WhatsApp user.


📘

Note:

  1. Use the recipient parameter only when BSUID is enabled for the app.
  2. When both to and recipient fields are used in the payload, the to field gets the priority.

Request Params

KeyDescriptionValuesData TypeRequired/OptionalConstraints
Headers
AuthorisationAccess Token for the applicationsk_8eb35b1f81c24af2xxxxxxStringRequiredShould be a valid Partner App Access Token.
Path Params
App IdApp ID to fetch the access tokenbf9ee64c-3d4d-4ac4-xxxx-732e577007c4StringRequiredThe Id should be a valid app Id of Gupshup
Body JSON
messaging_productMessaging productwhatsappStringRequired
recipient_typeRecipient typeindividualStringRequired
toDestination phone number where the message needs to be sent91785876xxxxStringRequired (Can be optional if BSUID is enabled for the app and recipient parameter is used instead)Must be a valid phone number
recipientDestination BSUID where the message needs to be sentIN.461449821882xxxxStringOptionalMust be a valid BSUID
typeMessaging typeaudioStringRequiredType should be audio to send audio voice message.
audioaudio message inside body"audio": { "id": "1846406092625721", "voice": "true" }ObjectRequired
  1. Out of 5 supported audio types, only audio/ogg (OPUS codecs only) will support this feature. For other formats, this flag will be ignored and regular audio message will be delivered
  2. New boolean field (voice) is optional with a default value of false.
  3. For voice message transcription, consumers must have the required settings else regular audio messages will be delivered.

Sample Request

curl --location 'https://partner.gupshup.io/partner/app/b544df62-437c-4f1c-bcb4xxxxe71d4/v3/message' \
--header 'Authorization: sk_21f6400d537f46b3axxxx' \
--header 'Content-Type: application/json' \
--data '{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "91986022xxxx",
  "recipient": "IN.4614498218826880",
  "type": "audio",
  "audio": {
    "id": "1846406092625721",
    "voice": "true"
  }
}'

Sample Response

{
    "messages": [
        {
            "id": "GUPSHUP_MESSAGE_ID"
        }
    ],
    "messaging_product": "whatsapp",
    "contacts": [
        {
            "input": "DESTINATION_PHONE_NO",
            "wa_id": "DESTINATION_PHONE_NO"
        }
    ]
}

Status codes

Status CodeResponseComment
Success
200{ "messages": [ { "id": "GUPSHUP_MESSAGE_ID" } ], "messaging_product": "whatsapp", "contacts": [ { "input": "DESTINATION_PHONE_NO", "wa_id": "DESTINATION_PHONE_NO" } ] }
Error
401{ "status": "error", "message": "Authentication Failed" }When API key authentication fails
400{ "message": "Callback Billing must be enabled for this API", "status": "error" }