jgorset / facebook-messenger

Definitely the best way to make Bots on Facebook Messenger with Ruby
MIT License
962 stars 211 forks source link

I want to limit the requests to my bot #247

Closed ahmadabdelhalim closed 5 years ago

ahmadabdelhalim commented 5 years ago

Basically, I want my page's messenger to act both as a bot and normal human interaction. What I'm trying to achieve is to get a specific message from a user and send him "messages" regularly, but the user can also send other messages and talk with another person normally and in that case; I don't want to receive the requests from messenger because it's gonna affect the performance of my server. What's the best way to achieve that using this gem?

ryanwaits commented 5 years ago

You might want to look at Facebook's Handover Protocol: https://developers.facebook.com/docs/messenger-platform/handover-protocol/

This feature allows you to pass control of the thread to another page (a page that can be managed by a person who you can chat with, for instance).

However, that doesn't exactly solve the issue of requests coming through Messenger - the Handover Protocol would just simply direct your messages to another Facebook page.

Are you trying to circumvent Messenger altogether at that point? If so, I'm not sure a Facebook Messenger gem could solve that issue.

ahmadabdelhalim commented 5 years ago

Basically what I want to do is that I want to get a specific message from a user to get his sender id so I can send him messages, but I don't want to interact with him like most chatbots, I just want to send him messages after I get a specific message from him. Like when you subscribe to a news's bot, where you get your news every day. So basically what I'm asking is; can I stop facebook from sending me requests from a user after I get what I want from him? or that's not really possible?

ryanwaits commented 5 years ago

If you take a look at some of the properties of the Persistent Menu - you can try to disable the composer input field.

https://developers.facebook.com/docs/messenger-platform/reference/messenger-profile-api/persistent-menu/

Following that link, you could try setting the composer_input_disabled to true, which would prevent users from sending any additional requests.

If you don't provide any persistent menus or quick replies - he would in theory just be locked.

However I believe this to be an app wide solution - and not a per user option.

jgorset commented 5 years ago

I think you solved this one, @ryanwaits, so I'll close it!