主动发送信息接口
public sendMessage ( array $data ) : boolean | array | ||
$data | array | 结构体为: array( "touser" => "UserID1|UserID2|UserID3", "toparty" => "PartyID1|PartyID2 ", "totag" => "TagID1|TagID2 ", "safe":"0" //是否为保密消息,对于news无效 "agentid" => "001", //应用id "msgtype" => "text", //根据信息类型,选择下面对应的信息结构体 "text" => array( "content" => "Holiday Request For Pony(http://xxxxx)" ), "image" => array( "media_id" => "MEDIA_ID" ), "voice" => array( "media_id" => "MEDIA_ID" ), " video" => array( "media_id" => "MEDIA_ID", "title" => "Title", "description" => "Description" ), "file" => array( "media_id" => "MEDIA_ID" ), "news" => array( //不支持保密 "articles" => array( //articles 图文消息,一个图文消息支持1到10个图文 array( "title" => "Title", //标题 "description" => "Description", //描述 "url" => "URL", //点击后跳转的链接。可根据url里面带的code参数校验员工的真实身份。 "picurl" => "PIC_URL", //图文消息的图片链接,支持JPG、PNG格式,较好的效果为大图640*320, //小图80*80。如不填,在客户端不显示图片 ), ) ), "mpnews" => array( "articles" => array( //articles 图文消息,一个图文消息支持1到10个图文 array( "title" => "Title", //图文消息的标题 "thumb_media_id" => "id", //图文消息缩略图的media_id "author" => "Author", //图文消息的作者(可空) "content_source_url" => "URL", //图文消息点击“阅读原文”之后的页面链接(可空) "content" => "Content" //图文消息的内容,支持html标签 "digest" => "Digest description", //图文消息的描述 "show_cover_pic" => "0" //是否显示封面,1为显示,0为不显示(可空) ), ) ) ) 请查看官方开发文档中的 发送消息 -> 消息类型及数据格式 |
리턴 | boolean | array | 如果对应用或收件人、部门、标签任何一个无权限,则本次发送失败; 如果收件人、部门或标签不存在,发送仍然执行,但返回无效的部分。 { "errcode": 0, "errmsg": "ok", "invaliduser": "UserID1", "invalidparty":"PartyID1", "invalidtag":"TagID1" } |