node-dd-bot
v1.0.8
Published
- 钉钉机器人开发SDK ## prepare 1. 前往[钉钉开放平台](https://open-dev.dingtalk.com/fe/app#/corp/app)创建应用 2. 点击创建好的应用,为其添加`机器人`能力 3. 点击凭证与基础信息,获取`clientId`和`clientSecret` 4. 填写机器人信息,并指定消息接收模式为`Stream模式` 5.
Downloads
109
Readme
dingtalk-bot
- 钉钉机器人开发SDK
prepare
- 前往钉钉开放平台创建应用
- 点击创建好的应用,为其添加
机器人
能力 - 点击凭证与基础信息,获取
clientId
和clientSecret
- 填写机器人信息,并指定消息接收模式为
Stream模式
- 发布机器人
install
npm install node-dd-bot
usage
const {Bot}=require('node-dd-bot')
const bot=new Bot({
clientId:'',
clientSecret:''
})
bot.on('message.group',(e)=>{
e.reply('hello world')
})
bot.on('message.private',(e)=>{
e.reply('hi world')
})
bot.sendPrivateMsg('user_id',[
'你好呀',
{
type:'image',
url:'https://foo.bar/img.jpg'
}
])
bot.sendGroupMsg('converationId',[
'你好呀',
{
type:'image',
url:'https://foo.bar/img.jpg'
}
])
bot.start()