i am just started to develop service for slack and i just creating a connection to the slack bot but i have facing a problem that
Cannot read property 'RTM' of undefined
this is my code
const { RTMClient, CLIENT_EVENTS, RTM_EVENTS, RTM_MESSAGE_SUBTYPES } = require('@slack/client');
function handleOnAuthenticated(rtmStartData) {
console.log(`logged in as ${rtmStartData.self.name} of team ${rtmStartData.self.team.name} but not et connected to channel`);
}
function addAuthenticatedHandler(rtm, handler) {
rtm.on(CLIENT_EVENTS.RTM.AUTHENTICATED, handler);
}
module.exports.init = function slackClient(bot_token, logLevel) {
rtm = new RTMClient(bot_token);
addAuthenticatedHandler(rtm, handleOnAuthenticated);
return rtm;
}
module.exports.addAuthenticatedHandler = addAuthenticatedHandler;
i dont know what is the exact problem is can anyone tell me that why this is happening.