PHP的,消息构造如下:
$messsage
= [
'message_url'
=>
"http://
www.myweb.com/index
"
,
'head'
=> [
'text'
=>
'fulishangchengxiaoxi'
],
'body'
=> [
'title'
=>
'亲,您收到一份新的消息'
,
'content'
=>
'gong xi ni'
,
'image'
=>
"http://shp.qpic.cn/bizmp/DNRicxNn38WRO30qQnEywTPkJc0wzxp3gBMPiaDZ2FPicic2qWeSS0FSsg/"
]
];
发送方法为:
public static function
sendLinkMessage(
$corp_id
,
$permanent_code
,
$toUsers
,
$agent_id
,
$message
)
{
$touser
=
''
;
if
(
is_array
(
$toUsers
)) {
foreach
(
$toUsers
as
$toUser
) {
$touser
=
$touser
.
$toUser
.
'|'
;
}
if
(
count
(
$toUsers
) >
0
) {
$touser
=
substr
(
$touser
,
0
, -
1
);
}
}
else
{
if
(
$toUsers
==
'@all'
) {
$touser
=
$toUsers
;
}
}
$message
= [
'touser'
=>
$touser
,
'agentid'
=>
$agent_id
,
'msgtype'
=>
'oa'
,
'oa'
=>
$message
,
];
$message
= json_decode(json_encode(
$message
));
$access_toke
= Dingtalk::
getIsvCorpAccessToken
(
$corp_id
,
$permanent_code
);
$url
=
'https://oapi.dingtalk.com/message/send?access_token='
.
$access_toke
;
$result
= HttpUtility::
post
(
$url
,
$message
,
true
);
$result
= json_decode(
$result
);
return
$result
;
}
经检验,安卓手机能够收到并显示消息,苹果手机能够收到但是显示不了图片,这个如何解决。
-------------------------
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。