赞
踩
// 添加node机器人给飞书群发消息 const https = require('https'); // 飞书群添加机器人之后webhook链接最后的UUID var webhookId = 'xxxx' // 给飞书群发送消息 function sendMsgToFeishu(id = webhookId, content) { var options = { hostname: 'open.feishu.cn', port: 443, path: `/open-apis/bot/v2/hook/${id}`, method: 'POST', headers: { 'Content-Type': 'application/json' } }; var req = https.request(options, (res) => { res.on('data', (d) => { process.stdout.write(d); }); }); req.on('error', (e) => { console.error(e); }); req.write(content); req.end(); } module.exports = { sendMsgToFeishu }
其中content为发动到飞书群的具体信息,这个可以是纯文本,也可以是富文本,参考飞书官方文档:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。