使用 messages
節點傳送其他訊息類型(例如聯絡人或地點訊息)給顧客。
/messages
發出 POST
呼叫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" } ] } ] }
如需參數的詳細資訊,請參閱:
成功時的回應如下:
{ "messages": [{ "id": "message-id" }] }
/messages
發出 POST
呼叫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" } }
如需參數的詳細資訊,請參閱:
成功時的回應如下:
{ "messages": [{ "id": "message-id" }] }