@chat-bots/dingtalk-node
WIP: 请勿作为生产项目使用
钉钉 NodeJS 模块。
安装
$ npm i @chat-bots/dingtalk-node -S
消息接收
与 Koa 集成
import { EventDispatcher, EventType, adaptKoa } from '@chat-bots/dingtalk-node'
import Koa from 'koa'
import { koaBody } from 'koa-body'
const eventDispatcher = new EventDispatcher({
appId: process.env['APP_ID'],
aesKey: process.env['AES_KEY'],
token: process.env['TOKEN'],
})
eventDispatcher.register(EventType.ImMessage, async function (message) {
message.reply('Hello, world!')
})
const app = new Koa()
app.use(koaBody())
app.use(adaptKoa('/v1/webhook/event', eventDispatcher))
app.listen(1245, function () {
console.log('Listen on http://localhost:1245')
})
自定义框架集成
eventDispatcher.callEvent(
{
encrypt: '加密字符串',
},
{
nonce: '',
signature: '',
timestamp: '',
},
)
eventDispatcher.callMessage(payload)
TODO
感谢
以下排名不分先后.
License
MIT