Send Customer Service Message

跳转到: 导航, 搜索
(Notes)
 
(未显示1个用户的2个中间版本)
第21行: 第21行:
 
!width="10%" style="text-align:center;font-weight:bolder;border:1px solid #cccccc"|Type and Range
 
!width="10%" style="text-align:center;font-weight:bolder;border:1px solid #cccccc"|Type and Range
 
!width="75%" style="text-align:center;font-weight:bolder;border:1px solid #cccccc"|Description
 
!width="75%" style="text-align:center;font-weight:bolder;border:1px solid #cccccc"|Description
{{api_args|access_token|true|string|在粉丝服务平台 - 高级功能 - 开发者模式页面中获取,或者OAuth2.0授权后获得, 详细参考 [[Messages_api/access_token|获取粉丝服务平台开发接口的access token]]。}}
+
{{api_args|access_token|true|string|access token]]。}}
{{api_args|type|true|string|需要以何种类型的消息进行响应,text:纯文本、articles:图文、position:位置。}}
+
{{api_args|type|true|string|text or articles or position}}
{{api_args|data|true|string|消息数据,具体内容严格遵循type类型对应格式,必须为json做URLEncode后的字符串格式,采用UTF-8编码。}}
+
{{api_args|data|true|string|the content of this message,must be URLEncode with UTF-8 format。}}
{{api_args|receiver_id|true|int64|消息接收方的ID。}}
+
{{api_args|receiver_id|true|int64|the receiver of your reply message}}
{{api_args|save_sender_box|false|int|取值为0或1,不填则默认为1。取值为1时,通过本接口发送的消息会进入发送方的私信箱;取值为0时,通过本接口发送的消息不会进入发送方的私信箱。}}
+
{{api_args|save_sender_box|false|int|not necessary,0 or 1}}
 
|}
 
|}
  
第31行: 第31行:
  
 
==Notes==
 
==Notes==
*1、发送方的uid信息是由access_token参数决定的;
+
*1、Weibo get the sender information from access_token;
*2、调用接口时,需要消息发送方有针对于消息接收方的消息配额;一般来说,如果消息接收方给消息发送方主动发送过消息,则在7天内,消息发送方具备针对于消息接收方的主动配额一条;
+
 
+
 
+
  
 
==Now This API support Three Types Message ==
 
==Now This API support Three Types Message ==

2014年8月7日 (四) 02:18的最后版本

When your weibo account receive a general message or event push message, you have quota to reply user by Send Customer Service Message API.


When user send you a general message,or follow you, or subscribe you, or click your custom menu, you can reply user in 48 hours with no limits.


When User Unfollow you, you have no rights to reply a message.


URL

https://m.api.weibo.com/2/messages/reply.json

HTTP Request Method

POST

Request Parameters

  Requires Type and Range Description
access_token true string access token]]。
type true string text or articles or position
data true string the content of this message,must be URLEncode with UTF-8 format。
receiver_id true int64 the receiver of your reply message
save_sender_box false int not necessary,0 or 1
  • 注:Content-Type: application/x-www-form-urlencoded

Notes

  • 1、Weibo get the sender information from access_token;

Now This API support Three Types Message

Now we support three types of reply message type: text, articles and position


The data parameters of each type is different , the descriptions are as following:


1、Reply With A Text Message:text

{
    "text": "纯文本回复"
}
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" And the corresponding curl is:

curl "https://m.api.weibo.com/2/messages/reply.json?access_token=ACCESS_TOKEN" -d 'receiver_id=RECEIVER_ID&type=text&data=%7B%22text%22%3A%22%E7%BA%AF%E6%96%87%E6%9C%AC%E5%9B%9E%E5%A4%8D%22%7D' -k

2、Reply With A Image-Text Message:articles

{
    "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 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


3、Reply With A Location Message:position

{
    "longitude": "344.3344",
    "latitude": "232.343434"
}


the Parameters which data parameter supported
Parameter Type Requires Description
longitude string true longitude
latitude string true latitude

Response

{
    "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"
}


文档更新时间: 2014-08-07