How to automatically post a tweet on twitter - twitter

I am working on a site where users can submit data. Is it possible to set up an automated system such that a tweet goes out every time a new data set is received?

I believe it's possible through their own API: http://apiwiki.twitter.com/w/page/22554648/FrontPage

A good place to start is the Twitter API.

Using Abraham's Oauth library in your application and once you have verified/cleaned user import use the variables in an if statement and then call the library and post a tweet. i have a similar set up for adding films i've seen into a database and it tweets a rating everytime.
I can provide coding example (PHP) later if you need further help.

Related

Add Last Login to Users api call

Our customer wants to see a report of all their current users' last login dates, but I couldn't find a way to get that information from the current API:
http://docs.valence.desire2learn.com/res/user.html
It's a little frustrating, because it's so easy to get this data in the UI itself:
Is there any way we can get that data through the API? Thanks!
Currently, there is no way to get this information via an API call; however, you are not the first person to inquire about this, and I suspect it's on D2L's list of improvement items for their developer platform.

Twitter count with the new Twitter update

As of today, its not possible to fetch tweet counts. You can read more here:
https://blog.twitter.com/2015/hard-decisions-for-a-sustainable-platform
So almost all scripts/plugins wont work anymore. What would be best alternative solution with the new twitter buttons/updated API, if such exists?
For example, is there a callback, once user successfully shares something? Because i could use that to increase tweet count in my own database? So saving them locally.
To answer my own question based on findings:
For now its possible via http://opensharecount.com, they provide a drop-in replacement for the old private JSON URL based on searches made via the API (so you don't need to do all that work).
It's based on the REST API Search endpoints.

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

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

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

How to crawl retweets of a certain user?

I studied the Twitter API Documentation today. Only find that we could use "Twitter REST API Method: statuses user_timeline" to acquire statuses of a certain user. Retweets are stripped out of the user_timeline for backwards compatibility reasons. If I want retweets included, API Documentation recommend "statuses retweeted_by_me", but retweeted_by_me cannot return the retweets by other users.
I think maybe we can analyse the twitter webpage of a certain user to get his retweets. However is there any elegant way to crawl retweets of a certain user?
Thanks in advance!
This was addressed recently by the Twitter devs. You can now add a include_rts=true to your call to user_timeline. See the full discussion here: http://groups.google.com/group/twitter-development-talk/browse_thread/thread/7a4be385ff549ed0
You want to use the retweeted_to_me API call and then create a union with user_timeline and sort by datetime. It's a little annoying that they don't mix the stream for you.
Call statuses/user_timeline for the specific user then for each status you will have to call either statuses/id/retweeted_by or statuses/retweets.
http://apiwiki.twitter.com/Twitter-REST-API-Method:-GET-statuses-id-retweeted_by
http://apiwiki.twitter.com/Twitter-REST-API-Method:-statuses-retweets
You have to manually use GET statuses/retweets/:id for every Tweet from the use_timeline.

Resources