Hubot robot.messageRoom method can not work


Both hubot-rocketchat and hubot-rocketchat-boilerplate, both coffeescript and javascript have the same issue.

First I met this error: “TypeError: Cannot read property ‘roomID’ of undefined”

And then I resovled it according to the reference:

Now there is another error:
error: ‘error-not-allowed’,
reason: ‘Not allowed’,
details: { method: ‘getRoomIdByNameOrId’ },
message: ‘Not allowed [error-not-allowed]’,
errorType: ‘Meteor.Error’ }
It looks like a permission error but my account role is “bot”, I don’t know if it is a bug ,or a version compatibility issue ,or some other issues.

Server Setup Information

  • Operating System: CentOS 7.2
  • NodeJS Version: 8.16.0
  • Version of Rocket.Chat Server: 1.2.1
  • Hubot Version: 3.3.2
  • hubot-rocketchat Version: 2.0.0
  • chat room: general
  • user role: bot

Any additional Information

all error logs on hubot console:

[Wed Jul 03 2019 22:19:21 GMT+0800 (CST)] DEBUG [getRoomIdByNameOrId] Calling (caching): GENERL
[Wed Jul 03 2019 22:19:21 GMT+0800 (CST)] ERROR [getRoomIdByNameOrId] Error: { isClientSafe: true,
error: ‘error-not-allowed’,
reason: ‘Not allowed’,
details: { method: ‘getRoomIdByNameOrId’ },
message: ‘Not allowed [error-not-allowed]’,
errorType: ‘Meteor.Error’ }
(node:26333) UnhandledPromiseRejectionWarning: #
(node:26333) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:26333) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Sorry,the second error is not bug, just channel name does not exist.
It’s ok now.