slack-bot-api icon indicating copy to clipboard operation
slack-bot-api copied to clipboard

.fail example given in readme does not get called

Open honestbleeps opened this issue 7 years ago • 2 comments

From the readme:

bot.postMessageToUser('user1', 'hi').fail(function(data) { //data = { ok: false, error: 'user_not_found' } })

if you change user1 to a user that exists, the message does get sent

if user1 does not exist, the anonymous function provided to fail never gets called, the failure simply happens silently.

not sure if this is a change on Slack's end that has broken this, or if it's an issue with the slackbots library, but something likely needs to be updated either way.

honestbleeps avatar Oct 26 '16 19:10 honestbleeps

I should clarify that yes, I threw a console.log in that function and it doesn't execute, I didn't just copy/paste it verbatim into my code :-)

honestbleeps avatar Oct 26 '16 19:10 honestbleeps

Thanks for the issue. I will think how to fix it, but you can use callback instead of promises. bot.postMessageToUser('user1', 'hi', function(data) {/* ... */});

mishk0 avatar Dec 21 '16 21:12 mishk0