View Source WeChat.CustomMessage (wechat v0.15.1)

消息管理 - 客服消息

同时支持 公众号 & 小程序 官方文档

Summary

Functions

客服消息接口 - 发送图文消息 by ArticleID (点击跳转到图文消息页面) - 官方文档

客服消息接口 - 发送卡券 - 官方文档

客服消息接口 - 发送图片消息 - 官方文档

客服消息接口 - 发送菜单消息 - 官方文档

客服消息接口 - 发送小程序卡片(要求小程序与公众号已关联) - 官方文档

客服消息接口 - 发送图文消息(点击跳转到图文消息页面) - 官方文档

客服消息接口 - 官方文档

客服消息接口 - 发送音乐消息 - 官方文档

客服消息接口 - 发送图文消息(点击跳转到外链) - 官方文档

客服消息接口 - 发送图文消息(点击跳转到外链) - 官方文档

客服消息接口 - 发送文本消息 - 官方文档

客服消息接口 - 发送文本消息 - by某个客服帐号 - 官方文档

客服消息接口 - 发送视频消息 - 官方文档

客服消息接口 - 发送语音消息 - 官方文档

Types

@type content() :: String.t()
@type description() :: String.t()
@type pic_url() :: String.t()
@type template_id() :: String.t()
@type title() :: String.t()
@type url() :: String.t()

Functions

Link to this function

send_article(client, openid, article_id)

View Source

客服消息接口 - 发送图文消息 by ArticleID (点击跳转到图文消息页面) - 官方文档

使用通过 “发布” 系列接口得到的 article_id

Link to this function

send_card(client, openid, card_id)

View Source

客服消息接口 - 发送卡券 - 官方文档

Link to this function

send_image(client, openid, media_id)

View Source

客服消息接口 - 发送图片消息 - 官方文档

Link to this function

send_menu(client, openid, map)

View Source
@spec send_menu(WeChat.client(), WeChat.openid(), map()) :: WeChat.response()

客服消息接口 - 发送菜单消息 - 官方文档

Example

WeChat.CustomMessage.send_menu(client, openid, {
  head_content: "您对本次服务是否满意呢?",
  list: [
    {
      id: "101",
      content: "满意"
    },
    {
      id: "102",
      content: "不满意"
    }
  ],
  tail_content: "欢迎再次光临"
})
Link to this function

send_mini_program_page(client, openid, map)

View Source
@spec send_mini_program_page(WeChat.client(), WeChat.openid(), map()) ::
  WeChat.response()

客服消息接口 - 发送小程序卡片(要求小程序与公众号已关联) - 官方文档

Example

WeChat.CustomMessage.send_mini_program_page(client, openid, {
  title:    "title",
  appid:    "appid",
  pagepath: "pagepath",
  thumb_media_id: "thumb_media_id"
})
Link to this function

send_mp_news(client, openid, media_id)

View Source

客服消息接口 - 发送图文消息(点击跳转到图文消息页面) - 官方文档

客服消息接口 - 官方文档

Link to this function

send_music(client, openid, map)

View Source
@spec send_music(WeChat.client(), WeChat.openid(), map()) :: WeChat.response()

客服消息接口 - 发送音乐消息 - 官方文档

Example

WeChat.CustomMessage.send_music(client, openid, {
  title:          "MUSIC_TITLE",
  description:    "MUSIC_DESCRIPTION",
  musicurl:       "MUSIC_URL",
  hqmusicurl:     "HQ_MUSIC_URL",
  thumb_media_id: "THUMB_MEDIA_ID"
})
Link to this function

send_news(client, openid, article)

View Source
@spec send_news(WeChat.client(), WeChat.openid(), article :: map()) ::
  WeChat.response()

客服消息接口 - 发送图文消息(点击跳转到外链) - 官方文档

Link to this function

send_news(client, openid, title, description, url, pic_url)

View Source
@spec send_news(
  WeChat.client(),
  WeChat.openid(),
  title(),
  description(),
  url(),
  pic_url()
) ::
  WeChat.response()

客服消息接口 - 发送图文消息(点击跳转到外链) - 官方文档

Example

WeChat.CustomMessage.send_news(client, openid, {
  title:        "Happy Day",
  description:  "Is Really A Happy Day",
  url:          "URL",
  picurl:       "PIC_URL"
})
Link to this function

send_text(client, openid, content)

View Source
@spec send_text(WeChat.client(), WeChat.openid(), content()) :: WeChat.response()

客服消息接口 - 发送文本消息 - 官方文档

发送文本消息时,支持插入跳小程序的文字链

文本内容<a href="http://www.qq.com" data-miniprogram-appid="appid" data-miniprogram-path="pages/index/index">点击跳小程序</a>

说明:

  • data-miniprogram-appid 项,填写小程序 appid,则表示该链接跳小程序;
  • data-miniprogram-path 项,填写小程序路径,路径与 app.json 中保持一致,可带参数;
  • 对于不支持 data-miniprogram-appid 项的客户端版本,如果有 herf 项,则仍然保持跳 href 中的网页链接;
  • data-miniprogram-appid 对应的小程序必须与公众号有绑定关系。
Link to this function

send_text(client, openid, content, kf_account)

View Source

客服消息接口 - 发送文本消息 - by某个客服帐号 - 官方文档

Link to this function

send_video(client, openid, map)

View Source
@spec send_video(WeChat.client(), WeChat.openid(), map()) :: WeChat.response()

客服消息接口 - 发送视频消息 - 官方文档

Example

WeChat.CustomMessage.send_video(client, openid, {
  media_id:         "MEDIA_ID",
  thumb_media_id:   "MEDIA_ID",
  title:            "TITLE",
  description:      "DESCRIPTION"
})
Link to this function

send_voice(client, openid, media_id)

View Source

客服消息接口 - 发送语音消息 - 官方文档

Link to this function

typing(client, openid, is_typing \\ true)

View Source
@spec typing(WeChat.client(), WeChat.openid(), is_typing :: boolean()) ::
  WeChat.response()

客服输入状态 - 官方文档

开发者可通过调用“客服输入状态”接口,返回客服当前输入状态给用户。

此接口需要客服消息接口权限。

  • 如果不满足发送客服消息的触发条件,则无法下发输入状态。
  • 下发输入状态,需要客服之前30秒内跟用户有过消息交互。
  • 在输入状态中(持续15s),不可重复下发输入态。
  • 在输入状态中,如果向用户下发消息,会同时取消输入状态。