From d68912050e47ddc6b0e74945ee80949af505b6e8 Mon Sep 17 00:00:00 2001 From: Cedric Hutchings Date: Wed, 23 Feb 2022 11:23:57 -0500 Subject: [PATCH] support specifying first channel in requests to slack joining api --- pages/api/join.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pages/api/join.js b/pages/api/join.js index 288331db..a7ef31e5 100644 --- a/pages/api/join.js +++ b/pages/api/join.js @@ -58,14 +58,15 @@ export default async function handler(req, res) { // I only got a successful response by putting all the args in URL params // Giving JSON body DID NOT WORK when testing locally // —@MaxWofford - + + const LOBBY_ID = "C74HZS5A5"; if(open){ const params = [ `email=${data.email}`, `token=${process.env.SLACK_LEGACY_TOKEN}`, `real_name=${data.name}`, 'restricted=true', - `channels=C74HZS5A5`, + `channels=${data.firstChannel ?? LOBBY_ID}`, 'resend=true' ].join('&') const url = `https://slack.com/api/users.admin.invite?${params}`