nodejs + 钉钉通知

420 阅读1分钟

1、创建钉钉群,添加机器人

  • 添加自定义机器人,有三种安全设置可以选择,示例中选择的是自定义关键词
  • 设置webhook

2、nodejs 推送

const axios = require('axios');async function sendMsg() {    try {        await axios.post('webhook_url', {            msgtype: "markdown",            markdown: {                "title": "[notice][cruiser-v2]智能辅助决策通知",                "text": "## APP: test app android \n ### 监控活跃ad 6个,建议关停ad 6个 \n #### 01 账户[1111(账户一)]  \n - ad_id:11111 \n - ad_id:1111 \n - ad_id:111"            },        });    } catch (error) {        console.log(error)    }}(async () => {    await sendMsg();})()

3、效果图

钉钉官网API: ding-doc.dingtalk.com/doc#/server…