Send Passive Response Message
For each POST request from Weibo, developer can respond it by return a specific JSON in response body. You can send a passive response message by this specific JSON.
Weibo Server will disconnect and request your callback url again if can't receive any response in 5 seconds. Weibo Server will retry 3 times in total.
About eliminating the repetitive messages which may result from the retry mechanism, we recommend you eliminating the repetitive message by using sender_id plus created_at.
If developer can't respond in 5 seconds, developer can reply with blank string. Weibo Server will not do anything with your blank string and will not retry after receiving your blank string. In this case, you can try to use Send Customer Service Message.
Reply With A Text Message
If you want to reply with a text message, the JSON format you respond as the following:
Notes:the content of data parameter should be URLEncoded with UTF8 format
//the message you reply { "result": true, "receiver_id":456, "sender_id":123, "type": "text", "data":"{ "text": "中文消息" }" } //the message after URLencode { "result":true, "sender_id":"123", "receiver_id":"456", "type":"text", "data":"%7B%22text%22%3A%22%E4%B8%AD%E6%96%87%E6%B6%88%E6%81%AF%22%7D" }
the Parameters which data parameter supported | |||
---|---|---|---|
Parameter | Type | Requires | Description |
text | string | true | The text content you want to reply.The content should by less than 300 Chinese Characters. |
For example: When the json of data is {"text": "纯文本响应"} ,the data parameter after URLEncode is:"%7B%22text%22%3A%20%22%E7%BA%AF%E6%96%87%E6%9C%AC%E5%93%8D%E5%BA%94%22%7D%20"
Reply With A Image-Text Message
If you want to reply with a image-text message, the JSON format you respond as the following:
//the message you reply { "result": true, "receiver_id":456, "sender_id":123, "type": "articles", "data": { "articles": [ { "display_name": "两个故事", "summary": "今天讲两个故事,分享给你。谁是公司?谁又是中国人?", "image": "http://storage.mcp.weibo.cn/0JlIv.jpg", "url": "http://e.weibo.com/mediaprofile/article/detail?uid=1722052204&aid=983319" }, ... //最多支持8个图文,建议为1或3个 ] } } //the message after URLencode { "result": true, "sender_id":"123", "receiver_id":"456", "type": "articles", "data":"%7B%22articles%22%3A%5B%7B%22display_name%22%3A%22%E4%B8%A4%E4%B8%AA%E6%95%85%E4%BA% 8B%22%2C%22summary%22%3A%22%E4%BB%8A%E5%A4%A9%E8%AE%B2%E4%B8%A4%E4%B8%AA%E6%95%85%E4%BA%8B%EF%BC%8C%E5%88%86%E4%BA%AB%E7%BB%99%E4%BD%A0%E3%80%82%E8%B0%81%E6%98%AF%E5%85%AC%E5%8F%B8%EF%BC%9F%E8%B0%81%E5%8F%88%E6%98%AF%E4%B8%AD%E5%9B%BD%E4%BA%BA%EF%BC%9F%E2%80%8B%22%2C%22image%22%3A%22http%3A%2F%2Fstorage.mcp.weibo.cn%2F0JlIv.jpg%22%2C%22url%22%3A%22http%3A%2F%2Fe.weibo.com%2Fmediaprofile%2Farticle%2Fdetail%3Fuid%3D1722052204%26aid%3D983319%22%7D%5D%7D" }
the Parameters which data parameter supported | |||
---|---|---|---|
Parameter | Type | Requires | Description |
articles:display_name | string | true | the title of a image-text message |
articles:summary | string | true | the summary of a image-text message |
articles:image | string | true | the image of a image-text message,support JPG、PNG,single-image-text message and the first image of multi-image-text message should be 280*155,the other image of multi-image-text message should be 64*64 |
articles:url | string | true | the URL of image-text message, when user click a image-text message, it will jump to this URL |
Reply With A Location Message
//the message you reply { "result": true, "receiver_id":456, "sender_id":123, "type": "position", "data": { "longitude": "344.3344", "latitude": "232.343434" } } //the message after URLencode { "result":true, "sender_id":"123", "receiver_id":"456", "type":"position", "data":"%7B%22longitude%22%3A%22344.3344%22%2C%22latitude%22%3A%22232.343434%22%7D" }