有奖捉虫:行业应用 & 管理与支持文档专题 HOT
文档中心 > 最佳实践 > 腾讯云微搭低代码 > 自定义代码调用企微 API

操作步骤

说明:
这里以发送应用消息接口为例。
1. 在 APIS 中创建企业微信开放服务。
?
?
?
2. 选中发送应用消息接口,复制对应的接口标识。
?
?
?
3. 再新建一个自定义代码的 APIS。
?
?
?
4. 输入以下代码。
说明:
自定义代码更多操作请参见 自定义代码-API
/**
* 使用 npm 包 node-fetch 发送http请求, 详细使用文档可以参考
* https://github.com/node-fetch/node-fetch
*/
const fetch = require('node-fetch');
?
module.exports = async function (params, context) {
?
const result = await context.callConnector({
name: 'API 标识',
// 传入 发送应用消息 接口标识
methodName: 'message_send',
params: {
"touser": "接受用户",
"msgtype": "消息类型",
"agentid": 应用ID,
"text": {
"content": "推送内容"
}
}, // 方法入参
});
?
return {
result
};
};
?
?
?


http://www.vxiaotou.com