How do I know if a specific twitter user is online or not? - twitter

How do I know if a specific twitter user is currently online by writing programs? Is there any API or data field in the web page showing this information? Both browsing Twitter webpage and using Twitter app are considered "online".

Although this information is not readily available, you can do a work around. Make use of Twitter's Streaming API: https://dev.twitter.com/docs/streaming-apis/streams/public (have a read through this document).
You'll most likely be using the POST Statuses/filter functionality (read the doc here: https://dev.twitter.com/docs/api/1/post/statuses/filter ), which will give you a JSON object with tweets based on your filters.
Make use of the parameters you'll need to specify in the URL to filter the stream (have a look through this document to learn more about it: https://dev.twitter.com/docs/streaming-apis/parameters ), in your case it'll be the follow parameter. You basically specify the twitter ID of the user you want to follow. Here's a sample JSON result of the streaming API in action https://stream.twitter.com/1/statuses/filter.json?follow=25365536 - this one in particular is following Kim Kardashian. Keep in mind that this will give you:
Tweets created by the user.
Tweets which are retweeted by the user.
Replies to any Tweet created by the user.
Retweets of any Tweet created by the user.
So in order to just stream the tweets of your desired user, you'll have to use a programming language of your choice to parse through the JSON object to find the user that actually sent the tweet (this is a little tricky, you'll have to look through the properties of the JSON object to figure it out). Once you narrow the streaming tweets to just the ones from the user though, you can then have an alert on when new tweets by this user stream and that will tell you if the user is online/using twitter at the moment.

It's not clear what you mean by "online" (browsing twitter.com? Using a Twitter app?), but in any case Twitter doesn't provide such information, thankfully.

I'm afraid such information is limited by Twitter and is not available. However you can put your question on https://dev.twitter.com/discussions and ask its developers. Good Luck

you need get user state first
then filter if around current time
then get ids
they are online
use twitter developer api
I do it for my website

Related

How to find out if a user has actually Tweeted?

I have a website which allows the user to tweet using a specific hashtag, would their be anyway to actually find out if the user has really tweeted.
I was thinking of looking at the timestamps and just working out the difference between right now and when the last tweet was made but that's not really professional.
I know Facebook allows you to do this quite easily but I'm struggling to figure out the best solution.
any ideas?
Regards
Retrieve the tweets of the user in question
Scan the text of each tweet, looking for your hashtag.
If you know when they visited your website, compare the time of the visit to the time of the tweet.
If you need to ensure the users tweets, then tweet for the user by requesting authorization and then tweeting via the API. This will still not stop the users from deleting the tweet.
If you plan any reward scheme, you won't be able to force users to keep the tweet (and probably the twitter API ToS forbid such things).
You want to use the Twitter STREAM API. One of the public stream is the Filter Stream.
This stream give the possibility to specify keywords/hashtags that you want to follow in live.
You can simply track the hashtag that you want and then you will receive in live all the tweets posted with your hashtag.
You can then simply check the json property user and compare the id/screen_name to the user you want to identify.

How should I get all the tweets of an specific hashtag?

I'm trying to develop some code in order to get all the tweets that were generated with certain hashtags, then parse them and finally analyse them. I believe I've already thought and solve the last two parts of this but I'm having some trouble with the first one. I've already read the Twitter Search API documentation but I haven't realised yet how to do this. Can anyone help me?
If you want to retrieve the tweets sent recently, you should use the search/tweets endpoint of twitter' REST API, and mention the hashtag inside q parameter
In case you want to listen to tweets containing the hashtag and receive them in real time, then twitter's streaming API is what you should use (statuses/filter endPoint).
Have a look at the documentation on twitter's website, there's also plenty of information on how to do this all around the web.

How do I get the retweet_count of a given tweet WITHOUT user interaction?

I have a list of tweets that are using a hashtag I made. I'm getting these tweets using the search api. All I want is to get the number of retweets. I DO NOT need to post on their behalf. It seams ridiculous that I would need to have every single user login to my site, login to twitter and approve my application via OAUTH for EVERY TWEET IN MY LIST. There's gotta be a way to get that number without the need for oauth.
I tried getting it directly from the search api, but that's not consistently there. I've tried https://api.twitter.com/1/statuses/show/275729088709283840.json but that doesn't work, for some reason. Is there anyway to do this extremely simple task without going down the asinine road of user-interaction?
You have to create a background-process that uses the stream API. Phirehose is a php library that is set up to do this: https://github.com/fennb/phirehose

Twitter messages on website with votes

