Reputation: 134
I recently deployed a bot using Azure and BotFramework to Skype, Slack, Telegram and some other platforms.
They all seem to work fine, except in Kik, where the bot will suddenly stop responding. The error message in BotFramework reads:
{"message":"Too many requests for user: 'redacted_user_name'","error":"TooManyRequests"}
The Kik tester is triggering this error through regular use, though when I test it on my (Android) phone, it works just fine.
Any idea what might be causing this?
EDIT:
After contacting Kik, I was told that my Bot was sending more messages than it was recieving, and they only allow a surplus of 20 before a bot becomes banned.
They say the solution is to implement batching, which BotBuilder says is built in. (My bot uses session.send("text") followed by a prompt.) However, Kik does not see my messages as a batch, and every couplet is counting as 2 messages.
I tried adjusting the autoBatchDelay to see if 0 would work better than the default and noticed that it did not make a difference. Furthermore, changing it to 2000 also made no difference, and did not delay 2000ms between messages.
var bot = new builder.UniversalBot(connector, {autoBatchDelay: 0});
Is it possible my bot is not batching properly? What steps could I take to address this?
Upvotes: 0
Views: 347
Reputation: 10593
Batching for Kik is currently on our backlog. In the mean time, is there any reason you can't send your text and prompt in the same message (with carriage returns in between if needed)? That should resolve your issue (as I understand it).
Also worth noting that the Kik rules for recovering from a throttling deficit are somewhat complex.
• In any given send message request, a bot can send up to 25 messages in a single POST request. Within the 25 messages, a bot is allowed to have up to 5 messages directed to a single user.
• Whether you send 1 message or 5 messages, that collection of requests is considered a “batch” of messages to a user.
• A bot is allowed 20 unsolicited batches to a user a day.
• This means you could be sending between 20-100 unsolicited messages to a user a day depending on how many messages you have in a batch. How the bot platform determines unsolicitation works like a debit/credit system that resets at the end of a day. e.g. Julie sends the bot a message, the balance becomes +1. The bot responds with 3 messages in one batch, the balance becomes 0. Julie sends the bot 1 message, the balance becomes +1. The bot responds with 5 messages in separate batches, the balance becomes -4. Julie sends the bot a message, the balance becomes +1. The bot responds with 5 messages in separate batches, the balance becomes -9.
• If this deficit continues to -20, the daily user rate limit will have reached, and the bot will NOT be able to send any more messages to that user. There are different methods to work with this rate limit, e.g. using batches more efficiently or building a UX that encourages more user interactivity.
Upvotes: 1