钉钉如何请求webhook发送信息

代码:js

复制代码
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

const raw = JSON.stringify({
  "at": {
    "atMobiles": [
      "180xxxxxx"
    ],
    "atUserIds": [
      "user123"
    ],
    "isAtAll": false
  },
  "text": {
    "content": "我就是我, @user123 是不一样的烟火"
  },
  "msgtype": "text"
});

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: raw,
  redirect: "follow"
};

fetch("https://oapi.dingtalk.com/robot/send?access_token=a20fc884379fd76bd27ad902fc7ec940f1c1573a3b468852372091474", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));

代码axios

复制代码
const axios = require('axios');
let data = JSON.stringify({
  "at": {
    "atMobiles": [
      "180xxxxxx"
    ],
    "atUserIds": [
      "user123"
    ],
    "isAtAll": false
  },
  "text": {
    "content": "我就是我, @user123 是不一样的烟火"
  },
  "msgtype": "text"
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://oapi.dingtalk.com/robot/send?access_token=a20fc884379fd76bd27ad902fc7ec940f1c1573a3b468852372091474',
  headers: { 
    'Content-Type': 'application/json'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});
相关推荐
散装DBA15 天前
OpenClaw+钉钉机器人实现数据库操作
数据库·机器人·钉钉
CaracalTiger16 天前
OpenClaw开源项目汇总:Installer一键部署、Moltworker云端方案、钉钉飞书微信接入全指南
微信·开源·aigc·钉钉·飞书·学习方法·业界资讯
SJMP197417 天前
OpenClaw 本地 Windows 部署(WSL),对接钉钉
windows·钉钉·阿里云百炼·openclaw
liangshanbo121517 天前
OpenClaw 安装与钉钉机器人配置总结
钉钉·openclaw
兰亭古墨18 天前
钉钉工作台自建组件定时器被禁?用 Swiper 模拟 setInterval 的优雅方案
前端·钉钉
杭州吉网运维日记22 天前
钉钉告警推送@多人脚本
数据库·python·钉钉
yunfuuwqi22 天前
2026年OpenClaw(Clawdbot)一键部署教程及对接QQ、企业微信、飞书、钉钉等IM平台步骤
运维·服务器·网络·人工智能·钉钉·飞书·企业微信
zandy10111 个月前
AI驱动全球销售商机管理:钉钉DingTalk A1的跨域管理智能解决方案
人工智能·百度·钉钉
feng一样的男子1 个月前
阿里云的moltbot机器人使用钉钉的Stream流式接入
阿里云·机器人·钉钉
Honmaple1 个月前
OpenClaw 钉钉插件安装指南
服务器·网络·钉钉