Contacts and Location Messages
Before You Start
You need to meet all the prerequisites listed in the Before You Start section of the documentation.
Step 1: Make POST Request
Contact Message
Parameters:
Name | Description | JSON Type | Default | Constraints | Required |
---|---|---|---|---|---|
type | Constant value contacts. | String | N/A | contacts | Yes |
contacts | List of contact cards. | Array[Object] | N/A | Valid contact cards | Yes |
It contains below objects:
Name | Description | JSON Type |
---|---|---|
addresses | It contain following attributes - street, city, state, zip, country, country_code, type. | Object |
birthday | YYYY-MM-DD formatted. | String |
Email address. It could be of type HOME, WORK. | Object | |
Name | Required. Full contact name formatted_name, first_name, last_name, middle_name, suffix, prefix. | Object |
Payload: Contacts Messages
{
"messages": [
{
"sender": "917859xxxxxx",
"to": "918570xxxxxx",
"transactionId": "",
"messageId": "",
"channel": "wa",
"callbackDlrUrl": "",
"type": "contacts",
"contacts": {
"addresses": [
{
"city": "Menlo Park",
"country": "United States",
"country_code": "us",
"state": "CA",
"street": "1 Hacker Way",
"type": "HOME",
"zip": "94025"
}
],
"birthday": "2012-08-18",
"emails": [
{
"email": "test@fb.com",
"type": "WORK"
}
],
"name": {
"first_name": "John",
"formatted_name": "John Smith",
"last_name": "Smith"
},
"org": {
"company": "WhatsApp",
"department": "Design",
"title": "Manager"
},
"phones": [
{
"phone": "+1 (650) 555-1234",
"type": "WORK"
}
],
"urls": [
{
"url": "https://www.facebook.com",
"type": "WORK"
}
]
}
}
],
"responseType": "json"
}
Location Message
Parameters:
Name | Description | JSON Type | Default | Constraints | Required |
---|---|---|---|---|---|
type | Constant value location. | String | N/A | location | Yes |
latitude | The latitude position as a float number. | Number | N/A | [-90, 90] | Yes |
longitude | The longitude position as a float number. | Number | N/A | [-180, 180] | Yes |
name | The name for the location. Will be displayed in the message. | String | N/A | N/A | No |
address | The address for the location. Will be displayed in the message. | String | N/A | N/A | No |
Payload: Location Messages
{
"messages": [
{
"messageid": "",
"sender": "9178XXXXXXXX",
"to": "9185XXXXXXXX",
"transactionId": "",
"callbackDlrUrl": "http://xxx.com",
"channel": "wa",
"type": "location",
"location": {
"address": null,
"latitude": 25.7090087,
"name": null,
"longitude": 81.8987465
}
}
],
"responseType": "json"
}
Step 2: Check Your Response
The response example shows a sample response from the API request: Possible elements in responses includes,
- Success Response
Payload
{
"success": true,
"responseId": "1606887827245734233232332"
}
- An unsuccessful response contains an error message. See Error and Status Codes for more information.