I am using the node ringcentral-chatbot package along with the ringcentral. I am using the ringcentral-chatbot package to subscribe to and receive webooks, and I am currently getting an exception in the ringcentral-chatbot package when I receive the following webhook
WebHook payload: {"uuid":"2249990457863490969","event":"/restapi/v1.0/glip/posts","timestamp":"2021-03-29T22:49:33.826Z","subscriptionId":"fb6f0643-0eb4-4996-b4dd-96dcecc9181b","ownerId":"292777004","body":{"id":"4790575108","groupId":"616022018","type":"TextMessage","text":"good","creatorId":"292005004","addedPersonIds":null,"creationTime":"2021-03-29T22:49:33.509Z","lastModifiedTime":"2021-03-29T22:49:33.509Z","attachments":null,"activity":null,"title":null,"iconUri":null,"iconEmoji":null,"mentions":null,"eventType":"PostAdded"}}
POST /bot/webhook 200 0 - 0.650 ms
/home/ec2-user/my-bot/node_modules/ringcentral-chatbot/dist/handlers/postAdded.js:30
const group = await bot.getGroup(groupId);
^
TypeError: Cannot read property 'getGroup' of null
at postAdded (/home/ec2-user/my-bot/node_modules/ringcentral-chatbot/dist/handlers/postAdded.js:30:27)
at async /home/ec2-user/my-bot/node_modules/ringcentral-chatbot/dist/apps/bot.js:52:28
Any ideas on what might be causing this?
I have the following defined as environment variables
RINGCENTRAL_SERVER RINGCENTRAL_CHATBOT_ADMIN_USERNAME RINGCENTRAL_CHATBOT_ADMIN_PASSWORD RINGCENTRAL_CHATBOT_EXPRESS_PORT RINGCENTRAL_CHATBOT_CLIENT_ID RINGCENTRAL_CHATBOT_CLIENT_SECRET RINGCENTRAL_CHATBOT_SERVER RINGCENTRAL_APP_REDIRECT_URL RINGCENTRAL_CHATBOT_DATABASE_CONNECTION_URI
RINGCENTRAL_CHATBOT_AUTH_CODE
I am also using the following code for authentication const rcsdk = new SDK({ server: SDK.server.sandbox, appKey: process.env.RINGCENTRAL_CHATBOT_CLIENT_ID, appSecret: process.env.RINGCENTRAL_CHATBOT_CLIENT_SECRET });
const platform = rcsdk.platform(); let data = platform.auth().data(); data.token_type = "bearer" data.expires_in = 1000000 data.access_token = process.env.RINGCENTRAL_CHATBOT_AUTH_CODE data.refresh_token = 'xxx' data.refresh_token_expires_in = 1000000 platform.auth().setData(data)
I also setup