
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
dingdingbot
Advanced tools
钉钉机器人是钉钉群的一个高级扩展功能,但使用起来却非常简单,只需要注册一个钉钉账号,就可以将第三方服务信息聚合到钉钉群中,实现信息的自动同步。
常见的使用场景:
1、聚合Github、Gitlab等源码管理服务,实现源码更新同步;
2、聚合Trello、JIRA等项目协调服务,实现项目信息同步;
3、机器人支持Webhook自定义接入,就可以实现更多可能性,例如:将运维报警、自动化测试结果报告、工作&生活日程安排(上班打卡、下班吃饭、健身、读书、生日、纪念日...)的提醒;
目前自定义机器人支持文本(text)、链接(link)、markdown三种消息格式,五种消息类型,详细信息请参考自定义机器人官方文档
这么好用的功能,只要在钉钉群中添加机器人,得到Webhoo地址即可。接下来,我们先在命令行终端一睹为快吧:
curl 'https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxx' \
-H 'Content-Type: application/json' \
-d '
{"msgtype": "text",
"text": {
"content": "我就是我, 是不一样的烟火"
}
}'
npm install dingdingbot
const { DingDingBot } = require('dingdingbot')
// 不携带加密token
const bot = new DingDingBot('https://oapi.dingtalk.com/robot/send?access_token=eed4cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
// 携带加密token
const bot = new DingDingBot('https://oapi.dingtalk.com/robot/send?access_token=eed4cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'SECxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
bot.sendText({ msg: 'Hello World!' }).then(r => console.log(r))
// @所有人
bot.sendText({ msg: 'Hello World!', isAtAll: true }).then(r => console.log(r))
// Text消息之@指定用户atMobiles: ['188xxxxx', '187xxxxx'] 改写手机号
bot.sendText({
msg: 'Hello World!',
isAtAll: false,
atMobiles: ['188xxxxx', '187xxxxx'],
atDingTalkIds: ['userid1', 'userid2']
}).then(r => console.log(r))
// Image表情消息
const catImageUrl = 'https://gss0.baidu.com/-vo3dSag_xI4khGko9WTAnF6hhy/zhidao/pic/item/18d8bc3eb13533facf73c7a1a9d3fd1f40345b73.jpg'
bot.sendImage(catImageUrl).then(r => console.log(r)).catch(e => console.log(e))
// Link消息
bot.sendLink({
text: 'Hello World!',
title: '万万没想到!',
picUrl: 'https://pic.dmjnb.com/pic/cef5dd8fb7aaabb8bb116bb55f270ba9?imageMogr2/thumbnail/x380/quality/90!',
messageUrl: 'https://www.baidu.com'
}).then(r => console.log(r)).catch(e => console.log(e))
// Markdown消息@所有人
bot.sendMarkdown({
title: '漢洲天機',
text: '#### 杭州天气 @150XXXXXXXX \n > 9度,西北风1级,空气良89,相对温度73%\n > \n > ###### 10点20分发布 [天气](https://www.dingtalk.com) \n',
isAtAll: true
}
).then(r => console.log(r)).catch(e => console.log(e))
// Markdown消息
bot.sendMarkdown({
title: '漢洲天機',
text: '#### 杭州天气 @150XXXXXXXX \n > 9度,西北风1级,空气良89,相对温度73%\n > \n > ###### 10点20分发布 [天气](https://www.dingtalk.com) \n',
isAtAll: false
}
).then(r => console.log(r)).catch(e => console.log(e))
// @某个人
bot.sendMarkdown({
title: '漢洲天機',
text: '#### 漢洲天機 @18727792911 \n > 9度,西北风1级,空气良89,相对温度73%\n > \n > ###### 10点20分发布 [天气](https://www.dingtalk.com) \n',
atMobiles: ['18871535971', ['18727792911'], ['21312321123']]
}
).then(r => console.log(r)).catch(e => console.log(e))
// FeedCard消息
const card1 = CardItem('氧气美女',
'https://www.dingtalk.com/',
'https://pic.dmjnb.com/pic/cef5dd8fb7aaabb8bb116bb55f270ba9?imageMogr2/thumbnail/x380/quality/90'
)
const card2 = CardItem('氧气美女',
'https://www.dingtalk.com/',
'https://pic.dmjnb.com/pic/cef5dd8fb7aaabb8bb116bb55f270ba9?imageMogr2/thumbnail/x380/quality/90'
)
const card3 = CardItem('氧气美女',
'https://www.dingtalk.com/',
'https://pic.dmjnb.com/pic/cef5dd8fb7aaabb8bb116bb55f270ba9?imageMogr2/thumbnail/x380/quality/90'
)
bot.sendFeedCard(
[card1, card2, card3]
).then(r => console.log(r)).catch(e => console.log(e))
// ActionCard消息
const btns2 = [ActionCardItem('支持1+1', 'https://www.dingtalk.com/'), ActionCardItem('反对2+2', 'https://www.dingtalk.com/')]
bot.sendActionCard({
headers: ['投票'],
btns: btns2,
text: ` \n### 故事是这样子的...`
}).then(r => console.log(r)).catch(e => console.log(e))
// 选项卡换方向
d.sendActionCard({
headers: ['投票'],
btns: btns2,
btnOrientation: '1',
text: ` \n### 故事是这样子的...`
}).then(r => console.log(r)).catch(e => console.log(e))
FAQs
钉钉机器人typescript版本
We found that dingdingbot demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.