whatsapp消息入口

whatsapp消息入口,推送消息给所有接收者

当whatsapp公众号发送消息时相当于bot发送消息。可接收多渠道发来的消息。当用户发送消息时,Bot将此消息推送给所有接收者。接收者可以定义为接收bot信息,或接收livechat信息。( 如想要变为接收者请与我们联系 )

发送请求

Bot向所有接收者发起推送,推送请求的说明如下:

请求属性 属性名 说明
请求方式 POST
Form Data id 由WhatsApp分配的消息ID
Form Data to channel的手机号
Form Data from 客户的手机号
Form Data timestamp 信息发送的时间戳
Form Data type 消息类型(text,image,document,voice)
Form Data text 当type=text 时显示。形式会在下方详述。
Form Data image 当type=image 时显示。形式会在下方详述。
Form Data document 当type=document 时显示。形式会在下方详述。
Form Data voice 当type=voice 时显示。形式会在下方详述。

请求样例

Text message:

{
    "id": "<unique message identifier>",
    "from": "<phone number of the channel>",
    "to": "<phone number of the user>",
    "timestamp": "<timestamp>",
    "type": "text",
    "text": {
        "body": "Hello world"
    }
}

Image message:

{
    "id": "<unique message identifier>",
    "from": "<phone number of the channel>",
    "to": "<phone number of the user>",
    "timestamp": "<timestamp>",
    "type": "image",
    "image": {
        "url": "your-media-url",
        "caption": "your-image-caption",
        "mimeType": "<see the list of available mimeType>"
    }
}

Document message:

{
    "id": "<unique message identifier>",
    "from": "<phone number of the channel>",
    "to": "<phone number of the user>",
    "timestamp": "<timestamp>",
    "type": "document",
    "document": {
        "url": "your-document-url",
        "caption": "your-document-caption",
        "mimeType": "<see the list of available mimeType>"
    }
}

Voice message:

{
    "id": "<unique message identifier>",
    "from": "<phone number of the channel>",
    "to": "<phone number of the user>",
    "timestamp": "<timestamp>",
    "type": "voice",
    "voice": {
        "url": "your-voice-url",
        "mimeType": "<see the list of available mimeType>"
    }
}

请求返回值

{
    "status": 200,
    "data": {}
}

results matching ""

    No results matching ""