Send passive response message

For each POST request, the developer returns a specific JSON structure or XML structure in the response package (Get) to respond to the message (reply text and image text messages are now supported).

If the microblog server does not receive a response within five seconds, the connection will be broken, and the request will be re initiated, with a total of three retries;

For retry message de duplication, FromUserName+CreateTime is recommended;

If the developer cannot guarantee to process and reply within five seconds, he can directly reply to empty strings, and the microblog server will not do any processing and will not initiate a retry. In this case, the customer service message interface can be used for asynchronous reply.


Reply to plain text message

If you reply to a plain text message, the JSON format returned is as follows: Note: The data field content in JSON format must be URLEncode in UTF8 format

 { "result": true, "receiver_id":456, "sender_id":123, "type": "text", "data":"{ "Text": "Chinese message" }" } //Back to sample { "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" }


Parameters supported by the data parameter
Parameter name Type of value Required Description
text string true Private text content to reply to. The text size must be less than 300 Chinese characters.

give an example: When the data corresponding json is {"text": "plain text response"}, the corresponding data parameter value 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 to image and text messages

If you reply to an image text message, the JSON format will be returned as follows:

 { "result": true, "receiver_id":456, "sender_id":123, "type": "articles", "data": { "articles": [ { "Display_name": "Two Stories", "Summary": "Today I will tell you two stories. Who is the company? Who is the Chinese?", "image": " http://storage.mcp.weibo.cn/0JlIv.jpg ", "url": " http://e.weibo.com/mediaprofile/article/detail?uid=1722052204&aid=983319 " }, ...//Up to 8 images and texts are supported, 1 or 3 are recommended ] } } //Back to sample { "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%2 2http%3A%2F%2Fe.weibo.com%2Fmediaprofile%2Farticle%2Fdetail%3Fuid%3D1722052204%26aid%3D983319%22%7D%5D%7D" }
Parameters supported by the data parameter
Parameter name Type of value Required Description
articles:display_name string true Display name title of image and text
articles:summary string true Text description of images and texts. If there are more than or equal to 2 images and texts, only the description of the first image and text will be displayed
articles:image string true The thumbnail image of image and text should be in JPG and PNG format. 280 * 155 is recommended for the first single image and multi image, and 64 * 64 is recommended for multi image non first image
articles:url string true The URL address of the image and text, click to jump (Note: the URL must be a complete URL, for example, http://weibo.com/xxx , if "http://" is omitted, the image text message cannot be sent)

Location Type Private Message

 { "result": true, "receiver_id":456, "sender_id":123, "type": "position", "data": { "longitude": "344.3344", "latitude": "232.343434" } } //Back to sample { "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" }


Parameters supported by the data parameter
Parameter name Type of value Required Description
longitude string true longitude
latitude string true latitude

Php code example

Java code example

Document update time: August 20, 2014