I'm new to facebook platform in general.
My goal is an Hello World bot for FB messenger (in test env), iv'e created:
An app + messenger product + webhook that works.
Test user with a test page + i can see in his apps list the app iv'e created.
When i got to the page --> Messenger Platform -> General Settings --> Subscribed Apps - i see nothing on the list.
How can i make my app subscribe? (preferable not programmatically, if possible).
If I'm not wrong you can't subscribe your test page from the messenger settings page, it won't show like you said.
What you can do is subscribe by sending a post request to the graph api.
steps on how to subscribe test page
I followed the steps in there and my test page subscribed and works fine with my app
I struggled with this all day. Hopefully this can help someone out.
Here are the steps I took to get the interaction from a test user -> test page -> chatbot to work:
Create a test user within your developers.facebook App Dashboard (Roles, Test Users)
Login with the test user and create a page (Test Users -> Edit -> Login with this test user)
Get a long-lived page access token that has the scopes:
pages_messaging
pages_show_list
pages_manage_metadata
pages_messaging_subscriptions (this is needed to register the webhook)
Use the page access token to programmatically register a webhook for the test page (don't think you can manually add from the dashboard):
POST to https://graph.facebook.com/v9.0/{testPageId}/subscribed_apps?subscribed_fields=messages,messaging_postbacks&access_token={longlivedPageAccessToken}
Unfortunately, even when I was able to subscribe the webhook + converse with my app through the test page, the app never showed my testpage in the webhooks section, so you'll have to repeatedly message the test page to see if webhooks are being sent.
note: using graphAPI 9.0 for all requests
In your facebook developer console go to setting and see webhook section and then
select a page to subscribe your webhook to the page events
Related
I am creating chatbot and want to connect on facebook.
I want to test my messenger chatbot in my page, but I must do app review and business verification first and I don't want to do that since I just developed my chatbot (or you can say this is staging environment).
I found that we can create test users, test pages, and test apps. I already create them all, but I cannot find a way to subscribe webhook from my test app to my test pages.
only real page appear in that select a page box.
How to subscribe my webhook to my test page? or is there any other way I can chat to my pages to test my chatbot without using business verification first?
Unfortunately, Facebook test apps / test pages / test users is buggy and seem to not work as expected. (I spent a few hours trying to figure that out)
They seem to focus on real user accounts.
We do not need to do business verification when Status of the app is: In Development
HINT: You can create a real user account in Facebook with any anonymous "false identity" name - so that your identity feels more anonymous and all the pages attached to it - whether published or not. (RISKS: But do not forget your password for this FB account, as you will not be able to recover this "second" FB account, as they might require your passport with that false identity "name" for recovery)
Then - you can create page by admin from real app in Facebook for Developers: Settings -> Advanced -> App Page -> Create Page
And then - just connect your bot to Webhooks in a standard way.
I struggled with this all day. Hopefully this can help someone out.
Here are the steps I took to get the interaction from a test user -> test page -> chatbot to work:
Create a test user within your developers.facebook App Dashboard (Roles, Test Users)
Login with the test user and create a page (Test Users -> Edit -> Login with this test user)
Get a long-lived page access token that has the scopes:
pages_messaging
pages_show_list
pages_manage_metadata
pages_messaging_subscriptions (this is needed to register the webhook)
Use the page access token to programmatically register a webhook for the test page (don't think you can manually add from the dashboard):
POST to https://graph.facebook.com/v9.0/{testPageId}/subscribed_apps?subscribed_fields=messages,messaging_postbacks&access_token={longlivedPageAccessToken}
note: using graphAPI 9.0 for all requests
I've been trying to setup a subscription to a page I own on Facebook using an App I've been using for many years (and this used to work for subscriptions to another Page).
Webhooks are setup, and a subscription has been created for 'conversations' to post back to a url on our server. When I test this through the webhooks page I can see the request come through on the server.
The only step that seemed to be missing was subscribing the page to the app itself.
However, I have now done this by issuing a POST request through the Graph Explorer directly to [page_id]/subscribed_apps. This returns true. When doing this however it requires a Page Access Token and gives me the Facebook authorization popup with a message saying:
"Submit for Login Review - Some of the permissions below have not been approved for use by Facebook."
I've worked out it means the 'manage_pages' permission.
If I click "OK" it goes through (presumably because the user I am authorizing as is a page admin?).
When I do a GET request to the same endpoint ([page_id]/subscribed_apps) I can see my App listed.
However, when a conversation on the page is updated (comment or new post) I don't receive a notification on the server.
Could this be because the permission isn't approved by Facebook, despite the fact that it shows as a subscribed App? I definitely didn't have to go through this before as the same App is live listening on notifications from another page without that permission granted, but I'm questioning whether something has since changed in the API.
Unfortunately this project goes live tomorrow so I don't have time to go through the Facebook review process...
Thanks for your help!
EDIT: I just attempted to subscribe to the description and/or mission fields on the page and edited these as the page owner and the notification came through instantly via the same webhooks subscription... which makes this even more confusing as it only seems to be failing for "conversations" eg: new posts/comments.
I have facebook messenger application (it is bot using MS Bot Framework, although I don't think it is relevant). It has webhook subscribed to page events. It used to work fine until few days ago, when the webhook was unsubscribed from page and when I am trying to subscribe again it tells me:
"Insufficient Permission You do not have the necessary permission for
the specified Page to perform the requested action."
I am owner and admin on both the FB page and messenger app. I created similar page and messenger app and it works there, but I still need to use this old one. I tried subscribing to other pages which I own and admin, but with same result. I also tried it with other person who is admin.
I found other people experiencing same/similar message on FB, but not in this particular case. But I haven't found any solution.
Does anyone know what could be the problem? Or have anyone experienced this issue?
Thanks in advance for any ideas.
You need to generate a token first. Under messager->Settings->Token Generation-> Select your page and you'll be prompted to give the permission. Grant all permission required, then you shall be able to subscribe or unsubscribe to pages you manage.
This process gives your application the token to validate if you have the moderator or higher rights to the page you want to subscribe to.
After spending 3 days on this. Here is the solution for this.
Go to your Facebook Profile - > Settings -> Apps
and Remove YOUR APP from there.
In Developer Dashboard Go to App Review -> Add Items
manage_pages
(This Permission Needed for Accessing page access tokens)
Add above permission for review - with any simple video of above error
Now go to Messanger-> Settings -> Token Generation
Select page from dropdown List
now it will open a popup (because you removed this app in 1st step) for app access permission , notice that now it will ask for manage pages permission
Grant those permission and create access tokens
Now try again subscribing Webhook to Pages
This Works for me.
You need to generate your page access token for this.
Go to your facebook Developer dashboard, and open the messenger tab. There, you will see this for token generation. Select your page and generate the token. Then use this token in your bot.
Page access token generation
I am trying to setup my first Facebook bot by following this sample project in Glitch, connected to this quick start help page.
I have logged in with a real user, then created an app and added a messenger product as per the instructions. I have set the webhook, I have also created a page with this user, and subscribed the messenger bot to it using the app dashboard.
I can access the page with the real user and I can send messages to the page and the bot responds to those messages as expected. So far so good.
Now I would like to create test users, so that I can access this page and send messages with other users. I have followed the procedure indicated here to create such test users.
The problem is that those test users can't access the page: "Sorry, this content isn't available right now"
I have found this and this answers, which both point to this explanation.
Basically, the page the bot subscribes to must be created by one of the test users with manage_pages and pages_messaging permissions. Like this I can create other test users which can connect to the test page and send messages just fine. However, the bot is not properly subscribed to this new test page, despite following the provided steps. I followed all of them and got the success response in the subscription step:
https://graph.facebook.com/v2.9/me/subscribed_apps?method=POST&access_token=<TEST_USER_PAGE_ACCESS_TOKEN>
Still, the bot is not connected to the test page. I can send messages back and forth between test users on the test page, but the bot does not respond and I get no activity logs in the webhook.
In a nutshell:
If I create a page with a real user, I can subscribe the bot successfully to the page, but I can't access the page with test users.
If I create a page with a test user, I can access the page with other test users successfully, but I can't subscribe the bot to the page.
How can I solve this or at least troubleshoot it?
Facebook API v2.9
The test user cannot access your real facebook page but you can message your bot (logged in as a test user) via the messenger short link (m.me/your_bot_link).
I used that in the testing steps (and video screencast) for the app permissions review submission.
I have a certain scenario that might be obscure but in any event here it is:
1) My overall objective is to stream Facebook updates for my company's Facebook page to Hadoop
2) I know how to do this for my FB page:
a) Requires a FB app
b) A FB Realtime subscription
c) A callback URL to a page that receives the GET/POST
d) A Flume HttpSource to receive the Http Post from FB
All of this has been done successfully for my personal FB page. The challenge is that I would like my company's page to add the App so that I can stream updates from their page to my company's Hadoop environment. My marketing department would like to capture interactions with the page followers for sentiment analysis. Finally I would like to do so with my FB app in sandbox mode.
Is it possible to have a FB app in sandbox mode and still have it visible to my company's FB page so that the page admin can go in and add the app that I created and is still in sandbox mode?
I tried adding the company as a test user and not surprisingly that attempt failed. Is there a proxy user for my company's page that I can setup as a test user?