How to request page messaging permissions on facebook apps? - facebook

When using facebook apps like chatfuel and manychat (which are bot creation platforms), these apps request permissions that allow them to manage my pages and send messages.
I want to create a similar app that allows users to send messages from their pages through my app, but I can't find how to request such permissions in Facebook's documentation.

You need to be given the administrator role for each Page, then connect your app to the Page and generate a page-scoped token for each one.

Related

How can I use Facebook Messenger Platform's webhook to subscribe to the Page messages of other users?

I am creating an application using which users will manage their Facebook messenger and post comments on a page. I have implemented the Facebook Login which asks the user for page_messaging permission. I have also configured the webhook and it is working fine.
Now, Facebook documentation states the following
Generate a Page access token to start using the platform APIs. You
will be able to generate an access token for a Page if:
You are one of the Page admins, and
The app has been granted the Page's permission to manage and access Page conversations in Messenger.
So, how can I make my webhook listen to the messages of the page that have granted me permission to manage and access the page? I have looked for hours trying to find this in the documentation. No Luck!

How to make a messenger chat bot without a facebook app and webhook?

I went through the documentation for creating a chatbot for messenger platform.
All I find there, I need a server, which in the case used as a service for the Facebook platform.
The server also validates the webhook from facebook app.
Now I see, for a chatbot, I need a facebook app, webhook server and definitely a facebook page.
Then I find an application Flow XO, where I only put the page name and the bot is ready.
My question is, how they(flow.xo) can communicate facebook page without a Facebook app(appId, appSecret) and webHook.
My question is, how they can communicate facebook page without a Facebook app(appId, appSecret) and webHook.
They can’t.
They use their server and their app to communicate with the API, on behalf of the users that grant them access to their pages, by providing the necessary permissions when they log in to that app.
Facebook allows to create a Facebook App which integrates multiple chatbots. At Amio, we ask you for permission using Facebook OAuth. When you give us these permissions we send and receive message on your behalf. This allows you to create a chatbot using Amio API without need of creating a Facebook App.
Facebook Page is always needed as this is the entry point of users interacting with your bot. You can check Amio documentation for more detail.

Link facebook messenger with facebook login on app

I have a facebook messenger bot that sends a webhook to my web app. People can login to my app via facebook login.
The first user contact is normally with my facebook bot on which they can create a profile. When they make contact I take their facebook id, name, profile pic, etc.
Users can then login with facebook to my web app to enhance their profile.
My problem is facebook uses different scoped ids for messenger and their login.
How can I recognise if a user has already been on my facebook bot if they use my web app, and vice verca.
I think it has something to do with the business mapping api: https://developers.facebook.com/docs/apps/for-business but I'm struggling to understand how it works.
I am sending a get request using:
GET /me?fields=token_for_business
But the docs do not specify the full url to use. I'm also unsure if you can use this in developer mode.
facebook provides an id-matching api
for the app and pages owned by the same business manager. More informations:
https://developers.facebook.com/docs/messenger-platform/identity/id-matching

How do I create multiple Facebook bots with a single platform?

I have a Facebook bot and I have connected it with a Facebook page. However to have it publicly available I have to wait the approval from Facebook.
Not a problem if you have to make one single bot, huge problem if you have to do it on scale level (eg: 100+ bots).
Platform as Chatfuel or Content Api allow you to just select the page you own and connect the bot automatically.
In minutes the bot is publicly available, skipping the review phase (apparently) in Facebook.
I didn’t find any info about that on the Facebook developer guide, there is a sort of internal API not available for everyone? If so how can you request access to that?
Facebook Messenger bots are published for a page (which is the bot identity) using one or more applications (which defines the webhook where messages are sent).
So the application must be reviewed and approved by Facebook. After that, any page can be 'attached' to this application, using the standard Facebook authorization flow in order to get an access token for this page by the approved application.
So Chatfuel and others alreay have their application approved, and now any page can be connected to it.

Facebook connect and account remove

I have a website where users can log in with the Facebook oAuth API.
Once the user logs in or registers via Facebook it is stored in my database.
But what I'd like to achieve is, once the user goes to his Facebook application settings page and removes my website app permissions, the used should also be deleted from my database.
Is there any work around to this problem, if this is not possible via the Facebook oAuth API?
You can add Deauthorise Callback URL by Navigating to Settings > Advanced section of your application. Whenever a User Deauthorises your Facebook app, Facebook performs a HTTP POST of signed request to your URL. You may use the field user_id to determine which User has deauthorised your app.
Actually, I would do the following:
Add a date to his last log in to your site.
Have cron job check for old, unused accounts.
Send an email to the user's email address (or Facebook message mail) telling him his account is due to expire soon.
Delete account from database.