Contact Message

Use this API to send Contact messages

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

Contacts messages allow you to send rich contact information directly to Whats App users, such as names, phone numbers, physical addresses, and email addresses.


📘

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 Parameters

KeyDescriptionValueData typeRequired/OptionalConstraints
AuthorizationAccess Token for the application{{PARTNER_APP_TOKEN}}StringRequiredShould be a valid Partner App Access Token
appIdApp ID to fetch the access token{{APP_ID}}StringRequiredThe ID should be a valid Gupshup app ID.
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 typecontactsStringRequiredType should be contacts to send contacts message.
contactsAdd contact body"contacts":[<contacts body>]ArrayRequiredKey should be contacts to send contact message.

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",
    "to": "{{WHATSAPP_USER_PHONE_NUMBER}}",
		"recipient": "{{BSUID}}",
    "type": "contacts",
    "contacts": [
        {
            "addresses": [
                {
                    "street": "{{STREET_NUMBER_AND_NAME}}",
                    "city": "{{CITY}}",
                    "state": "{{STATE_CODE}}",
                    "zip": "{{ZIP_CODE}}",
                    "country": "{{COUNTRY_NAME}}",
                    "country_code": "{{COUNTRY_CODE}}",
                    "type": "{{ADDRESS_TYPE}}"
                }
                /* Additional addresses objects go here, if using */
            ],
            "birthday": "{{BIRTHDAY}}",
            "emails": [
                {
                    "email": "{{EMAIL_ADDRESS}}",
                    "type": "{{EMAIL_TYPE}}"
                }
                /* Additional emails objects go here, if using*/
            ],
            "name": {
                "formatted_name": "{{FULL_NAME}}",
                "first_name": "{{FIRST_NAME}}",
                "last_name": "{{LAST_NAME}}",
                "middle_name": "{{MIDDLE_NAME}}",
                "suffix": "{{SUFFIX}}",
                "prefix": "{{PREFIX}}"
            },
            "org": {
                "company": "{{COMPANY_OR_ORG_NAME}}",
                "department": "{{DEPARTMENT_NAME}}",
                "title": "{{JOB_TITLE}}"
            },
            "phones": [
                {
                    "phone": "{{PHONE_NUMBER}}",
                    "type": "{{PHONE_NUMBER_TYPE}}",
                    "wa_id": "{{WHATSAPP_USER_ID}}"
                }
                /* Additional phones objects go here, if using */
            ],
            "urls": [
                {
                    "url": "{{WEBSITE_URL}}",
                    "type": "{{WEBSITE_TYPE}}"
                }
                /* Additional URLs go here, if using */
            ]
        }
    ]
}'

Sample Response

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

Status Codes

Status CodeResponseComments
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
Path Params
string
required

Unique identifier of the app.

Body Params
Headers
string
required

Your app token, please refer Get access token api to get the token from partner documentation.

Responses

Language
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json