Send Customer Service Message

跳转到: 导航, 搜索
(Response)
(Now This API support Three Types Message)
第40行: 第40行:
  
 
Now we support three types of reply message type: text, articles and position
 
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:
 
The data parameters of each type is different , the descriptions are as following:
  
第153行: 第155行:
 
|latitude
 
|latitude
 
|}
 
|}
 
  
 
==Response==
 
==Response==

2014年8月7日 (四) 02:11的版本

当用户主动发消息给认证账号后,微博将会把消息数据推送给开发者,开发者可以调用客服消息接口一定次数。

User send ,follow/unfollow event, 用户发送消息,关注/订阅事件,点击自定义菜单,扫描二维码事件后,目前修改为开发者在48小时内不限制发送次数;

When User

用户取消关注后,开发者无法回复消息;

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 在粉丝服务平台 - 高级功能 - 开发者模式页面中获取,或者OAuth2.0授权后获得, 详细参考 获取粉丝服务平台开发接口的access token
type true string 需要以何种类型的消息进行响应,text:纯文本、articles:图文、position:位置。
data true string 消息数据,具体内容严格遵循type类型对应格式,必须为json做URLEncode后的字符串格式,采用UTF-8编码。
receiver_id true int64 消息接收方的ID。
save_sender_box false int 取值为0或1,不填则默认为1。取值为1时,通过本接口发送的消息会进入发送方的私信箱;取值为0时,通过本接口发送的消息不会进入发送方的私信箱。
  • 注:Content-Type: application/x-www-form-urlencoded

Notes

  • 1、发送方的uid信息是由access_token参数决定的;
  • 2、调用接口时,需要消息发送方有针对于消息接收方的消息配额;一般来说,如果消息接收方给消息发送方主动发送过消息,则在7天内,消息发送方具备针对于消息接收方的主动配额一条;


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