Address messages give your users a simpler way to share the shipping address with the business on Whats App.
Address messages are interactive messages that contain the 4 main parts: header, body, footer, and action. Inside the action component business specifies the name “address_message” and relevant parameters.
Request Parameters
Key | Description | Value | Data type | Required/Optional | Constraints |
---|---|---|---|---|---|
Authorization | Access Token for the application | {{PARTNER_APP_TOKEN}} | String | Required | Should be a valid Partner App Access Token |
appId | App ID to fetch the access token | {{APP_ID}} | String | Required | The Id should be a valid app Id of Gupshup. |
messaging_product | Messaging product | 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 | interactive | String | Required | Type should be interactive to send address message. |
interactive | Add address body | "interactive": {"type": "address_message","body":{"text": "Thanks for your order! Tell us what address you’d like this order delivered to."}, "action": { "name": "address_message", "parameters": { "country": "IN", "values": { "name": "CUSTOMER_NAME", "phone_number": "+91xxxxxxxxxx" } } }} | Object | Required | • Key should be interactive to send address message. • Currently address messages are supported in the following two countries: India and Singapore. |
Sample Request
curl --location --request POST 'https://partner.gupshup.io/partner/app/{{APP_ID}}/v3/message' \
--header 'Authorization: {{PARTNER_APP_TOKEN}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "{{WHATSAPP_USER_PHONE_NUMBER}}",
"type": "interactive",
"interactive": {
"type": "address_message",
"body": {
"text": "{{TEXT_MSG}}"
},
"action": {
"name": "address_message",
"parameters": {
"country": "{{COUNTRY_ISO_COD}}"
}
}
}
}'
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 | Comments |
---|---|---|
Success | ||
200 | { "messages": [{"id": "GUPSHUP_MESSAGE_ID"}],"messaging_product": "whatsapp","contacts": [{"input": "DESTINATION_PHONE_NO", "wa_id": "DESTINATION_PHONE_NO" } ] } | |
Error | ||
400 | { "message": "Callback Billing must be enabled for this API","status": "error"} | if Callback billing is not enabled for the app |
400 | { "message": "Invalid App Details","status": "error"} | if app details are not found |
401 | { "status": "error","message": "Authentication Failed"} | When API key authentication fails |