[ { "id": "324e52518979a2c2", "type": "tab", "label": "Zoom予約", "disabled": false, "info": "" }, { "id": "4d5fb71e2d6792d1", "type": "ui_form", "z": "324e52518979a2c2", "name": "入力フォーム", "label": "Zoom会議設定", "group": "f90b871cb102192d", "order": 1, "width": 0, "height": 0, "options": [ { "label": "会議名", "value": "name", "type": "text", "required": true, "rows": null }, { "label": "会議日付", "value": "date", "type": "date", "required": true, "rows": null }, { "label": "開始時刻", "value": "time", "type": "time", "required": true, "rows": null }, { "label": "所要時間(分)", "value": "duration", "type": "number", "required": true, "rows": null } ], "formValue": { "name": "", "date": "", "time": "", "duration": "" }, "payload": "", "submit": "登録", "cancel": "キャンセル", "topic": "topic", "topicType": "msg", "splitLayout": "", "x": 180, "y": 80, "wires": [ [ "7da7b56ed73ef2d8" ] ] }, { "id": "13331dd1ee6d4301", "type": "jwt sign", "z": "324e52518979a2c2", "name": "", "alg": "HS256", "exp": 3600, "jwkurl": "", "jwkkid": "", "secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "key": "", "signvar": "payload", "storetoken": "payload", "x": 540, "y": 380, "wires": [ [ "dc03c5a611ebb1c7" ] ] }, { "id": "7d8356e5bdae38c6", "type": "function", "z": "324e52518979a2c2", "name": "Zoom の API キーを変数に設定", "func": "msg.payload = {\n iss: 'xxxxxxxxxxxxxxxxxxxxxx', // Zoom API キー\n}\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 310, "y": 360, "wires": [ [ "13331dd1ee6d4301" ] ] }, { "id": "dc03c5a611ebb1c7", "type": "function", "z": "324e52518979a2c2", "name": "会議情報を変数に設定", "func": "// 設定箇所\nconst zoomUserId = 'xxxxxx@yyy.zz' // Zoomに登録のメールアドレス(例:xxx@yyy.zzz)\nconst meeting_password = 'password' // 会議参加のパスコード・パスワード(例:hogehoge)\n\n\nconst date = msg.form.date\nconst time = msg.form.time\nconst datetime = date + 'T' + time\n\nmsg = {\n url: `https://api.zoom.us/v2/users/${zoomUserId}/meetings`,\n method: 'POST',\n headers: {\n 'Authorization': `Bearer ${msg.payload}`, // JWT token で Bearer 認証\n 'User-Agent': 'Zoom-api-Jwt-Request',\n 'content-type': 'application/json'\n },\n payload: {\n 'topic': msg.form.name,\n 'type': 2,\n 'start_time': datetime,// 例:'2021-08-18T13:00:00'\n 'duration': msg.form.duration, // 分\n 'timezone': 'Asia/Tokyo',\n 'password': meeting_password,\n 'agenda': 'Node-REDから予約',\n 'settings': {\n 'host_video': false,\n 'participant_video': false,\n 'join_before_host': true,\n 'mute_upon_entry': true,\n 'use_pmi': false,\n 'approval_type': 2,\n 'waiting_room': false,\n }\n }\n}\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 320, "y": 500, "wires": [ [ "21facc88bb62fd23" ] ] }, { "id": "21facc88bb62fd23", "type": "http request", "z": "324e52518979a2c2", "name": "", "method": "use", "ret": "obj", "paytoqs": "ignore", "url": "", "tls": "", "persist": false, "proxy": "", "authType": "", "x": 530, "y": 520, "wires": [ [ "cef9cd276dcec534" ] ] }, { "id": "7da7b56ed73ef2d8", "type": "change", "z": "324e52518979a2c2", "name": "フォームの内容を別変数に保存", "rules": [ { "t": "set", "p": "form", "pt": "msg", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 270, "y": 220, "wires": [ [ "6dc7ead7963e6a41" ] ] }, { "id": "6dc7ead7963e6a41", "type": "moment", "z": "324e52518979a2c2", "name": "日時を日本時間に修正", "topic": "", "input": "form.date", "inputType": "msg", "inTz": "Europe/London", "adjAmount": 0, "adjType": "days", "adjDir": "add", "format": "YYYY-MM-DD", "locale": "en-US", "output": "form.date", "outputType": "msg", "outTz": "Asia/Tokyo", "x": 540, "y": 240, "wires": [ [ "4fa7eb3535d1244c" ] ] }, { "id": "4fa7eb3535d1244c", "type": "moment", "z": "324e52518979a2c2", "name": "時刻を日本時間に修正", "topic": "", "input": "form.time", "inputType": "msg", "inTz": "Europe/London", "adjAmount": 0, "adjType": "days", "adjDir": "add", "format": "HH:mm:ss", "locale": "en-US", "output": "form.time", "outputType": "msg", "outTz": "Asia/Tokyo", "x": 780, "y": 260, "wires": [ [ "7d8356e5bdae38c6" ] ] }, { "id": "cef9cd276dcec534", "type": "function", "z": "324e52518979a2c2", "name": "会議情報を整形", "func": "// ミーティングIDにスペースを入れて読みやすくする\nconst original_id = msg.payload.id\nconst id1 = String(original_id).substr(0, 3)\nconst id2 = String(original_id).substr(3, 4)\nconst id3 = String(original_id).substr(7, 4)\nconst edited_id = id1 + ' ' + id2 + ' ' + id3\n\n// 画面に表示する内容\nmsg.payload = {\n meeting_topic: msg.payload.topic,\n meeting_url: msg.payload.join_url,\n meeting_id: edited_id,\n meeting_password: msg.payload.password,\n}\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 340, "y": 640, "wires": [ [ "9c4e3d828c06fb7f", "404d4cc3a49e8614", "a69f23fefd982196", "452338f89fc42d63" ] ] }, { "id": "404d4cc3a49e8614", "type": "ui_text", "z": "324e52518979a2c2", "group": "f90b871cb102192d", "order": 3, "width": 0, "height": 0, "name": "", "label": "会議URL:", "format": "{{msg.payload.meeting_url}}", "layout": "row-spread", "x": 690, "y": 720, "wires": [] }, { "id": "a69f23fefd982196", "type": "ui_text", "z": "324e52518979a2c2", "group": "f90b871cb102192d", "order": 5, "width": 0, "height": 0, "name": "", "label": "ミーティングID:", "format": "{{msg.payload.meeting_id}}", "layout": "row-spread", "x": 710, "y": 760, "wires": [] }, { "id": "452338f89fc42d63", "type": "ui_text", "z": "324e52518979a2c2", "group": "f90b871cb102192d", "order": 7, "width": 0, "height": 0, "name": "", "label": "パスコード:", "format": "{{msg.payload.meeting_password}}", "layout": "row-spread", "x": 700, "y": 800, "wires": [] }, { "id": "d0d945c94e0283d9", "type": "comment", "z": "324e52518979a2c2", "name": "入力フォームの内容を整形", "info": "", "x": 250, "y": 180, "wires": [] }, { "id": "3dc800859bfebfb8", "type": "comment", "z": "324e52518979a2c2", "name": "JWT トークンの生成", "info": "", "x": 270, "y": 320, "wires": [] }, { "id": "24b35a559338d7ad", "type": "comment", "z": "324e52518979a2c2", "name": "Zoom API をキック", "info": "", "x": 310, "y": 460, "wires": [] }, { "id": "f2c483883f1724d9", "type": "comment", "z": "324e52518979a2c2", "name": "作成した会議情報を表示", "info": "", "x": 370, "y": 600, "wires": [] }, { "id": "9c4e3d828c06fb7f", "type": "ui_text", "z": "324e52518979a2c2", "group": "f90b871cb102192d", "order": 2, "width": 0, "height": 0, "name": "", "label": "会議名:", "format": "{{msg.payload.meeting_topic}}", "layout": "row-spread", "x": 680, "y": 680, "wires": [] }, { "id": "293a403a6899abcf", "type": "ui_ui_control", "z": "324e52518979a2c2", "name": "ページリロード時に初期化", "events": "all", "x": 380, "y": 680, "wires": [ [ "9c4e3d828c06fb7f", "404d4cc3a49e8614", "a69f23fefd982196", "452338f89fc42d63" ] ] }, { "id": "f90b871cb102192d", "type": "ui_group", "name": "Zoom", "tab": "81df18134dd1c6ad", "order": 1, "disp": false, "width": "6", "collapse": false }, { "id": "81df18134dd1c6ad", "type": "ui_tab", "name": "ホーム", "icon": "dashboard", "disabled": false, "hidden": false } ]