How to send invitation to facebook friend from my application - ruby-on-rails-3

Hi I am working on Rails application. My application is currently in 'invitation only' mode. What I want to do is once user signed up to my application then user should be able to invite his Facebook friends to my application. So what is the best way to do it? I want to do similar like pinterest does. pinterest is also in invitation only mode. But still it allows my facebook friend to whom I have sent an invite to sign up directly. So how I can implement it in my application? Any guidance will be helpful..

Use the requests dialog:
http://developers.facebook.com/docs/reference/dialogs/requests/
Store the list of user id's you get back (which you need to do anyhow
to delete the request programmatically when the come to your app)
When a user tries to login to your app, ensure that they're on your
list of id's you stored earlier.
Delete their app request
See http://developers.facebook.com/docs/reference/dialogs
Deleting Requests When a user is directed to your application, by
clicking a Request from the application, the games dashboard, or from
a Request notification, you must delete the request after it has been
accepted. Requests are not automatically deleted once they have been
clicked, thus it is the developer’s responsibility to clear them once
they have been consumed.

Related

Sending a mail using 365 instance

I am developing an app on Microsoft Teams, and I would like to send a mail with an instance of a logged in user.
This means that a user logs into my Microsoft Teams app, wants to send a custom mail that the app generated, now I want to send a request to my REST API to send this mail as the user.
I could not find any relevant information regarding sending an email like this, I only found methods to send emails with supplying username/password or using the current logged user on the machine (which I can't use since I want to do that using my REST API).
Example of what I found but is irrelevant:
https://www.add-in-express.com/creating-addins-blog/2011/09/02/outlook-create-send-message/
You don't mention if your app is a Tab or a Bot app (or something else), but I'm presuming a Tab. In any case, both Bots and Tab's offer the ability to do SSO sign-in of the user, in which case you can easily get a token for the user. In your backend API, you can exchange this for an "on behalf of" (OBO) token, which lets you access the Microsoft Graph API on the user's behalf. Once that's done, you can call the "send mail" operation on Graph.
To find out more about the above, see:
here for an excellent video overview on SSO with Tabs
here for a blog post on how to exchange the tokens and make the graph call securely
here for the specific operation in Graph (sending email)

send notification to a particular user with notification hub - Azure and GCM

I am a software developer in Xamarin - Android, I want to create notification messages. For this purpose I use Azure notification hub, combined with Google's service - Google Cloud Messaging (GCM).
My problem comes when I want to send notification to a particular user. I realized that I need to use the "TAGS" When I compose a new user to the system (Uniqe TAG)
Indeed, it works great, but when the user logged off his account, and then connect to another one (with another TAGS) - the TAGS of his old account are kept in a certain time, and he continues to receive personal messages from the previous account!!!!
Does anyone know what can be done about it?
thank you very much
This is actually an issue a lot of people/apps have on iOS and Android.
What you should do is:
Register your app at your Azure Notification Hub (ANH) on first start and reregister at every app start, to keep registration in sync
If a user logs in, update the registration with an additional tag for this user (e.g. "user:XY")
Sending notifications to that user tag will of course result in notifications on all devices the user is logged in on
If a user logs out, update the registration without the user tag (omit the user tag, so the registration doesn't have user tag anymore afterwards)
The registration will be updated immediately on ANH and sending notifications to the user (tag) will not result in notifications on that specific client
If the user can logout on your app without internet connection, you won't be able to update the registration of course and you will still have the problem of getting notifications for a logged out user. But as soon as another user logs in, the registration should get updated with the new user tag and everything should be fine again...
What you shouldn't do:
"Developers should never unregister the client app as a mechanism for logout or for switching between users..."

get latest tweet of a user without authentication

I am creating a website using rails. there is no user authentication but all the team members data(name, summary of job experience, social media handles, etc) is saved in a json file which is parsed to show the data on page. I have a twitter handle of every user. I want to collect the latest tweet and the tweet's information(tweeted on, etc) for every handle. Also, if any of the user posts another tweet, that tweet should replace the old tweet. I dont have user authentication in my application. i did try on terminal
curl http://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=user_name&count=1
but it gives me
{"errors":[{"message":"Bad Authentication data","code":215}]}
All requests to Twitter's API now need to be authenticated. See the documentation for the API call you want to make.
You will need to register an app with Twitter and get your authentication tokens before you can start to make requests like that.
So, to be clear, the users do not need to be authenticated - but your app does need to be authenticated.

How publish Hootsuite on Google+ Pages stream?

I want to achieve the same as Hootsuite, publish a post in a PAGE STREAM. But I don't know even where to look for it. It looks like Hootsuite is using the API, because they prompt an open Auth authentication where the user selects and authorize what this APP can do with his data.
With the PHP client I've been able of posting in the user APP stream (different from the user main stream) using moments class, and get data from the user using plus class client, both from the PHP library available here: https://code.google.com/p/google-api-php-client/source/checkout
But I don't know how to write in a user's page. Does anyone knows or can point me where to go to, at least, publish on main Google+ page stream as Hootsuite? Thanks.
The Google+ Pages API is currently available to a limited number of parters only, including HootSuite. You can request access to the API at https://developers.google.com/+/api/pages-signup but there is no guarantee when, or even if, Google will approve your access.
Although you can use the HootSuite console to post messages to Google+ pages (see http://hootsuite.com/google+), it isn't clear if you can use the HootSuite API to do so.

soundcloud authentication for server-side code (no app!)

I would like my server-side code to upload tracks to soundcloud in its own name, then later it will retrieve comments, favourites and listener counts. I do not want to do this on behalf of an app user - for there is no app! Previous questions here on stackoverflow§ (there is no "me too" button) and the API docs seem to suggest I cannot do this. Am I correct?
§ Can track belong to the application and not individual users?
This is called "Authenticating without the SoundCloud Connect Screen" in the API docs:
http://developers.soundcloud.com/docs/api/guide#user-credentials
An "app" in this case is a program that wants to access the Soundcloud API. You register them here:
http://soundcloud.com/you/apps/
Normally you would make a unique username, and register the app to that user. Then, the code logs in as that user to authenticate.