操作步骤
说明:
这里以发送应用消息接口为例。
1. 在 APIS 中创建企业微信开放服务。
2. 选中发送应用消息接口,复制对应的接口标识。
3. 再新建一个自定义代码的 APIS。
4. 输入以下代码。
说明:
/*** 使用 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};};