Can i send direct messages to my clients facebook followers using API? - facebook

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.

Related

Is there a way to use POST/GET Requests for messages, on your Personal Profile on Facebook Messenger

I've looked through the API and it's all for Facebook Pages to set up a Chatbot.
I wanna be able to set up a Webhook/Listener for chats/messages on my personal profile (to mess around a little).
I'm asking cos I can see unofficial Messenger apps on the Play Store, and they don't look like just a web implementation.
No, there is no way to do that using the official APIs.
Read access to user conversations has been removed a long while ago already, and there is no webhook functionality for this either.

Facebook Oauth-enticated users, chat between themselves on website

I have a website where users log in with Facebook. Right now there's no way for users to contact each other.
I was thinking of building a dedicated live messenger with sockets, but I wonder if there's an easier way to allow them to send messages to each other's Facebook Messanger, since they are already logged in with facebook.
There is no API for a chat between two users. Everything in Messenger API is focused on communication between a user and a page.
At most you can use the Send dialog to let a user send a link to their friends, but that requires the user actively using the button, you can not “automate” that; and handling the result will have nothing to do with your site any more, everything after that will happen in messenger only. https://developers.facebook.com/docs/sharing/reference/send-dialog

Can I give my facebook messenger chat bot the exclusivity of answering users?

I connected a Facebook messenger bot to a page with several admins. I am not yet very familiar with the facebook messenger platform but it looks like when a user messages our page. Admins see the incoming message and can respond to it. Can I deactivate this ? I want my bot and only my bot to handle incoming message, I don't want admins of the page to be able to interfere in the user experience. I was thinking it should be easy to do but I cannot find how to do that. To recap : I would like my chat bot to have the exclusivity of chatting with users from my facebook page, do you know how to do this ?
Thank you very much
Admins see the incoming message and can respond to it. Can I deactivate this ?
No, you can not.
Bots are meant to be able to help with page tasks regarding answering user messages, but not to take over control completely.
Well, according to this Facebook help article, the roles available to your page admins are listed there. Use it as your guide.
After searching, I was unable to find anyway to make the conversation between a Facebook messenger bot and a Facebook user private (in the sense that no page admin, editor or moderator would be able to see the conversation from the page inbox). If you want your bot to have a private conversation with your users for certain sensitive actions, your only option as of now seems to be using a webview.
Using a Webview can complicate a little bit your workflow because Webviews are not supported the same way on all platforms but at least, it will enable you to gather direct inputs from your users that your Facebook page moderators will not be able to see from the admin page.

How to test FB messenger bot with multiple users

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

Hiding application source when posting to Facebook fan page via graph API

I've successfully posted to a fan page as the actual page via the Graph API.
The problem is that the post says it was posted at "time via application name". Is there any way to hide this, so my post looks exactly as if I typed it directly into Facebook?
I'm building a messaging center that can easily deliver messages on many different channels, Facebook being one of them. Clients probably won't appreciate their Facebook posts linking to my application, nor do I want to set up a new Facebook application for each client.
There is no way to disable this. It is an internal Facebook system and is very deliberate on their part to show users where content comes from and make it easier to report malicious and spammy apps.