Audio

cURL

curl --location 'https://api.gupshup.io/wa/api/v1/msg' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'apikey: {{APIKEY}}' \
--data-urlencode 'source={{SOURCE}}' \
--data-urlencode 'destination={{DESTINATION}}' \
--data-urlencode 'message={
   "type":"audio",
   "url":"{{AUDIO_URL}}"
}' \
--data-urlencode 'src.name={{APP_NAME}}'

Sample Request

With URL, Without Context

curl --location 'https://api.gupshup.io/wa/api/v1/msg' \
--header 'Cache-Control: no-cache' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'apikey: xvnwgh9vgbbl6gjeezymu5v5iepxq2zt' \
--header 'cache-control: no-cache' \
--data-urlencode 'channel=whatsapp' \
--data-urlencode 'source=918097424541' \
--data-urlencode 'destination=91735824xxxx' \
--data-urlencode 'message={
   "type":"audio",
   "url":"https://www.buildquickbots.com/whatsapp/media/sample/audio/sample02.mp3"
}' \
--data-urlencode 'src.name=TedLasso'

With Media ID, Without Context

curl --location 'https://api.gupshup.io/wa/api/v1/msg' \
--header 'Cache-Control: no-cache' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'apikey: xvnwgh9vgbbl6gjeezymu5v5iepxq2zt' \
--header 'cache-control: no-cache' \
--data-urlencode 'channel=whatsapp' \
--data-urlencode 'source=918097424541' \
--data-urlencode 'destination=91735824xxxx' \
--data-urlencode 'message={
  "type": "audio",
  "id": "762625265226526"
}' \
--data-urlencode 'src.name=TedLasso'

With Context

curl --location 'https://api.gupshup.io/wa/api/v1/msg' \
--header 'Cache-Control: no-cache' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'apikey: xvnwgh9vgbbl6gjeezymu5v5iepxq2zt' \
--header 'cache-control: no-cache' \
--data-urlencode 'channel=whatsapp' \
--data-urlencode 'source=918097424541' \
--data-urlencode 'destination=91735824xxxx' \
--data-urlencode 'message={
   "context":{
      "msgId":"9c9ee217-db34-47ac-8922-17ee5b69cec3"
   }
   "type": "audio",
   "id": "762625265226526"
}' \
--data-urlencode 'src.name=TedLasso'

Request Parameters

Header Parameters

Parameter NameLocationTypeDescriptionRequiredExample
apikeyHeaderstringAPIKEY of your Gupshup AccountYes61b3021c97214370b341f8baaae0xxxx

Form Parameters

Parameter NameLocationTypeDescriptionRequiredExample
sourceFormintegerSource Phone NumberYes918929874278
destinationFormintegerDestination Phone NumberYes918805162043
src.nameFormstringApp NameYesaugust18
messageFormobjectMessage object (refer to schema)YesRefer to Message schema below

Message Object (Form Parameter)

Property NameTypeDescriptionRequiredExample
contextobjectMessage contextNo{ "msgId": "uniqueMsgId" }
typestringType of session messageYesaudio
idstringMedia IdNoMEDIA_ID if URL is not provided
urlstringURL of the fileNohttps://www.buildquickbots.com/whatsapp/media/sample/audio/sample02.mp3

Response Parameters

Parameter NameTypeDescriptionExample
statusstringResponse statussubmitted
messageIdstringUnique message ID183dc8f1-7ecc-4419-895f-04fd0b1bfe07
messagestringError messageInvalid Destination, Invalid App Details, Authentication Failed, Too Many Requests
statusstringStatus of the requesterror

Status Codes

Status CodeDescriptionResponse Schema
200Successful response{ "status": "submitted", "messageId": "183dc8f1-7ecc-4419-895f-04fd0b1bfe07" }
400Bad Request{ "message": "Invalid Destination", "status": "error" }
or
{ "message": "Invalid App Details", "status": "error" }
401Authentication Failed{ "message": "Authentication Failed", "status": "error" }
429Too Many Requests{ "message": "Too Many Requests", "status": "error" }
Language
Click Try It! to start a request and see the response here!