0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【便利ツール】Zoom Rivet SDKでZoom API呼び出し処理を圧縮!

Posted at

はじめに

Zoom APIを呼び出す時、まず認証に手間がかかりますよね。

  • OAuthトークンの取得・管理
  • JWTの生成
  • エンドポイントのURL組み立て
  • リクエストヘッダーの設定

本来APIリクエストをしたいのに、その手前の準備に時間がかかることも多いです。Zoomでサポートをしている際も、都度組み立ててテストをするのはコスパが悪い...。と思っていたのですが、これ全部、Zoom公式のRivet SDKを使えば一瞬で解決します。

今回は「とりあえずAPIを叩いてデータ取得したい」という用途に絞って、Zoom Rivet SDKの使い方を紹介します!

Untitled.png

Zoom Rivetとは

Zoom Rivetは、Zoomが公式に提供しているNode.js向けのSDKです。

主な特徴:

  • 🔐 認証の自動化 - OAuth/JWTを自動でハンドリング
  • 📦 APIラッパー - 直感的なメソッド呼び出しでAPI実行
  • 🎣 Webhookサポート - イベント受信サーバーも簡単構築

対応モジュール:

モジュール 認証方式 主な用途
Meetings Server OAuth / User OAuth ミーティング管理
Users Server OAuth / User OAuth ユーザー管理
Accounts Server OAuth / User OAuth アカウント設定
Phone Server OAuth / User OAuth Zoom Phone
Team Chat Server OAuth / User OAuth チャット機能
Chatbot Client Credentials チャットボット
VideoSDK API JWT VideoSDK セッション管理など

他のモジュールも順次追加される予定です。

事前準備

1. Zoom Marketplaceでアプリを作成

Zoom Apps Marketplace にアクセスして、Server-to-Server OAuth Appを作成します。

Screenshot 2025-12-11 at 17.31.41.png

Server-to-Server OAuth App の作成手順の詳細については、過去記事を参照ください。

作成後、以下の情報をメモしておきます:

  • Account ID
  • Client ID
  • Client Secret

Screenshot 2025-12-11 at 17.34.06.png

2. 必要なScopeを追加

使いたいAPIに応じてScopeを追加します。

例えば、ミーティング一覧を取得するなら:

  • meeting:read:list_meetings:admin
  • meeting:read:meeting:admin

Screenshot 2025-12-11 at 17.36.44.png

3. プロジェクトのセットアップ

mkdir zoom-rivet-test
cd zoom-rivet-test
npm init -y
npm install @zoom/rivet dotenv

.envファイルを作成:

ZOOM_ACCOUNT_ID=your_account_id
ZOOM_CLIENT_ID=your_client_id
ZOOM_CLIENT_SECRET=your_client_secret

基本的な使い方

今回はAPIリクエストクライアントとして使います

Rivetは本来Webhookサーバーを立ち上げて受信も可能な設計ですが、APIを叩くだけなら disableReceiver: true を指定すればOKです。

import { MeetingsS2SAuthClient } from "@zoom/rivet/meetings";

// Server-to-Server OAuth認証のMeetingsクライアント
const client = new MeetingsS2SAuthClient({
    accountId: process.env.ZOOM_ACCOUNT_ID,
    clientId: process.env.ZOOM_CLIENT_ID,
    clientSecret: process.env.ZOOM_CLIENT_SECRET,
    disableReceiver: true  // ← これでWebhookサーバーを無効化
});

これだけで認証周りは全部Rivetが肩代わりしてくれるので、開発時は実際のエンドポイントの呼び出し処理だけ書けば良くなります。

実践:ミーティング一覧を取得

コード例

// listMeetings.js
import { MeetingsS2SAuthClient } from "@zoom/rivet/meetings";

const client = new MeetingsS2SAuthClient({
    accountId: process.env.ZOOM_ACCOUNT_ID,
    clientId: process.env.ZOOM_CLIENT_ID,
    clientSecret: process.env.ZOOM_CLIENT_SECRET,
    disableReceiver: true
});

async function listMeetings() {
    const response = await client.endpoints.meetings.listMeetings({
        path: { userId: "me" },  // "me" = 自分のミーティング
        query: {
            type: "scheduled",   // scheduled, live, upcoming など
            page_size: 30
        }
    });

    console.log(JSON.stringify(response.data, null, 2));
}

