Giter Club home page Giter Club logo

zoomapi's Introduction

zoomapi

NodeJS library for working with the Zoom API.

zoomapi provides server-side access to the Zoom APIs via JWT access tokens (deprecation scheduled for June 2023) or server-to-server OAuth. It's written completely in Typescript, and only has one dependency. Works on NodeJS version 18 and higher.

npm i zoomapi

Usage

import zoomApi from 'zoomapi';

// JWT app
const client = zoomApi({
  apiKey: process.NODE_ENV.ZoomApiKey,
  apiSecret: process.NODE_ENV.ZoomApiSecret,
  webhookSecretToken: process.NODE_ENV.webhookSecretToken
});
// or Server-to-Server OAuth app
const client = zoomApi({
  accountId: process.NODE_ENV.ZoomAccountId,
  oauthClientId: process.NODE_ENV.ZoomOAuthClientId,
  oauthClientSecret: process.NODE_ENV.ZoomOAuthClientSecret,
  webhookSecretToken: process.NODE_ENV.webhookSecretToken,
  /**
   * optional function called when access token is retrieved
   */
  onSetAccessToken: async (token) => {
    return await setToken(token);
  },
  /**
   * optional function to explicitly supply an access token,
   * instead of fetching a new one
   */
  onGetAccessToken: async () => {
    return await getToken();
  }
});

const users = await client.users.ListUsers();

API Progress

This library doesn't (yet) implement every API call. PRs are welcome and encouraged.

Tests

None yet.

Contributing

Pull requests are more than welcome! Please follow existing naming and style conventions, and correct any linting errors.

License

MIT

zoomapi's People

Contributors

jasonxian avatar neo773 avatar pierre-elie avatar saitho avatar sdenardi avatar sedenardi avatar steelbrain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

zoomapi's Issues

Does not handle multi-threaded token invalidation

Just in case someone else was using this library with JWT and has moved to Server-to-server Oauth (v2.x)... this library does not support multi-threaded server applications with Oauth out of the box. By default, Zoom will invalidate any previous oauth tokens when requesting a new one. This library always requests a new token. Thus if you have a multi-threaded or multi-instance server application, you will get random race conditions with "Invalid access token" errors in your logs. See this zoom discussion for more context:

https://devforum.zoom.us/t/server-to-server-oauth-annoying-token-invalidation/72070/15

tl;dr
You need to implement your own thread-safe shared token service, and then you can use the onGetAccessToken feature of this library to avoid fetching the token directly from zoom and instead fetch it from your token service.

Gracefully handle non-JSON responses from upstream

Experiencing an issue in Production where the upstream API (Zoom) sometimes does not return a valid JSON as response. To be able to diagnose these issues and fix them, we need to be able to access the raw contents and report them to Zoom.

Specifically, we should have a try/catch around JSON.parse in zoomRequest function and throw an error that includes the raw body in case of failure

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.