
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
enhancer-node-dingtalk
Advanced tools
$ npm i node-dingtalk --save
const DingTalk = require('node-dingtalk');
const dingtalk = new DingTalk({
corpid: '',
corpsecret: '',
});
const deparment = dingtalk.department.get('1');
console.log(deparment);
cluster 下换成 Redis 等外部存储从而降低获取 AccessToken 频率
const CACHE = {};
const cache = {
get(key) {
if (CACHE[key] && (CACHE[key].expired > Date.now())) {
return CACHE[key].value;
} else {
return null;
}
},
set(key, value, maxAge) {
const obj = {
expired: maxAge,
value,
};
CACHE[key] = obj;
return obj;
},
};
// const redis = new Redis();
// const cache = {
// async get(key) {
// return redis.get(key)
// },
// async set(key, value, maxAge) {
// return redis.set(key, value, 'PX', maxAge - Date.now());
// },
// };
const DingTalk = require('node-dingtalk');
const dingtalk = new DingTalk({
corpid: '',
corpsecret: '',
cache,
});
官方文档: https://open-doc.dingtalk.com/
获取 AccessToken, 并在有效期内自动缓存, gettoken
获取 jsapi_ticket, 并在有效期内自动缓存, get_jsapi_ticket
获取 js api 接入时需要的配置数据以及签名
辅助方法, 参见 npm urllib
https://open-doc.dingtalk.com/doc2/detail.htm?treeId=172&articleId=104979&docType=1
获取部门列表 department/list
获取部门详情 department/get
创建部门 department/create
更新部门 department/update
删除部门 department/delete
https://open-doc.dingtalk.com/doc2/detail.htm?treeId=172&articleId=104979&docType=1
user/simplelistuser/list分页查询参数放到 opts
自动遍历分页查询
获取成员详情 user/get
id 对应于 userid, 参数, 其他参数放到 opts
创建成员 user/create
更新成员 user/update
user/deleteuser/batchdelete根据 unionid 获取成员的 userid, user/getUseridByUnionid
此处的 unionid 即为 user.openId
根据手机号获取成员 userid, user/get_by_mobile
发送企业消息, message/send
获取企业会话消息已读未读状态, message/list_message_status
上传媒体文件 media/upload
下载媒体文件 media/downloadFile
https://open-doc.dingtalk.com/docs/doc.htm?treeId=385&articleId=106091&docType=1
获取授权范围 auth/scopes
https://open-doc.dingtalk.com/microapp/serverapi2/nb93oa
获取外部联系人列表 topapi/extcontact/list
获取所有外部联系人列表
通过 userid 获取外部联系人信息 topapi/extcontact/get
添加外部联系人 topapi/extcontact/create
更新外部联系人 topapi/extcontact/update
删除外部联系人 topapi/extcontact/delete
获取外部联系人标签 topapi/extcontact/listlabelgroups
Please open an issue here.
FAQs
dingtalk node sdk
We found that enhancer-node-dingtalk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.