How to test facebook chatbot with test user and test page - facebook

I have a chatbot that I want to test with test users on Facebook.
I have created a test app from the main app, per Facebook's recommendations. And in that I have created test users. Those account work and I can log into them.
To test a chatbot, you need to have a page that it's enabled on. So I have created a page in the test user account.
I can even see that chatbot app, correctly named, in the "Business Integrations" menu option.
I can also message the page from the test user account. However, those messages are never sent to the chatbot. There is zero traffic.
Using my real account, I can create a test page and link it to the very same test app for the chatbot and it works just fine. I can message that test page and the chatbot receives the message and processes it.
The difference is that on the app page, the "real world" test page shows up because I own it, so I can add it to the chatbot app. However as the test user is a separate user, the test user page doesn't show up in the options to add a page, only the pages that I own.
There is a menu option to log in as another user, but doing that as the test user gives the error that a test user cannot access the developer.facebook.com service. So no luck there.
So in short, it LOOKs like the test page is linked to the test chatbot app because it appears in "business integrations", but no traffic is routing.
Things changed in 2018 at Facebook. The old way of using Graph API to link your test page to your chatbot app no longer works. Facebook's own documentation is massively out of date and their recommendations not only don't work, the permissions tags no longer exist.
Has anyone solved this puzzle?

You have to use the test user to create a test page and then issue commands directly through the graph API (using curl, for example) to allow the page to use the app. The details for doing that are available on a FB bug report linked in this answer Can you use Facebook "Test Users" to test a Messenger Bot?
The test user cannot see your own pages nor see you but you can see the test page created by the test user and interact with it. Sadly, because the test user cannot see you, the bot cannot get the information about the user interacting with the page either (which might cause exceptions in your bot code). The best way is to interact using a separate test user.

Related

Add REAL test users to Facebook Messenger

I made a test FB page and connected chatbot to it and everything works fine (for me).
It is a simple chatbot that just repeats what you said (work in progress).
Now I'd like to share it with my friends but I can't because app is not published.
Tried to publish it explicitly saying in my app submission that this is only for testing purposes but FB turned it down.
This is just for couple of my friends and this app will change over time as I add better features / bot becomes smarter.
So my question is: is there a way to add real test users like you have on TestFlight for iOS?
Testing should by done before publishing application so that's the most probable reason you gout turned down. To test bot you have to add your friends to bot application (not page) as testers, developers or admins.
To add testers visit Roles section on your bot application and click "Add Testers". On following popup enter their Facebook usernames (found on end of their profile URL). For example if your friend is Mark Zuckerberg with following profile link:
https://www.facebook.com/zuck
you would add him by typing "zuck" in popup. You could also add testers by entering Facebook ID instead of username.
People do not have to be your Facebook friends for you to add them as testers but they will have to accept request and connect to developers hub.
Go the Roles section of your facebook app. You can add testers there, you must be facebook friends I believe.

Facebook Test User unable to access my web page

I am trying to test the Facebook login feature for a website staging environment, but when logging in with a test user I see this error message:
Error
User is not allowed to see the application.: The user is not allowed to see this application per the developer set configuration.
I have set App Domain to http://www.mysite-stage.com/. I've also added a Website platform for my app and set the site URL to http://www.mysite-stage.com/.
The website http://www.mysite-stage.com is actually accessible to everybody on the web, so there should be no issues there.
This method of testing Facebook integration for the site was working up to about 1-2 months ago, so I'm a little confused as to why it's not working anymore.
Are you sure you created the test user for that application?
Facebook won't let you login as a test user that was created under a different app than the one you are trying to sign in with.
Facebook test users are app-specific.
Yo can also create test users through the facebook developers site:
http://developers.facebook.com/apps/
- Select your app
- Roles
- Test Users
Since I can't add a comment yet, the problem is with you having made your app available to the public but you are trying to sign in with a test account.
Have you tried using the
installed=true
parameter once you use
POST /{app-id}/accounts/test-users
to create the Test Users? See https://developers.facebook.com/docs/graph-api/reference/app/accounts/test-users#publish

How to Update Users Activity Through Facebook App

When I start using an app on Facebook, the app shows "10K people using this app", but before to do that I need to "subscribe" to that app (click a button telling me that I'm going to be using that app) How do I do that with my own app, so I can keep track of the amount of users using it?
Besides, when someone starts using my app (an online magazine) I want to update their activity with something like "John Doe is Reading < Name of the App >"
What elements of the Facebook API do I need to achieve such behaviors?
The "number of people using this app" statistic is added by Facebook automatically to the app authentication dialog. If you want to show it in your app (manually), you can make a call to /{your_app_id} and use the weekly_active_users or monthly_active_users count.
As for the activity, Facebook automatically posts "User is using App". You won't be able to do "User is reading app" as the page needs to be a object-type that accepts 'read'. 'Read' would only work if you are reading a blog, article, etc.
If you are interested in pursuing it anyway, you need the publish_actions permission and you need to register the read action in the App Settings. The facebook documentation has everything you need to get started.

Test users and unpublished Page

Just a quick question - I seem unable to access my unpublished Page using a test user that I've created for an app I'm developing. This app is tied to the unpublished Page as a tab, and every time I try to navigate to the Page with a test user I'm redirected back to the test user's wall.
As a test I published the Page and this time I was able to get to the app using the test user.
Surely we can test our Page and Apps together using test user accounts, whilst keeping the Page and Apps in a sandboxed state?
Cheers
Lee

how to test facebook app for different scenarios

how to test a facebook app for different use cases. i will take a simple example here:
assuming i have a facebook app which just does the login to a site.
now, how do i handle/ test different use cases in this:
1) user is already connected to the site and logging in again using her facebook account
2) user is a first time user and want to login to my site through his facebook credential and she a) allows the app to access her details b) deny the app to access her details
these are the very basic test cases but there could be more depending upon what exactly what we want to do with that app and the site.
so my question is how does one test all these scenarios ? if i use my facebook account once then it doesn't allow me to test the other scenario (like if i once allow an app then it doesn't allow me to test the 'deny' scenario)
thanks in advance
dev
You can use test users for manual or automated testing.