RocketChat / hubot-rocketchat-boilerplate

An example Hubot demonstrating usage of the Rocket.Chat adaptor.
MIT License
36 stars 32 forks source link

broadcast notification in direct message problem too-many-requests #14

Open MonsieurPatate opened 3 years ago

MonsieurPatate commented 3 years ago

I'm trying to send broadcast notification in direct message via bot (bot repository):

const { driver } = require('@rocket.chat/sdk');

module.exports = (robot) => {
    robot.respond(/notify/i, (msg) => {
        let userNames = ['1','2','3'];
        userNames.forEach(userName => driver.sendDirectToUser(message, userName));
    }
}

In the administration panel I turned off all rate limiters, but every time I get an exception :

ERROR [createDirectMessage] Error: { isClientSafe: true, error: 'too-many-requests', reason: 'Error, too many requests. Please slow down. You must wait 54 seconds before trying again.', details: { timeToReset: 53009 }, message: 'Error, too many requests. Please slow down. You must wait 54 seconds before trying again. [too-many-requests]', errorType: 'Meteor.Error' }

I have about 2000 users and I don't think that it should be a problem.