@axolo/egg-dingtalk
v0.0.2
Published
node-dingtalk plugin for Egg.js.
Downloads
8
Maintainers
Readme
egg-dingtalk
node-dingtalk plugin for Egg.js.
Install
npm i @axolo/egg-dingtalk --save
Usage
// {app_root}/config/plugin.js
exports.dingtalk = {
enable: true,
package: '@axolo/egg-dingtalk',
};
Configuration
// {app_root}/config/config.default.js
exports.dingtalk = {};
see https://github.com/axolo/node-dingtalk for more help. see config/config.default.js for more detail.
Config client or clients as you like:
dingtalk corp app:
{ client: { appKey, appSecret, agentId } }
dingtalk isv suite with single app:
{ client: { suiteKey, suiteSecret, appId } }
dingtalk isv suite with multiple apps:
{
client: {
suiteKey,
suiteSecret,
apps: [ { appId }, { appId } ],
}
}
dingtalk isv suite with multiple apps per app:
{
clients: {
app1: { suiteKey, suiteSecret, appId },
app2: { suiteKey, suiteSecret, appId },
},
}
Example
const Controller = require('egg').Controller;
class DingtalkController extends Controller {
async index() {
const { app, ctx } = this;
const { dingtalk } = app;
const corpId = 'CORP_ID';
const params = { id: 1 };
const result = await dingtalk.execute('/department/get', { params }, { corpId });
ctx.body = result;
}
}
module.exports = DingtalkController;
Questions & Suggestions
Please open an issue here.