Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot.deliver error handling #96

Closed
pjpires opened this issue Nov 23, 2016 · 3 comments
Closed

Bot.deliver error handling #96

pjpires opened this issue Nov 23, 2016 · 3 comments

Comments

@pjpires
Copy link
Contributor

pjpires commented Nov 23, 2016

As the API is growing at Facebook, it appears some new error codes are being returned.

We've been working with the API for the last weeks, and I'm almost sure that when someone deleted a conversation with a bot, Facebook would return 100 error in response to the Bot.deliver action, a Facebook::Messenger::Bot::RecipientNotFound.

Now, apparently it is returning a new error code, 200, per the API:
"This person isn't receiving messages from you right now."

I'm relying on these errors to keep track of the real bot users (I destroy those who don't receive messages), so it would be cool either to upgrade the gem with the recently added error responses (https://developers.facebook.com/docs/messenger-platform/send-api-reference#response) or wrap the errors in the exceptions in a way that the code was still available for us to check, e.g., see: https://github.com/ryanb/cancan/blob/master/lib/cancan/exceptions.rb#L35.

Any thoughts on this?
Thanks in advance.

@pjpires pjpires changed the title Error handling Bot.send error handling Nov 23, 2016
@pjpires pjpires changed the title Bot.send error handling Bot.deliver error handling Nov 23, 2016
@jgorset
Copy link
Owner

jgorset commented Nov 24, 2016

I think that'd be awesome, @pjpires! I'd be very happy to merge a pull request with new and improved error handling (and I like the approach where each error has its own exception that you can rescue from).

@pjpires
Copy link
Contributor Author

pjpires commented Dec 11, 2016

@jgorset took me a while to have time for it, but what do you think about this?
#99

@jgorset
Copy link
Owner

jgorset commented Jan 22, 2017

Love it, @pjpires – merged. 😉

@jgorset jgorset closed this as completed Jan 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants