# 发送应用信息

# 请求方式

POST

# 请求地址

https://nbd-api.myscrm.cn/open-nbd-qw-msg/v1/app-message/send

# 请求参数

# 示例

{
  "app_id": "string",
  "receive_qw_user_ids": ["string"],
  "msg_type": "string",
  "text": {
    "content": "string"
  },
  "textcard": {
    "title": "string",
    "description": "string",
    "url": "string",
    "btn_txt": "string"
  },
  "image": {
    "media_id": "string"
  },
  "video": {
    "media_id": "string"
  },
  "voice": {
    "media_id": "string"
  },
  "file": {
    "media_id": "string"
  },
  "news": {
    "articles": [
      {
        "title": "string",
        "description": "string",
        "url": "string",
        "picurl": "string",
        "appid": "string",
        "pagepath": "string"
      }
    ]
  },
  "mpnews": {
    "articles": [
      {
        "title": "string",
        "thumb_media_id": "string",
        "author": "string",
        "content_source_url": "string",
        "content": "string",
        "digest": "string"
      }
    ]
  },
  "markdown": {
    "Content": "string"
  },
  "miniprogram_notice": {
    "appid": "string",
    "page": "string",
    "title": "string",
    "description": "string",
    "emphasis_first_item": "string",
    "content_item": [
      {
        "key": "string",
        "value": "string"
      }
    ]
  },
  "template_card": {
    "card_type": "string",
    "task_id": "string",
    "sub_title_text": "string",
    "button_list": [
      {
        "type": 0,
        "text": "string",
        "style": 0,
        "key": "string",
        "url": "string"
      }
    ],
    "source": {
      "icon_url": "string",
      "desc": "string",
      "desc_color": 0
    },
    "action_menu": {
      "desc": "string",
      "action_list": [
        {
          "text": "string",
          "key": "string"
        }
      ]
    },
    "main_title": {
      "title": "string",
      "desc": "string"
    },
    "quote_area": {
      "title": "string",
      "desc": "string"
    },
    "image_text_area": {
      "type": 0,
      "url": "string",
      "appid": "string",
      "pagepath": "string",
      "title": "string",
      "quote_text": "string"
    },
    "card_image": {
      "url": "string",
      "aspect_ratio": 0
    },
    "vertical_content_list": [
      {
        "title": "string",
        "desc": "string"
      }
    ],
    "emphasis_content": {
      "title": "string",
      "desc": "string"
    },
    "horizontal_content_list": [
      {
        "type": 0,
        "keyname": "string",
        "value": "string",
        "url": "string",
        "media_id": "string",
        "userid": "string"
      }
    ],
    "jump_list": [
      {
        "type": 0,
        "title": "string",
        "url": "string",
        "appid": "string",
        "pagepath": "string"
      }
    ],
    "card_action": {
      "type": 0,
      "url": "string",
      "appid": "string",
      "pagepath": "string"
    },
    "button_selection": {
      "question_key": "string",
      "title": "string",
      "selected_id": "string",
      "option_list": [
        {
          "id": "string",
          "text": "string"
        }
      ]
    },
    "checkbox": {
      "question_key": "string",
      "option_list": [
        {
          "id": "string",
          "text": "string"
        }
      ],
      "mode": 0
    },
    "submit_button": {
      "text": "string",
      "key": "string"
    }
  }
}

# 说明

参数 类型 必须 说明
app_id string 企微中台应用 id
receive_qw_user_ids string [] 指定接收消息的成员 id 列表,不超过 1000 个
msg_type string 消息类型:text-文本消息,image-图片消息,video-语音消息,voice-视频消息,file-文件消息,textcard-文本卡片消息,news-图文消息,mp_news-图文消息(mpnews),markdown-markdown 消息,miniprogram_notice-小程序通知消息,template_card-模板卡片消息
text Text 文本内容,msg_type=text 时必传。详见:Text
textcard TextCard 文本卡片内容,msg_type=textcard 时必传。详见:TextCard
image Media 图片内容,msg_type=image 时必传。详见:Media
video Media 视频内容,msg_type=video 时必传。详见:Media
voice Media 音频内容,msg_type=voice 时必传。详见:Media
file Media 文件内容,msg_type=file 时必传。详见:Media
news News 图文内容,msg_type=news 时必传。详见:News
mpnews Mpnews 图文消息(mpnews),msg_type=mpnews 时必传。详见:Mpnews
markdown Markdown markdown,msg_type=markdown 时必传。详见:Markdown
miniprogram_notice MiniprogramNotice miniprogram_notice,msg_type=miniprogram_notice 时必传。详见:MiniprogramNotice
template_card TemplateCard 模板消息,msg_type=template_card 时必传。详见:TemplateCard

# Text

参数 类型 必须 说明
content string 文本内容

# TextCard

参数 类型 必须 说明
title string 标题
description string 描述
url string 点击后跳转的链接
btn_txt string 按钮文字。 默认为“详情”, 不超过 4 个文字,超过自动截断。

# Media

参数 类型 必须 说明
media_id string 媒体文件 id,可以调用上传临时素材接口获取

