Make your own oAuth loop, don’t rely on others, as when your token dies, you have to manually go around the loop, as you can’t refresh tokens automatically when generated on someone elses oAuth loop
Avoid whispers all together, you need a Twitch Extension of off site website instead.
As you can tell you are having problems sending “unsolicited” whispers, theres a few tricks to “fixing” this, but whispers are not a reliable way for bots to send messages to users. You get screwed, by looking like spam (sending a message which looks 80% or so similar to the last messages, and sending whispers to people where the bot initiated the conversation).
Disclaimer: these are things I think help you get a bad spam score but I don’t know it’s a black box.
This might be fixed by the user whispering the bot first to “opt in”, or becoming friends with the bot, but there is no APIs for friend management, and these don’t help all the time
That error is the “you got spam blocked” error essentially
It has a good history of non unique messages? (see disclaimer above)
Long story short: it’s NOT a code problem, it’s a “bad usage of whispers” problem, caused by the spammers/hackers etc “ruining” the whisper platform for us.
TLDR use an extension instead. That’ll let you use pretty graphics and stuff too, FAQ about the game, interactive scores, more than use your “secret whisper” data, user profile/history etc.