I am not sure how it is done, therefore my questions below:
I would like to ask folks on Twitter for a suggestion on a particular topic. Can I tell them to use certain hashtag and have all comments with that hashtag posted on my site?
Do I just pick a hashtag or does it need to be created somehow?
Can I have users on my site rate those suggestions? In that case, would I need to somehow grab twitter message and store locally?
Just trying to understand the process in order to implement it.
Hashtags don't have to be created - just use it in tweet.
In order to get all tweets with particular hashtag, use search API: https://dev.twitter.com/docs/api/1/get/search and search for this hashtag. You should save all relevant tweets (twitter search is not reliable on old tweets).

Find the number of times a tweet has been viewed

There have been quite a few number of start-up pertaining to analyzing Twitter data. There is CrowdBooster, then there is Klout, which use Twitter data to tell the user their True reach.
I have got the following two questions:
1) Is there a way to find out who has viewed one's tweet, or the number of people that have viewed a tweet. Crowdbooster claims to tell you how many impression one received per tweet. How do they do it?
2) Thousands and thousands of links are shared each day on Twitter. Can we find out which user has clicked the link in a tweet?
I have looked through Twitter API and some of the companies that have licensed Twitter's Firehose, but have not found anything that meet my needs.
Also, to give you a short answer to your 2nd question. Now that we've established that view analysis is impossible. Can you find out which user has clicked on that link, absolutely. And depending on what your talking about, user as far as the user who has clicked on the link or the user that has the link on their Twitter stream. Both are possible,
in the case of A, you would get the referring users IP address. Methods vary depending on language.
But what I think your asking for is scenario B, finding out which user has the link in their Twitter stream. This can be done by querying the link, the API response you will get can include tweet entities which will list all this information out for you and more. Open up a firehose with your link and watch what comes in.
https://dev.twitter.com/docs/streaming-api/methods
1) Is there a way to find out who has viewed one's tweet, or the
number of people that have viewed a tweet. Crowdbooster claims to tell
you how many impression one received per tweet. How do they do it?
No, in the case of a view - this would be impossible. The tweet impression can happen in multiple silos. On the website, in a widget, in a mobile app. You can imagine that it's simply not possible to get the impression of a tweet on a view because of this reason and because unlike a click, there is no I viewed this tweet identifier sent when a view has been enacted. I spent a great deal of time researching for a way to get the tweet impression even based on a similar clicked link and this is not even possible. (edit: it's possible see the last paragraph) This brings us to question 2.
2) Thousands and thousands of links are shared each day on Twitter.
Can we find out which user has clicked the link in a tweet?
Yes, what these websites are mainly doing is analyzing links that you process through their website. If you can have a unique hash marker on a link then analysis becomes possible. Without a unique hash marker, Twitter will re-interrupt two of the same links in a exactly the same way, even in the case that it shortens your link to it's custom t.co wrapper.
This means the only reliable way to do tweet analysis is by including a unique link marker code on your tweet and analyze the the fact that somebody that has hit your server has clicked on that link.
There is a somewhat hidden Twitter API feature that helps you understand how popular a particular link is. That being the link count API .. http://urls.api.twitter.com/1/urls/count.json?url=
Something really outside of the box you can do if your set on analyzing multiple versions of exactly the same link without using markers and if your also using the Streaming (firehose) would be to analyze the tweet views (using the link count API) on similar links that hit your server. The link that got the +1 boost in view is the one that hit your server. But that's about the extent of creative analysis you can get with your tweets and more specifically the links, as mentioned links are the only thing your really able to analyze when it comes to Twitter.
1) Is there a way to find out who has viewed one's tweet, or the number of people that have viewed a tweet. Crowdbooster claims to tell you how many impression one received per tweet. How do they do it?
Yes, sign up for Twitter Analytics https://analytics.twitter.com (free service provided by Twitter) and you can see how many people view (impressions) for each tweet and totals for specific dates or a date range.
2) Thousands and thousands of links are shared each day on Twitter. Can we find out which user has clicked the link in a tweet?
Yes, you can do this. Using a URL shortening service like Bitly.com you can track how many clicks you had from Twitter (only give out that Bitly link on Twitter to do this). But if you want more indept information you may need to create a tracking software, as I don't know of any available. To do that you would need the tracking software to track the link and find out the refer header and see if it's from Twitter (or better yet, just give out a unique URL for your tweets), then you would need to use the Twitter API to find out the handle (username) of that visitor who clicked your link. Lastly store this information in a database so you can review who clicked what link.

Resources