# News

参数 类型 必须 说明
articles object [] 图文消息,一个图文消息支持 1 到 8 条图文
articles.title string 标题,不超过 128 个字节,超过会自动截断(支持 id 转译)
articles.description string 描述,不超过 512 个字节,超过会自动截断(支持 id 转译)
articles.url string 点击后跳转的链接。 最长 2048 字节,请确保包含了协议头(http/https),小程序或者 url 必须填写一个
articles.picurl string 图文消息的图片链接,最长 2048 字节,支持 JPG、PNG 格式,较好的效果为大图 1068455,小图 150150。
articles.appid string 小程序 appid,必须是与当前应用关联的小程序,appid 和 pagepath 必须同时填写,填写后会忽略 url 字段
articles.pagepath string 点击消息卡片后的小程序页面,最长 128 字节,仅限本小程序内的页面。appid 和 pagepath 必须同时填写,填写后会忽略 url 字段

# Mpnews

参数 类型 必须 说明
articles object [] 图文消息,一个图文消息支持 1 到 8 条图文
title string 标题,不超过 128 个字节,超过会自动截断(支持 id 转译)
thumb_media_id string 图文消息缩略图的 media_id, 可以通过素材管理接口获得。此处 thumb_media_id 即上传接口返回的 media_id
author string 图文消息的作者,不超过 64 个字节
content_source_url string 图文消息点击“阅读原文”之后的页面链接
content string 图文消息的内容,支持 html 标签,不超过 666K 个字节(支持 id 转译)
digest string 图文消息的描述,不超过 512 个字节,超过会自动截断(支持 id 转译)

# Markdown

参数 类型 必须 说明
Content string markdown 内容,最长不超过 2048 个字节,必须是 utf8 编码

# MiniprogramNotice

参数 类型 必须 说明
appid string 小程序 appid,必须是与当前应用关联的小程序
page string 点击消息卡片后的小程序页面,最长 1024 个字节,仅限本小程序内的页面。该字段不填则消息点击后不跳转。
title string 消息标题,长度限制 4-12 个汉字(支持 id 转译)
description string 消息描述,长度限制 4-12 个汉字(支持 id 转译)
emphasis_first_item string 是否放大第一个 content_item
content_item object [] 消息内容键值对,最多允许 10 个 item
content_item.key string 长度 10 个汉字以内
content_item.value string 长度 30 个汉字以内(支持 id 转译)

# TemplateCard

