Paul Thompson avatar image
Paul Thompson asked Tyler Liu answered

Issues with ringcentral-chatbot package

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


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

I am also using the following code for authentication

const rcsdk = new SDK({
    server: SDK.server.sandbox,
    appKey: process.env.RINGCENTRAL_CHATBOT_CLIENT_ID,
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

I also setup

1 |1500

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Tyler Liu avatar image
Tyler Liu answered

If you use the chatbot framework, why do you need to write code to do authentication? The framework handles it for you.

I think there is no data in your database, so the bot is null:

It seems that you are trying the bot on a EC2 server. Does it work on your dev server? Maybe you can try remove and re-add the bot, if the bot doesn't exist in your db.

1 |1500

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys