0%

钉钉&&企微-消息发送

消息推送

钉钉

1、获取企业内部应用的access_token

1
get https://oapi.dingtalk.com/gettoken?appkey=&appsecret=

2、发送通知

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
post https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2?access_token=

{
"msg":{
// "voice":{
// "duration":"100",
// "media_id":"100"
// },
// "image":{
// "media_id":"@123"
// },
// "oa":{
// "head":{
// "bgcolor":"bgcolor",
// "text":"text"
// },
// "pc_message_url":"pc_message_url",
// "status_bar":{
// "status_value":"进行中",
// "status_bg":"0xFFF65E5E"
// },
// "body":{
// "file_count":"file_count",
// "image":"image",
// "form":{
// "value":"value",
// "key":"key"
// },
// "author":"author",
// "rich":{
// "unit":"unit",
// "num":"num"
// },
// "title":"title",
// "content":"content"
// },
// "message_url":"message_url"
// },
// "file":{
// "media_id":"media_id"
// },
// "action_card":{
// "btn_json_list":{
// "action_url":"action_url",
// "title":"title"
// },
// "single_url":"single_url",
// "btn_orientation":"btn_orientation",
// "single_title":"single_title",
// "markdown":"markdown",
// "title":"title"
// },
// "link":{
// "picUrl":"picUrl",
// "messageUrl":"messageUrl",
// "text":"text",
// "title":"title"
// },
// "markdown":{
// "text":"text",
// "title":"title"
// },
"text":{
"content":"测试使用钉钉消息推送"
},
"msgtype":"text"
},
"to_all_user":"false",
"agent_id": "1752362252",
"dept_id_list":"606709116",
// "userid_list": "014266190220645721"
}

企微

1、获取access_token

1
get https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=&corpsecret=

2、发送消息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
post https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=

{
"touser" : "UserID1|UserID2|UserID3",
"toparty" : 1,
"totag" : "TagID1 | TagID2",
"msgtype" : "text",
"agentid" : 1000003,
"text" : {
"content" : "你的快递已到,请携带工卡前往邮件中心领取。\n出发前可查看<a href=\"http://work.weixin.qq.com\">邮件中心视频实况</a>,聪明避开排队。"
},
"safe":0,
"enable_id_trans": 0,
"enable_duplicate_check": 0,
"duplicate_check_interval": 1800
}