npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ms-qywx-chat

v1.0.12

Published

企业微信 会话存档Nodejs调用软件包

Downloads

14

Readme

ms-qywx-chat


企业微信会话存档, 适用于mac, linux, windows等系统, 使用前需要提前安装node-gyp, 建议使用[email protected]版本。

安装


安装示例:

npm install ms-qywx-chat

示例

1、查询企微聊天消息 getData(seq, limit, timeout, corpid, secret)

  • seq, 从指定的seq开始拉取消息,注意的是返回的消息从seq+1开始返回,seq为之前接口返回的最大seq值。首次使用请使用seq:0 。Number类型
  • limit, 一次拉取的消息条数,最大值1000条,超过1000条会返回错误。Number类型
  • timeout, 超时时间,单位秒。Number类型
  • corpid, 调用企业的企业id, 可以在企业微信管理端--我的企业--企业信息查看。String类型
  • secret, 聊天内容存档的Secret, 可以在企业微信管理端--管理工具--聊天内容存档查看。String类型。
// 引用
const qywxChat = require('ms-qywx-chat');

/**
 * 获取消息
 * 参数解释:
 * seq, 从指定的seq开始拉取消息,注意的是返回的消息从seq+1开始返回,seq为之前接口返回的最大seq值。首次使用请使用seq:0
 * limit, 一次拉取的消息条数,最大值1000条,超过1000条会返回错误
 * timeout, 超时时间,单位秒
 * corpid, 调用企业的企业id, 可以在企业微信管理端--我的企业--企业信息查看
 * secret, 聊天内容存档的Secret, 可以在企业微信管理端--管理工具--聊天内容存档查看
 */
let seq = 0;
let limit = 10;
let timeout = 60;
let corpid = 'xxxx corpid xxxx';
let secret = 'xxxx secret xxxx';
const message = qywxChat.getData(seq, limit, timeout, corpid, secret);
console.log('message:', message);

2、查询媒体消息 getMediaData(sdkfileid, timeout, filepath, corpid, secret)

  • sdkfileid, 媒体资源的id信息。String类型
  • timeout, 超时时长。 Number类型
  • filepath, 媒体文件本地保存路径。String类型
  • corpid, 企业ID。String类型
  • secret, 存档 Secret。String类型
// 引用
const qywxChat = require('ms-qywx-chat');
const path = require('path');

let sdkfileid = 'CtYBMzA2OTAyMDEwMjA0NjIzMDYwMDIwMTAwMDIwNDY5MjhhNTAwMDIwMzBmNDI0MTAyMDQzNmMxNmViNDAyMDQ2NDNmM2Q0Z...';
let timeout = 60;
let filepath = path.join(__dirname, 'temp.png');
let corpid = 'xxxx corpid xxxx';
let secret = 'xxxx secret xxxx';
const mediaMessage = qywxChat.getMediaData(sdkfileid, timeout, filepath, corpid, secret);
console.log('mediaMessage:', mediaMessage);

3、解密消息 decryptData(decrypt_random_key, encrypt_chat_msg)

  • decrypt_random_key, getData返回的encrypt_random_key,使用企业自持对应版本私钥RSA解密后的内容。String类型
  • encrypt_chat_msg, getchatdata返回的encrypt_chat_msg。String类型
// 引用
const qywxChat = require('ms-qywx-chat');

let decrypt_random_key = 'xxxx ...';
let encrypt_chat_msg = 'yyyy ...';
const decryptMessage = qywxChat.decryptData(decrypt_random_key, encrypt_chat_msg);
console.log('decryptMessage:', decryptMessage);