RocketChat / Rocket.Chat.js.SDK

Utility for apps and bots to interact with Rocket.Chat via DDP and/or API
MIT License
136 stars 94 forks source link

driver.sendDirectToUser ERROR too-many-requests #119

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.