0.0.1-beta.1 • Published 4 months ago

@zhengxs/dingtalk-event-hubs v0.0.1-beta.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

@zhengxs/dingtalk-event-hubs

安装

# With PNPM
$ pnpm add @zhengxs/dingtalk-auth @zhengxs/dingtalk-event-hubs

示例

import { AuthCredential } from '@zhengxs/dingtalk-auth';
import { HubConnectionBuilder } from '@zhengxs/dingtalk-event-hubs';

async function main() {
  const credential = new AuthCredential({
    clientId: process.env.DINGTALK_CLIENT_ID,
    clientSecret: process.env.DINGTALK_CLIENT_SECRET,
  });

  const connection = new HubConnectionBuilder().withCredential(credential).build();

  connection.on('message', function (payload) {
    console.log(data);
  });

  await connection.start();
}

main();