I have multiple chatbots, each with their own webhook endpoint. (Really its multiple instances of the same chatbot)
I have multiple Facebook Pages that match each chatbot (instance).
I would like to have a single FB App, that goes through the Review Process and Business Verification, and then route my Facebook Pages messages, through that app and route them to the single appropriate webhook for that page.
Is this possible?
If not, then what if I built a single webhook that did the routing based on the Page ID?
The goal is to not have to create multiple apps, and go through the entire process for each one, every time a new client requires a new instance of the same chatbot.
Related
I'm trying to get leads from facebook pages using a facebook app and a webhook. I'm using Zapier right now(which is working) but I'm trying to create a custom solution to replace Zapier. My webhook is working for one page, but I have about 10 facebook pages and each page has their own, separate lead forms. I've used the Lead Ads Testing Tool to check to see if my facebook app is listed and their is only one page that lists my facebook app - the one that is working. I can't figure out how to add my facebook application to the other pages. What I've tried: I went into Business manager and made sure that my facebook user account is listed under each page and verified that I'm an admin on all those pages. I also tried to add or assign a CRM to the pages under Integrations->Lead Access in Business Manager but my facebook application named TestApp is not accessible via the search(see 2nd image), in fact, no CRMs are searchable except for Zapier. Questions: How can I subscribe each page to my facebook app so leads from all my pages will be sent to my webhook? Or do I need to create a facebook app and webhook for each page?
I am developing a product for a business, which has n clients, each one with its own website.
Now, what the product does is injecting our Facebook App into the Client's Website, to allow the Client's customers to login and share things on Facebook, with our app.
Facebook prevents this because the site url is different from the one specified in the dashboard.
So, how can we structure the product to allow this kind of usage?
The Facebook messenger bot API seems to require you create a Facebook app for each bot, for each page. The Facebook app stores the webhook, and connects to the page.
Is there a way to have a single Facebook app for many bots connected to many pages?
If you create a bot to resell to clients as a service, you need to be able to do this. But there does not seem to be any way. You need to create a Facebook app for each client, and go through the Facebook app review process for each page which is very difficult.
How can this be avoided?
Can a single Facebook app have multiple webhooks, or access to multiple pages messages?
You can create one chatbot and can use this bot in multiple Facebook pages. All you need is to store PAGE_ACCESS_TOKEN for each page and response messages to the user with right PAGE_ACCESS_TOKEN. You should get the necessary permissions to get page access tokens by Facebook Login. And then you need to subscribe the page to your chatbot(app): https://developers.facebook.com/docs/graph-api/reference/page/subscribed_apps
One important thing is Facebook generates a unique identifier for users for each page. Some user#A will have a different SENDER_ID/RECIPIENT_ID on different pages.
Has anybody yet a way to interact with an FB messenger bot without using real FB accounts? I want to do automated testing and obviously not use real accounts for that.
I was not able to figure out how to allow access to a page to 'test users' or create a test page and subscribe the test app to it.
Any ideas on how to do this?
I use a wee web app I made to act as a local version of the facebook messenger api server and run user actions.
https://github.com/Fraser-Greenlee/bot_tester
On it you can write a script to define new users and their actions.
From the Facebook developers dashboard, select your app and then Roles. From Roles you can add other Facebook users as test users. It was easiest for me to use the users facebook id. Adding by email did not always work for me.
I am not aware of how to access a Facebook bot without a Facebook account. I created several fake accounts and had my friends test the bot. After testing, I deleted the fake accounts.
For more information on setting up a bot see my article Facebook Bots for Fun and Profit
The example bot is DMS Software Bot
The source code is Github fb-robot
Testing fb bot with non-fb user is currently not supported. Following are the reasons:
fb messenger requires the user to be logged
fb creates page scope ids (PSID) for each user who is interacting with the bot and hence login on fb is required
Coming to your question on testing:
you can add fb users as tester to your page and your app. Explained here. For your app https://developers.facebook.com/apps/[app-id]/roles/
Once added they will be able to send message to your bot (page) from messenger
On another note, if you are using 3rd party apps to build your bot (eg: api.ai, wit.ai) they already have emulators within the app which makes testing easier.
One easy way to achieve automated testing for messenger bots atleast is to try to mimic a request coming from FB. You can just log the request you are getting to your bot to find the signature of the request that FB sends. Then you can just pretend to be FB by sending http requests with the same signature. You will also have to add in code to respond to these http requests with your reply instead of just sending the message to FB's send API.
So in node it would be something like
sendMessage(<your reply>);
res.send(<your reply>);
Now you have an automated way of sending and receiving messages which you can use for automated testing.
However I think the bigger challenge is coming up with enough test cases. You need to use a combination of clustering over available data and classification to generate new cases.
I have been working on a tool to make this easy. So if you are interested you can sign up for early access. http://ozz.ai
I have a Facebook app and i want people to use the page tab feature of it which will be an iframe app specific to each page. I also need to subscribe for realtime updates from facebook for the feeds on that page. Facebook documentation has stated the both calls to be the same
/<page_id>/tabs
with the app_id to be provided. In the current case a person who does not want the page tab to be installed will be sending a delete request which will also kill the realtime updates and vice versa. Is it possible to handle both the cases with the same application. Is there an extra parameter to differentiate the requests?