傳送聯絡人和地點訊息

使用 messages 節點傳送其他訊息類型(例如聯絡人或地點訊息)給顧客。

準備工作

必備項目:

只能為了回覆顧客服務視窗內所傳入的訊息而傳送這些訊息。目前不支援在訊息範本內傳送訊息。

聯絡人訊息

步驟 1:向 /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"
                        }
                    ]
                }
            ]
}

如需參數的詳細資訊,請參閱:

步驟 2:檢查回應

成功時的回應如下:

{
    "messages": [{
       "id": "message-id"
    }]
}

地點訊息

步驟 1:向 /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"
    }
}

如需參數的詳細資訊,請參閱:

步驟 2:檢查回應

成功時的回應如下:

{
    "messages": [{
       "id": "message-id"
    }]
}