It is possible to remove user message from Facebook Bot chat? - facebook

I need some feature to remove user input message from conversation with my facebook bot.
I need to make authorization routine with my server application, because it working with private user information.
Therefore I want to make prompt of user password and of course it must be removed from the chat or replaced with ******.
How to handle this kind of scenario via Facebook Bot Chat ?
If it impossible, can anyone suggest me a workaround to this problem ?
Many thanks

I tried to find a way to delete a message / conversation from Facebook bot chat via Facebook apis but was not able to find a way or a specific api to delete message / conversation.
However for this particular scenario Facebook has given a way to authenticate a user with our own system with. https://developers.facebook.com/docs/messenger-platform/account-linking
So you could use this to authenticate a user with your system with login process and unauthenticated with logout process.
Hope this helps for others who has similar thoughts.

Related

User to User Messaging with Facebook API

I am trying to write an application that allows the user to authenticate via Facebook and then allows the user to send messages to their contacts through my platform, but the documentation doesn't seem to indicate any way of doing so. I see where the documentation for Web allows a pop-up share dialog, but I want a pure UI if possible that, after authenticating with Facebook, doesn't use Facebook's UI anymore.
Ideally, I'd like to be able to send the messages from the server instead of through the JavaScript API.
Is this possible?
The Send Dialog is the only way to send messages from User to User. You cannot send messages with the API, each message has to be written and committed by the user.
Btw, you do not need authorization to use the Send Dialog, just the JavaScript SDK.

Linking/Merging Facebook User and PFUser (Parse) in Swift

I am currently working on an application that allows the user to register and login via regular email and password. It also allows the user to login via Facebook. Both of these functionalities are working.
The problem is that - when a user registers via email and later tries to log in via facebook ( assuming he/she has the same email for facebook) the application treats him/her as a new user. A new record is created in the database.
I'm new to swift and parse. I tried to take the information that comes from facebook and get the user's email and compare it to the users already in parse....but then, how do I merge the two accounts? If you have successfully implemented this functionality I really would appreciated if you walked me through it.
Thank you so much.
I don't think you can. Instead you would need to use cloud code to intercept the new user before it's saved and check if the e-mail address is already associated with another account. If it is you can return an error from the cloud code and handle it in your app.

Using facebook with my robot

I develop a robot which is connected to the user Facebook profile. If the user receives a message, the robot tells the user to check his inbox (or it can even read the message aloud).
For that, I want to create a website where my users can register, and where they can connect their accounts with Facebook profiles. The website communicates with Facebook to receive any new information. And the robot connects to the user page on the website to get that information.
My question - is it possible to make it that way? Does the API rules allow it?
EDIT: Especially, I want to know if API rules allow it.
You could make use of the Realtime Update API (https://developers.facebook.com/docs/graph-api/real-time-updates).
Therefore, you need to setup an endpoint (service) with handles the push notification from the Facebook platform.
Once you did that, you can "listen" to the inbox connection of the user object. FB will tell you if something changed, but not what exactly has changed. So you need to implement an active pull of /{user_id}/inbox and compare the actual result to a cached past result.
Be sure to gather the "read_mailbox" permission with your app.

facebook register/login

I'm trying to implement facebook connect to my website, and i have couple questions.
1: Is it possible to register user in my website using his current facebook email/password.
Let's say user clicks on link Register via facebook and then he have to give me permisions to access his password, email, etc... and after that is done i put that info in my own database and he will be able to login with that account any time he wants without needing to give me permisions any time in the future.
2: If that kind of registration is not possible, what's other solution would be the best for me? Because i need to somehow keep track of that user who logged in with facebook, because he can upload photos, send messages etc.
Anyways, i'm quite new with facebook and similar things, so i'm really lost here, hope some one can help me :)
EDIT Thank you all for wonderful answers it helped me a lot, now all that's left is to read documentation :)
Yes it is, it is possible to get the information of the user. But it is rather complicated, when you have never dealt with it.
First you need to send the user to the following link:
https://m.facebook.com/dialog/oauth?client_id=your-client-id&redirect_uri=xxx&scope=listof-information-you-want
Facebook will then return your client to the uri specified, if the user rejected it will give a reason. If it is not you will get an code in urlencoded format.
This code is needed for the following step, the request of the access token:
https://graph.facebook.com/oauth/access_token?redirect_uri=xxx&client_id=xxx&client_secret=xxx&code=xxxx
This will give back an access token, if the authorization didn't fail.
After that you can ask for the information you want:
https://graph.facebook.com/me?method=GET&metadata=true&format=json&access_token=access_token
This will include a facebook uid, which is unique for all users. Store it and you can discern between a register and login.
This is roughly the process for any oauth2 application.
Facebook will not ask repeatedly for permissions after the user granted them to you. So you can store the access token and reuse it for backend stuff and also use the same procedure you use for register for login.
You can never access the user's password from Facebook even with his/her permission, so the user will always have to authenticate via Facebook and have Facebook pass you the user id of the logged in user once authentication succeeds. You can store all kinds of other data locally, but not enough to authenticate the user yourself.
Once the user is authenticated, you'll have access to the user's Facebook user id via the API, which should be enough to connect all kinds of information to that specific user.
Facebook does not provide access to accounts when passwords are taken from your controls. It provides it own canvas for login information. Therefore you cannot use your first approach to store passwords in your databases. Check this out.
You can however store email addresses once user logins into his account using the facebook sdks. Check this out link for the example of C# SDK sample code.
You can use the Facebook APIs to fetch user email-id, photos, friendslist and other information and then play around accordingly.
You don't get access to the users password - only email if you ask for it.
Best way would be to have a table of users and their Facebook account id's.
If you want to allow users to sign up without Facebook then have a nullable field for their password and facebook id, and also have a field for username - which you could populate from Facebook if they register via that route.

facebook registration and authentication

i'm using the registration plugin for my website
http://developers.facebook.com/docs/plugins/registration
i want permission to post users's wall is there any way that on the same log in
( on the registration ) the user will promp to agree for the permissions (authentication)?
thanks !
From the Facebook Developer Forum:
There is no way at the moment to requests extended permissions through
the Registration Plugin so you'll need to request it afterwards.
It goes on to acknowledge that this is a missing feature that should be added at some point.
From what I can find, it looks like the legacy fb:prompt-permission tag would be a great way to ask the user to grant the permission. However, Facebook is in the process of deprecating FBML, so that's probably not a good idea.
The Facebook Authentication documentation explains how to gain the additional permissions using the latest OAuth model. I am still struggling to wrap my head around this myself.
Since you're using Facebook registration I'm assuming you have a database that collects user info. So what you need to do is not rely on Facebook to see which user has registered with your website but instead use the simple login with permissions on first time users and then after they are "connected" to your website check to see if they are in your database or not, if not send them to the Facebook registration plugin page and force them to register. :)