Send Customer Service Message

跳转到: 导航, 搜索
(发送客服消息)
第31行: 第31行:
 
*注:Content-Type: application/x-www-form-urlencoded
 
*注:Content-Type: application/x-www-form-urlencoded
  
==注意事项==
+
==Notes==
 
*1、发送方的uid信息是由access_token参数决定的;
 
*1、发送方的uid信息是由access_token参数决定的;
 
*2、调用接口时,需要消息发送方有针对于消息接收方的消息配额;一般来说,如果消息接收方给消息发送方主动发送过消息,则在7天内,消息发送方具备针对于消息接收方的主动配额一条;
 
*2、调用接口时,需要消息发送方有针对于消息接收方的消息配额;一般来说,如果消息接收方给消息发送方主动发送过消息,则在7天内,消息发送方具备针对于消息接收方的主动配额一条;
*3、对于使用长连接接入模式的开发者,message/reply接口的调用方式略有不同,详情请参考http://open.weibo.com/wiki/2/messages/reply 文档;
 
  
  
此接口不得用于推广或引导用户使用任何与新浪微博有直接竞争关系的公司的服务,否则将永久关停指定应用或V用户使用资格。
 
  
==蓝V可回复的私信类型==
+
==Now This API support Three Types Message ==
  
当前支持蓝V回复的私信类型(type)中,data参数支持的参数:
+
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:
  
  
<h3>1、纯文本类型私信消息:text</h3>
+
<h3>1、Reply With A Text Message:text</h3>
 
<pre>
 
<pre>
 
{
 
{
第52行: 第51行:
 
<div class="wiki_kit">
 
<div class="wiki_kit">
  
 +
<div class="wiki_kit">
  
 
{|width="100%" border="0" cellspacing="0" cellpadding="0" class="wiki_table"
 
{|width="100%" border="0" cellspacing="0" cellpadding="0" class="wiki_table"
 
<html><colgroup><col class="tbF1"/><col class="tbF2" /><col /></colgroup></html>
 
<html><colgroup><col class="tbF1"/><col class="tbF2" /><col /></colgroup></html>
!colspan="4" scope="col" |<span id="data参数支持的参数">data参数支持的参数</span>
+
!colspan="4" scope="col" |<span id="data参数说明">the Parameters which data parameter supported</span>
 
|-
 
|-
|style="text-align:center; width: 12%"|参数名称
+
|style="text-align:center; width: 12%"|Parameter
|style="text-align:center;width: 12%"|值的类型
+
|style="text-align:center;width: 12%"|Type
|style="text-align:center;width: 11%"|是否必填
+
|style="text-align:center;width: 11%"|Requires
|style="text-align:center;"|说明描述
+
|style="text-align:center;"|Description
 
|-
 
|-
 
|text
 
|text
 
|string
 
|string
 
|true
 
|true
|要回复的私信文本内容。文本大小必须小于300个汉字。
+
|The text content you want to reply.The content should by less than 300 Chinese Characters.
 
|}
 
|}
举例:
 
当data对应json为{"text": "纯文本响应"} 时,则进行URLEncode后对应data参数值为:"%7B%22text%22%3A%22%E7%BA%AF%E6%96%87%E6%9C%AC%E5%9B%9E%E5%A4%8D%22%7D"。
 
  
则对应的调用为:
+
 
 +
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:
 
<pre>
 
<pre>
 
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
 
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
 
</pre>
 
</pre>
  
 
+
<h3>2、Reply With A Image-Text Message:articles</h3>
<h3>2、图文类型私信消息:articles</h3>
+
 
<pre>
 
<pre>
 
{
 
{
第90行: 第90行:
 
}
 
}
 
</pre>
 
</pre>
 
  
 
<div class="wiki_kit">
 
<div class="wiki_kit">
 
{|width="100%" border="0" cellspacing="0" cellpadding="0" class="wiki_table"
 
{|width="100%" border="0" cellspacing="0" cellpadding="0" class="wiki_table"
 
<html><colgroup><col class="tbF1"/><col class="tbF2" /><col /></colgroup></html>
 
<html><colgroup><col class="tbF1"/><col class="tbF2" /><col /></colgroup></html>
!colspan="4" scope="col" |<span id="data参数支持的参数">data参数支持的参数</span>
+
!colspan="4" scope="col" |<span id="data参数支持的参数">the Parameters which data parameter supported</span>
 
|-
 
|-
|style="text-align:center; width: 12%"|参数名称
+
|style="text-align:center; width: 12%"|Parameter
|style="text-align:center;width: 12%"|值的类型
+
|style="text-align:center;width: 12%"|Type
|style="text-align:center;width: 11%"|是否必填
+
|style="text-align:center;width: 11%"|Requires
|style="text-align:center;"|说明描述
+
|style="text-align:center;"|Description
 
|-
 
|-
 
|articles:display_name
 
|articles:display_name
 
|string
 
|string
 
|true
 
|true
|图文的显示名称标题
+
|the title of a image-text message
 
|-
 
|-
 
|articles:summary
 
|articles:summary
 
|string
 
|string
 
|true
 
|true
|图文的文字描述,大于等于2个图文时,仅显示第一个图文的描述
+
|the summary of a image-text message
 
|-
 
|-
 
|articles:image
 
|articles:image
 
|string
 
|string
 
|true
 
|true
|图文的缩略显示图片,需为JPG、PNG格式,单图及多图第一张推荐使用280*155,多图非第一张推荐使用64*64
+
|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
 
|articles:url
 
|string
 
|string
 
|true
 
|true
|图文的URL地址,点击后跳转
+
|the URL of image-text message, when user click a image-text message, it will jump to this URL
 
|}
 
|}
  
  
<h3>3、位置类型私信消息:position </h3>
+
 
 +
<h3>3、Reply With A Location Message:position </h3>
 
<pre>
 
<pre>
 
{
 
{
第136行: 第136行:
 
{|width="100%" border="0" cellspacing="0" cellpadding="0" class="wiki_table"
 
{|width="100%" border="0" cellspacing="0" cellpadding="0" class="wiki_table"
 
<html><colgroup><col class="tbF1"/><col class="tbF2" /><col /></colgroup></html>
 
<html><colgroup><col class="tbF1"/><col class="tbF2" /><col /></colgroup></html>
!colspan="4" scope="col" |<span id="data参数支持的参数">data参数支持的参数</span>
+
!colspan="4" scope="col" |<span id="data参数支持的参数">the Parameters which data parameter supported</span>
 
|-
 
|-
|style="text-align:center; width: 12%"|参数名称
+
|style="text-align:center; width: 12%"|Parameter
|style="text-align:center;width: 12%"|值的类型
+
|style="text-align:center;width: 12%"|Type
|style="text-align:center;width: 11%"|是否必填
+
|style="text-align:center;width: 11%"|Requires
|style="text-align:center;"|说明描述
+
|style="text-align:center;"|Description
 
|-
 
|-
 
|longitude
 
|longitude
 
|string
 
|string
 
|true
 
|true
|经度
+
|longitude
 
|-
 
|-
 
|latitude
 
|latitude
 
|string
 
|string
 
|true
 
|true
|纬度
+
|latitude
 
|}
 
|}
  
==返回结果==
+
 
 +
==Response==
 
<pre>
 
<pre>
// 成功返回
+
// the
 
{
 
{
 
     "result": true,
 
     "result": true,

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

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

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

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