User to User Messaging with Facebook API - facebook

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.

Related

How can I allow users with their own slack account/company login to their slack account in my app

Everything I have read (e.g. https://api.slack.com/docs/oauth) makes it seem as though I can only build an app that integrates with a Slack team I manage. E.g. I have to create my Slack Client ID .. etc ... and then I can oAuth users for my team.
What I want to do is allow my app's users to login to my app using their Slack login (for their Slack team I do not control or have access to.) I don't want to force my users to generate a Client ID to use my app. I want them to login the same way Google Login or Facebook Login works.
The closest thing I have found is a "login with slack" HTML button, but I'd like to do it in iOS using Swift.
Is that possible?
Sadly, that's not possible. For google or facebook, the way authentication works is that they provide you a mobile API which handles the communication between your app and their web service. So you task is simply adopt that API, make simple function call and retrieve information for user from the API. For example, the facebook button is provided by the API.
However from a look at slack site, they only have RESTful API documented. So in this case, you have to handle the passing and storing of parameters by yourself, and send HTTP request manually. You can have a look at Alamofire framework, which is the best choice for making HTTP request. Basically, you have to send needed parameter with the specific url though HTTP request to perform a log in action, and you have to parse the respond data and then see if the login is successful or not, etc
Thanks to some help from friends it looks like the answer is yes.
You must first make sure you "Distribute App"
Then set up the permissions you require and "install app" (which is a bit not "smart" since you can accidentally add conflicting permissions and get an error when trying to install).
Once that is done you will get an Auth Token and can make requests for any user to login using oAuth.
You can also trigger a sign in request like so:
https://slack.com/oauth/authorize?client_id=[client id]&scope=identity.basic
Edit: For future Googlers, Slack now also provides a specific documentation page for this type of OAuth grant/login: Sign in with Slack

Sending notifications via Messenger Bot to Facebook OAuth registered users

Let's say you have a site that accepts Facebook OAuth registrations/login. Today, the typical pattern is to capture the user's email and send them notifications via that channel. Fine.
Messenger bots have now opened up an opportunity to engage with users directly via Messenger rather than relying on email. In markets where Messenger is heavily used and email hardly ever, notifications via Messenger are a big deal.
Reading the documentation my understanding is that Facebook user id's are application scoped. I wouldn't be able to send a user registered via Facebook's OAuth a message on Messenger.
Has anyone done this? Is it possible or at least being considered in a future spec?
Use checkbox plugin for messenger in web app flow, this is meant for the same purpose!

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

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.

How do you post a link to user's inbox in Facebook?

I am a iPhone application developer. I don't know how to send an "link" to a selected user's inbox in Facebook from my Facebook account.
You can't send messages using a Facebook API from the backend, but you can do through JS SDK or redirecting user to facebook url as per this link
FYI: Send Message
I don't exactly know if I understood your question, but: If you want to provide a link that a user follows in order to go to her/his Facebook inbox, you can use the URL scheme fb://mailbox (provided that she/he has the Facebook app installed)
As #Venu wrote, the api does not allow apps to send messages on the behalf of the user, only with the Send Dialog which you should be able to open using the iOS sdk Dialog.
Another approach you can use is the Chat API with which you can send messages on the behalf of the user, it requires the xmpp_login permission and you to implement an xmpp client.

Twitter REST change "from API" to something meaningful

When using simple request to post to Twitter the messages are signed with "sent from API". Is there a way to change that to the actual name of your application? Is it another post parameter or something else?
This is covered in the Twitter API FAQ
If you would like tweets from your application to recieve a source parameter, please register an application and implement OAuth authentication. We will automatically include your application as the source for any tweets sent from your application.
If you are writing a desktop Twitter client and you want your application's name to show up instead of "From API", you have to use OAUth.
If you want to use OAuth in your desktop Twitter application, you have to go through Twitter's PIN workflow (i.e., sending the user to the Twitter website to authenticate).
The confirmation step is part of the reason Twitter is using OAuth. There's no getting around it.
There are several libraries out there that implement OAuth for Twitter so you're not reinventing the wheel.
If you want example on how to use OAuth and Twitter I have it in my blog
"If you are writing a desktop Twitter client and you want your application's name to show up instead of "From API", you have to use OAUth.
If you want to use OAuth in your desktop Twitter application, you have to go through Twitter's PIN workflow (i.e., sending the user to the Twitter website to authenticate)."
Hold on a moment, how do Twitter clients manage to put their client name in the "via" without you logging in somewhere and copying a PIN back to the application.
I just want a command line client that updates my status and prints "via MyApp". Am I missing something here?
(I might be, I've only started trying to figure this out yesterday)
In fact if the user isn't authenticated, I don't want to get them to login elsewhere and copy/paste a PIN, I want them to type their user/pass into my application. Like what happens with all the twitter clients I've seen...