New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

super-dingtalk

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

super-dingtalk

DingTalk and OAuth client for Node.js

latest
Source
npmnpm
Version
0.9.1
Version published
Weekly downloads
12
200%
Maintainers
1
Weekly downloads
 
Created
Source

super-dingtalk

DingTalk client for Node.js 钉钉 Node.js 客户端

安装

$ npm install super-dingtalk --save

使用方法

应用方法说明

各个方法需要的 Token 在接口请求(requestgetpost)自动获取和续期,也可以通过 getToken() 获得

/**
  * 通用请求接口
  *
  * @param {String} method - GET、POST
  * @param {String} api - API地址(以 / 开头)
  * @param {Object} query - 请求URL参数(获取AccessToken后默认会带上)
  * @param {String} body - POST请求的body(JSON需要JSON.stringify)
  * @param {String|Array} key - 返回数据中取出需要的key(不传全部ret返回)
  *
  * @returns {Promise}
  */
request(method, api, query, body, key)

// GET 方法简化接口
get(api, query, key)

// POST 方法简化接口
post(api, body, key)

企业应用

使用方法: dingtalk.js

const DingTalk = require('super-dingtalk').DingTalk;

const client = new DingTalk({
  corpId: 'xxxxx',
  secret: 'xxxxx',
});

免登服务

使用方法: dtoauth.js

const DTOAuth = require('../lib').DTOAuth;

const oauth = new DTOAuth({
  appId: 'xxx',
  appSecret: 'xxx',
});

// 获取扫描登录链接
const url = oauth.getQRParmasUrl('http://blog.yourtion.com');

其他操作详见测试与相关文档

相关资源:

免登接入 (DTOAuth)

  • 生成扫码登录URL getQRParmasUrl(redirectUri)
  • 获取钉钉开放应用 AccessToken getToken()
  • 获取用户授权的持久授权码 getPersistentCode(tmpAuthCode)
  • 获取用户授权的 SnsToken getSnsToken(openId, persistentCode)
  • 获取用户授权的个人信息 getUserInfo(snsToken)
  • 通过临时授权吗获取用户信息 getUserInfoFromCode(tmpAuthCode)

参考: 免登服务

钉钉服务端 (DingTalk)

基础功能

  • 获取 AccessToken getToken()
  • 获取 jsapi_ticket getTicket()
  • 获取 Web 端签名 getSign(url)
  • 获取企业员工人数 get('/user/get_org_user_count', { onlyActive: 0|1 }, 'count')
  • 服务端加密
  • 服务端解密
  • 记录统计数据
  • 更新统计数据

管理通讯录

  • 获取部门列表 get('/department/list', { id: 1|"parentid" }, 'department')
  • 获取部门详情 get('/department/get', { id: "department_id" })
  • 创建部门
  • 更新部门
  • 删除部门
  • 根据 unionid 获取成员的 userid get('/user/getUseridByUnionid', { unionid }, 'userid')
  • 获取成员详情 get('/user/get', { userid })
  • 创建成员
  • 创建成员
  • 更新成员
  • 删除成员
  • 批量删除成员
  • 获取部门成员 get('/user/simplelist', pamras, 'userlist')
  • 获取部门成员(详情)get('/user/list', pamras, 'userlist')
  • 获取管理员列表

企业会话消息接口

  • 发送企业会话消息
  • 获取企业会话消息已读未读状态

Keywords

DingTalk

FAQs

Package last updated on 01 Jun 2017

Did you know?

Socket

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.

Install

Related posts