We are sunsetting On-Premises API. Refer to our On-Premises API Sunset document for details, and to learn how to migrate to our next-generation Cloud API.
Use the messages
node to send other message types, such as contacts or location messages, to your customers.
You will need:
These messages can only be sent in response to an incoming message from your customer within the customer-care window. There is currently no support to send this within a message template.
POST
Request to /messages
POST /v1/messages { "to": "recipient-wa-id", "type": "contacts", "contacts": [ { "addresses": [ { "city": "Menlo Park", "country": "United States", "country_code": "us", "state": "CA", "street": "1 Hacker Way", "type": "HOME", "zip": "94025" }, { "city": "Menlo Park", "country": "United States", "country_code": "us", "state": "CA", "street": "200 Jefferson Dr", "type": "WORK", "zip": "94025" } ], "birthday": "2012-08-18", "emails": [ { "email": "test@fb.com", "type": "WORK" }, { "email": "test@whatsapp.com", "type": "WORK" } ], "name": { "first_name": "John", "formatted_name": "John Smith", "last_name": "Smith" }, "org": { "company": "WhatsApp", "department": "Design", "title": "Manager" }, "phones": [ { "phone": "+1 (940) 555-1234", "type": "HOME" }, { "phone": "+1 (650) 555-1234", "type": "WORK", "wa_id": "16505551234" } ], "urls": [ { "url": "https://www.facebook.com", "type": "WORK" } ] } ] }
For more information on parameters, see:
type
, use contact
.A successful response looks like this:
{ "messages": [{ "id": "message-id" }] }
POST
Request to /messages
POST /v1/messages { "to": "recipient-wa-id", "type": "location", "location": { "longitude": -122.425332, "latitude": 37.758056, "name": "Facebook HQ", "address": "1 Hacker Way, Menlo Park, CA 94025" } }
For more information on parameters, see:
type
, use location
.A successful response looks like this:
{ "messages": [{ "id": "message-id" }] }