We built a Facebook application for live agents to respond to Facebook Messenger messages to our clients' Pages. When a Facebook user communicates directly to a Page, it works great. However, one of our clients is using Facebook Business Marketplace, and messages from a Marketplace item were being received into our app until recently, when they stopped. It looks like, all of a sudden, these messages are now being created as a group conversation, rather than between the user and the Page. The group conversation has the user and the Page as the two members.
I followed the Messenger Platform Getting Started guide, but nowhere does it mention group conversations. I see no mention of group conversations in the Messenger Platform docs either. I have found some very basic documentation about conversations in the Pages docs, but I cannot figure out how to manually create a group conversation that includes a Page for development and testing purposes.
Currently our application has the following permissions:
manage_pages
pages_messaging
pages_messaging_subscriptions
pages_show_list
And our application has webhooks for the following events:
messages
message_deliveries
conversations
Questions:
Is there documentation describing how to integrate group conversations? What additional permissions are necessary? What additional webhooks should I be listening to?
How can I create a group conversation that includes a Page as a member of the group to replicate this scenario?
Is there a logical reason why the Messenger Platform documentation and API does not cover group conversations?
To integrate your pages chatbot into group conversations, you need to create a chat extension.
Chat extensions are at their root just an 'extension' of typical messenger bots.
https://developers.facebook.com/docs/messenger-platform/guides/chat-extensions/
https://developers.facebook.com/docs/messenger-platform/guides/chat-extensions/#faq
Related
I have seen services advertising that they can message the followers of pages and accounts on Facebook. I have gone over lots of different Facebook API's and several interesting threads on here but cant find a definitive answer.
Is is possible to directly message via a bot users who like a page providing obviously we have a valid admin token for that page?
Is is possible to directly message via a bot users who like a page
No, that is not possible.
All communication via the Messenger platform API (basis for “bots” in Facebook terminology) requires that the user initiates it.
And it would probably be considered spam by most people - just because I liked your page, does not mean I want to be contacted by you in any way beyond that. Posting to your page is the designated way of communicating with the people that follow your page.
I set up a Facebook Webhook to notify my app of changes to my business page. Then I did the same with the Messenger platform. Then when I started posting as a user of my page, and sending messages, I found out that the user IDs are different across different pages and apps.
So, facebook provides two endpoints: ids_for_apps, and ids_for_pages. There are quite a few "but"s to use these endpoints, but at least in development mode, and for IDs sent by the Messenger webhook, it works. I get the notification and I'm able too look up the IDs and match to an app id (because maybe the user commented on a photo before contacting me via Messenger)
Now if I try to do the same with a sender_id that I got from the Facebook Webhooks, "feed" subscription, I get the "singular links API is deprecated for versions v2.4 and higher"
The url I try to access, even with Graph API Explorer tool is GET /2.9/{sender_id}/ids_for_apps
What's going on here?
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.
I have developed FB messenger bot using Microsoft bot framework. The bot is ready and approved by FB.
Now I am working on the hybrid part so human(web panel user) can take over chat and do conversation.
Now Issue is, I don't now which permissions need to read and show bot conversation in my web panel.
Also, it will be great if you can suggest that should I need to save conversation in DB to show in web panel or Is it possible that I can make a direct get request to FB API and show.
Thanks.
For FB Permission: pages_messaging
Development:
Show message: From our database.
Reply message: Using botframework
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