Voice Notes Message

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

Request Params

Key

Description

Values

Data Type

Required/Optional

Constraints

Headers

Authorisation

Access Token for the application

sk_8eb35b1f81c24af2xxxxxx

String

Required

Should be a valid Partner App Access Token.

Path Params

App Id

App ID to fetch the access token

bf9ee64c-3d4d-4ac4-xxxx-732e577007c4

String

Required

The Id should be a valid app Id of Gupshup

Body JSON

messaging_product

Messaging product

whatsapp

String

Required

recipient_type

Recipient type

individual

String

Required

to

Destination phone no where the message need to be send

91785876xxxx

String

Required

Must be a valid phone number.

type

Messaging type

audio

String

Required

Type should be audio to send audio voice message.

audio

audio message inside body

"audio": { "id": "1846406092625721", "voice": "true" }

Object

Required

  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",
  "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 Code

Response

Comment

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" }