From 19f844972a5c908efdf66ad2a283def8b3119709 Mon Sep 17 00:00:00 2001 From: Kazuhiro Sera Date: Tue, 21 Dec 2021 12:23:23 +0900 Subject: [PATCH] Fix #632 Change the default settings to "useRtmConnect: true" (#633) --- slack.coffee | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/slack.coffee b/slack.coffee index a2175137..91a08cf7 100644 --- a/slack.coffee +++ b/slack.coffee @@ -9,9 +9,18 @@ exports.use = (robot) -> # reacts to only messages by insalled workspace users in a shared channel installedTeamOnly: process.env.INSTALLED_TEAM_ONLY? try - options.rtm = JSON.parse(process.env.HUBOT_SLACK_RTM_CLIENT_OPTS) - catch + options.rtm = JSON.parse(process.env.HUBOT_SLACK_RTM_CLIENT_OPTS or '{}') + unless options.rtm.useRtmConnect? + # The original way to connect to one of our oldest APIs is finally retiring. + # For existing apps, rtm.start will start behaving exactly like rtm.connect + # on September 20, 2022. Beginning November 30, 2021, newly created apps and integrations + # will only be able to use rtm.connect. + # https://api.slack.com/changelog/2021-10-rtm-start-to-stop + options.rtm.useRtmConnect = true + catch e + console.error(e) try - options.rtmStart = JSON.parse(process.env.HUBOT_SLACK_RTM_START_OPTS) - catch + options.rtmStart = JSON.parse(process.env.HUBOT_SLACK_RTM_START_OPTS or '{}') + catch e + console.error(e) new SlackBot robot, options