Messenger - Chatbot without creating FB App for each Page - chatbot

I built a chatbot that I plan to use with my pages. It's nothing special, only for development purposes. I used fastapi + mongodb + RASA NLU. It's all working fine with the integration by creating the app and subscribe to the webhook. the only problem I have is that I need to create one app per page. How can I link my chatbot to my page without creating an app all the time? I noticed ManyChat and ChatFuel can do this but I'm lost the fb developer documentation.
for reference, here's my current webhook setup.
https://myapp.com/webhook/<pageid_01>/
https://myapp.com/webhook/<pageid_02>/
https://myapp.com/webhook/<pageid_03>/
it's a workaround, of course. it works but I don't really want to maintain too many fb apps. not that I have many but between me and my friends who want to use my chatbot, it's not a pretty sight.

You can use the same webhook to handle events from multiple pages, but i don't think there is a way to make one fb messenger app for multiple pages! because the app will be receiving page-scoped unique Ids

You can just connect multiple pages to same app. And when you receive the event on your webhook, you can check the page-id and based on page-id, perform that page specific actions.

Related

App review is required to get Facebook Webhook working. How to develop?

I'm developing an app which must interact with Facebook API Graph and also use webhooks to get live updates. Now I'm facing a problem I can't receive a live webhook updates until my app is reviewed and is not in development mode.
I've found a thread on a Fecebook for developers site describing the same problem and it got official answer - it is not possible. Use Test button in app dashboard to test your webhook implementation they said.
The problem is the Test button sends only one predefined data packet for each of possible subscription with predefined set of fields with fake values, but documentation defines much more fields and little to none information about which fields are sent in different situations (i.e. post added, comment deleted, comment edited).
I'm wondering how other devs solving this? May be there are some community driven reference for a different webhook interaction cases or else.
For now I can't find any information on detailed webhook format except official documentation on available fields (but not supported payload shapes).
Our current workflow looks this way:
create test app
implement webhook handler using only documentation
prepare test payload and check it is working
create a screencast of the app functionality using test payloads
go through the review process
when app is approved
make it live and check your implementation against real webhook payloads
You need to create a test app for your existing Facebook app
Once you do this, just accept the permissions for your app and set the webhooks on your own Facebook account.
Since you are an admin of the test app, you will be able to set webhooks on yourself without having to get your app approved.

Facebook programmatically application creation

I'm facing the situation where I need to programmatically create multiple Facebook Messenger Apps to different chatbots. Pretty much something like ManyChat and ChatFuel. Can someone shed some light on how is it possible?
There's a thread on it from 2011 but I've been uncessful on finding documentation on these old Facebook API's.
Create a facebook application programmatically
Thanks!
There is no API for this. As ceejayoz mentioned, ManyChat and ChatFuel just run one app and use their customer's account with the rights manage_pages and subscribed_apps to subscribe the app to the customer's page.
That said, there is just one endpoint where all traffic is delivered to and the software has to route every message to this endpoint accordingly to the right page (using receiver_id in the payload).
Keep in mind that while you want to run several apps in parallel, you have to approve all of them. Without this approval, the app can not be reached from customers.
For more insight, see the FB docs:
https://developers.facebook.com/docs/facebook-login/access-tokens/?locale=en_US
And https://developers.facebook.com/docs/graph-api/reference/page/subscribed_apps

Facebook Developer- Messenger- add multiple webhooks for a single facebook page

I am trying to build a chatbot using Facebook developer platform. I want my bot to respond differently under different scenarios. So, basically I have my standard bot implementation on Heroku server. I want to bring in api.ai into my bot so as to leverage the kind of functionalities api.ai offers.
To bring in api.ai, I need to configure webhook in my Facebook app. As my Facebook app is already subscribed to Heroku, I don't see an option to add another webhook. Is there a way to subscribe my app on Facebook to multiple webhooks?
If not, is there any way to integrate api.ai using api calls from my heroku server?
Thanks in advance!
It's likely you'd probably just forward them along to the next endpoint. Have your server be the frontend, and forward requests from your server to the next webhook if needed.

how to make my Facebook chatbot available for download

I want to make my bot available for download for testing purpose without
going through the actual review process of Facebook? This is just for testing purpose as I want to test how exactly end user will
download my bot from FB messenger platform and then will start using my bot. Is there a way/platform to try this? Can I do that?
(currently i am testing am sending message to my bot using FB page's messenger link as indicated in almost all the blogs/sites including FB's official
site.)
Can you please provide any pointers/links on this?
I see two options for you:
You want users to test your bot on Messenger:
Simply add them as testers in your bot corresponding Facebook page then ask them to look for your bot in their Messenger app.
Or you want to test your bot behaviors:
Enter botgen the chatbot generator I'm currently working on, which could help you test more publicly the bot you're working on. (assuming your bot doesn't need coding and is all about pattern conversation).
Just use the designer interface to design, run and test your chatbot.
Publish it and share it with your actual test users.

Facebook-approved way to increase conversion from app requests?

I have a question about increasing visibility of Facebook app notifications.
As far as I can tell, there are only 2 places where Facebook app requests appear for users who don't click the "Apps & Games" section - in the top right section (https://skitch.com/nicksoman/8172w/facebook) or in the jewel (https://skitch.com/nicksoman/81737/2-facebook) - I believe the wording is a bit different on this one if recipients haven't used the app, as it references an invite rather than a request.
As other have noted, neither of these channels provides any context around the request. In the past I've seen context for apps like BranchOut and FarmVille, but I can't replicate this behavior by sending invites from these apps now (can anyone)?
Has anyone found a Facebook-approved way to either provide more context around these app requests or make them more visible?
I'm familiar with the history of Facebook tweaking channels due to abusive apps - just want to make sure I'm current on best practices today.
Are you referring to users who haven't authorized your app or users who did?
Basically, facebook calls this Social Channels and you have a few options, again, depending on if the user is already using your app or not.
If the user is using your app, you have the bookmarks bar which can be used by issuing a App-generated requests.
If the user isn't using your app then a friend of his that is using your app can send him a User-generated request.
You can and should encourage your users to publish your app stories to their friends' feed and/or to send them to friends.
There's that "Automatic Channels" which is discussed in the first link in this answer.
More options are to use the Social Plugins in your website, and to have a mobile version of your app.