listMeetings();

実行結果

node listMeetings.js
{
  "page_size": 30,
  "total_records": 2,
  "meetings": [
    {
      "uuid": "xxxxxxxxxxxx",
      "id": 12345678901,
      "host_id": "xxxxxxxx",
      "topic": "Weekly Team Meeting",
      "type": 2,
      "start_time": "2025-12-15T10:00:00Z",
      "duration": 60,
      "timezone": "Asia/Tokyo",
      "created_at": "2025-12-08T06:45:52Z",
      "join_url": "https://zoom.us/j/12345678901"
    }
  ]
}

APIの呼び出しパターン

Rivetでは、APIの呼び出しは以下のパターンで統一されています:

client.endpoints.カテゴリ.メソッド名({
    path: { /* URLパスパラメータ */ },
    query: { /* クエリパラメータ */ },
    body: { /* リクエストボディ(POST/PUT時) */ }
});

例:ミーティングを作成する

const response = await client.endpoints.meetings.createMeeting({
    path: { userId: "me" },
    body: {
        topic: "My New Meeting",
        type: 2,  // Scheduled meeting
        start_time: "2025-12-20T14:00:00",
        duration: 60,
        timezone: "Asia/Tokyo",
        settings: {
            host_video: true,
            participant_video: true,
            join_before_host: false,
            mute_upon_entry: true
        }
    }
});

console.log("Meeting created:", response.data.join_url);

他のモジュールも同じ感覚で使える

Users - ユーザー一覧取得

import { UsersS2SAuthClient } from "@zoom/rivet/users";

const client = new UsersS2SAuthClient({
    accountId: process.env.ZOOM_ACCOUNT_ID,
    clientId: process.env.ZOOM_CLIENT_ID,
    clientSecret: process.env.ZOOM_CLIENT_SECRET,
    disableReceiver: true
});

const response = await client.endpoints.users.listUsers({
    query: { status: "active", page_size: 30 }
});

Accounts - アカウント設定取得

import { AccountsS2SAuthClient } from "@zoom/rivet/accounts";

const client = new AccountsS2SAuthClient({
    accountId: process.env.ZOOM_ACCOUNT_ID,
    clientId: process.env.ZOOM_CLIENT_ID,
    clientSecret: process.env.ZOOM_CLIENT_SECRET,
    disableReceiver: true
});

const response = await client.endpoints.accounts.getAccountSettings({
    path: { accountId: "me" }
});

Team Chat - チャンネル一覧取得

import { TeamChatS2SAuthClient } from "@zoom/rivet/teamchat";

const client = new TeamChatS2SAuthClient({
    accountId: process.env.ZOOM_ACCOUNT_ID,
    clientId: process.env.ZOOM_CLIENT_ID,
    clientSecret: process.env.ZOOM_CLIENT_SECRET,
    disableReceiver: true
});

const response = await client.endpoints.chat.listChannels({
    query: { page_size: 50 }
});

Phone - 通話履歴取得

import { PhoneS2SAuthClient } from "@zoom/rivet/phone";

const client = new PhoneS2SAuthClient({
    accountId: process.env.ZOOM_ACCOUNT_ID,
    clientId: process.env.ZOOM_CLIENT_ID,
    clientSecret: process.env.ZOOM_CLIENT_SECRET,
    disableReceiver: true
});

const response = await client.endpoints.callHistory.listAccountCallHistory({
    query: { 
        from: "2025-12-01",
        to: "2025-12-11",
        page_size: 30
    }
});

利用可能なエンドポイント一覧の調べ方

「どんなメソッドがあるの?」と思ったら、TypeScriptの型定義を見るのが一番!

# node_modules内の型定義ファイルを確認
cat node_modules/@zoom/rivet/meetings/meetings.d.ts

または、VSCodeなどのIDEで client.endpoints. まで打つと、それ以降の補完候補が出てきます。

Screenshot 2025-12-11 at 17.51.29.png

まとめ

Zoom Rivet SDKのいいところ:

  • ✅ 認証を全部やってくれる(OAuth/JWT自動管理)
  • disableReceiver: true でAPI専用クライアントとして使える
  • ✅ TypeScript対応で補完が効く
  • ✅ 公式SDKなので安心

Zoom API開発で消耗してる人、ぜひRivet試してみてください。楽になりますよ!

参考リンク

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?