参数 类型 必须 说明
card_type string 模板卡片类型,按钮交互型卡片填写"button_interaction"
task_id string 任务 id,同一个应用任务 id 不能重复,只能由数字、字母和“_-@”组成,最长 128 字节
sub_title_text string 二级普通文本,建议不超过 160 个字,(支持 id 转译)
button_list object [] 按钮列表,列表长度不超过 6
button_list.type int32 按钮点击事件类型,0 或不填代表回调点击事件,1 代表跳转 url
button_list.text string 按钮文案,建议不超过 10 个字
button_list.style int32 按钮样式,目前可填 1~4,不填或错填默认 1
button_list.key string 按钮 key 值,用户点击后,会产生回调事件将本参数作为 EventKey 返回,回调事件会带上该 key 值,最长支持 1024 字节,不可重复,button_list.type 是 0 时必填
button_list.url string 跳转事件的 url,button_list.type 是 1 时必填
source object 卡片来源样式信息
source.icon_url string 来源图片的 url,来源图片的尺寸建议为 72*72
source.desc string 来源图片的描述,建议不超过 20 个字,(支持 id 转译)
source.desc_color int32 来源文字的颜色,目前支持:0(默认) 灰色,1 黑色,2 红色,3 绿色
action_menu object 卡片右上角更多操作按钮
action_menu.desc string 更多操作界面的描述
action_menu.action_list object [] 操作列表,列表长度取值范围为 [1, 3]
action_menu.action_list.text string 操作的描述文案
action_menu.action_list.key string 操作 key 值,用户点击后,会产生回调事件将本参数作为 EventKey 返回,回调事件会带上该 key 值,最长支持 1024 字节,不可重复
main_title object 一级标题,建议不超过 36 个字,(支持 id 转译)
main_title.title string 一级标题,建议不超过 36 个字,(支持 id 转译)
main_title.desc string 标题辅助信息,建议不超过 44 个字,(支持 id 转译)
quote_area object 引用文献样式
quote_area.title string 一级标题,建议不超过 36 个字,(支持 id 转译)
quote_area.desc string 标题辅助信息,建议不超过 44 个字,(支持 id 转译)
image_text_area object 左图右文样式,news_notice 类型的卡片,card_image 和 image_text_area 两者必填一个字段,不可都不填
image_text_area.type int32 引用文献样式区域点击事件,0 或不填代表没有点击事件,1 代表跳转 url,2 代表跳转小程序
image_text_area.url string 点击跳转的 url,quote_area.type 是 1 时必填
image_text_area.appid string 点击跳转的小程序的 appid,必须是与当前应用关联的小程序,quote_area.type 是 2 时必填
image_text_area.pagepath string 点击跳转的小程序的 pagepath,quote_area.type 是 2 时选填
image_text_area.title string 引用文献样式的标题
image_text_area.quote_text string 引用文献样式的引用文案
card_image object 图片样式,news_notice 类型的卡片,card_image 和 image_text_area 两者必填一个字段,不可都不填
card_image.url string 图片的 url
card_image.aspect_ratio float 图片的宽高比,宽高比要小于 2.25,大于 1.3,不填该参数默认 1.3
vertical_content_list object [] 卡片二级垂直内容,该字段可为空数组,但有数据的话需确认对应字段是否必填,列表长度不超过 4
vertical_content_list.title string 卡片二级标题,建议不超过 38 个字
vertical_content_list.desc string 二级普通文本,建议不超过 160 个字
emphasis_content object 关键数据样式
emphasis_content.title string 关键数据样式的数据内容,建议不超过 14 个字
emphasis_content.desc string 关键数据样式的数据描述内容,建议不超过 22 个字
horizontal_content_list object [] 二级标题+文本列表,该字段可为空数组,但有数据的话需确认对应字段是否必填,列表长度不超过 6
horizontal_content_list.type int32 链接类型,0 或不填代表不是链接,1 代表跳转 url,2 代表下载附件,3 代表点击跳转成员详情
horizontal_content_list.keyname string 二级标题,建议不超过 5 个字
horizontal_content_list.value string 二级文本,如果 horizontal_content_list.type 是 2,该字段代表文件名称(要包含文件类型),建议不超过 30 个字,(支持 id 转译)
horizontal_content_list.url string 链接跳转的 url,horizontal_content_list.type 是 1 时必填
horizontal_content_list.media_id string 附件的 media_id,horizontal_content_list.type 是 2 时必填
horizontal_content_list.userid string 成员详情的 userid,horizontal_content_list.type 是 3 时必填
jump_list object [] 跳转指引样式的列表,该字段可为空数组,但有数据的话需确认对应字段是否必填,列表长度不超过 3
jump_list.type int32 跳转链接类型,0 或不填代表不是链接,1 代表跳转 url,2 代表跳转小程序
jump_list.title string 跳转链接样式的文案内容,建议不超过 18 个字
jump_list.url string 跳转链接的 url,jump_list.type 是 1 时必填
jump_list.appid string 跳转链接的小程序的 appid,必须是与当前应用关联的小程序,jump_list.type 是 2 时必填
jump_list.pagepath string 跳转链接的小程序的 pagepath,jump_list.type 是 2 时选填
card_action object 整体卡片的点击跳转事件
card_action.type int32 跳转事件类型,0 或不填代表不是链接,1 代表跳转 url,2 代表打开小程序
card_action.url string 跳转事件的 url,card_action.type 是 1 时必填
card_action.appid string 跳转事件的小程序的 appid,必须是与当前应用关联的小程序,card_action.type 是 2 时必填
card_action.pagepath string 跳转事件的小程序的 pagepath,card_action.type 是 2 时选填
button_selection object 下拉式的选择器的 key,用户提交选项后,会产生回调事件,回调事件会带上该 key 值表示该题,最长支持 1024 字节
button_selection.question_key string 下拉式的选择器的 key,用户提交选项后,会产生回调事件,回调事件会带上该 key 值表示该题,最长支持 1024 字节
button_selection.title string 下拉式的选择器左边的标题
button_selection.selected_id string 默认选定的 id,不填或错填默认第一个
button_selection.option_list object [] 选项列表,下拉选项不超过 10 个,最少 1 个
button_selection.option_list.id string 下拉式的选择器选项的 id,用户提交后,会产生回调事件,回调事件会带上该 id 值表示该选项,最长支持 128 字节,不可重复
button_selection.option_list.text string 下拉式的选择器选项的文案,建议不超过 16 个字
checkbox object 选择题样式
checkbox.question_key string 选择题 key 值,用户提交选项后,会产生回调事件,回调事件会带上该 key 值表示该题,最长支持 1024 字节
checkbox.option_list object [] 选项 list,选项个数不超过 20 个,最少 1 个
checkbox.option_list.id string 下拉式的选择器选项的 id,用户提交后,会产生回调事件,回调事件会带上该 id 值表示该选项,最长支持 128 字节,不可重复
checkbox.option_list.text string 下拉式的选择器选项的文案,建议不超过 16 个字
checkbox.option_list.mode int32 选择题模式,单选:0,多选:1,不填默认 0
submit_button object 提交按钮样式
submit_button.text string 按钮文案,建议不超过 10 个字,不填默认为提交
submit_button.key string 提交按钮的 key,会产生回调事件将本参数作为 EventKey 返回,最长支持 1024 字节

# 返回参数

# 示例

{
  "errcode": 0,
  "errmsg": "ok",
  "data": {
    "invalid_qw_user_ids": ["string"],
    "msg_id": "string"
  }
}

# 说明

名称 类型 说明
data.invalid_qw_user_ids string[] 不合法的 userid
data.msg_id string 消息 id