Twitter API - know if tweet has been sent - twitter

Is it possible, using Twitter's Web Intents, to have a link that when clicked :
Opens a popup to send a tweet containing the link I have chosen (no problem so far, I have tried that and it works)
Then, once the tweet is sent, calls a js or php script ?

Twitter's Tweet Web Intent doesn't provide this functionality. You'd have to build a solution using either the REST or Streaming APIs. Even that would only work if the user's Tweets are public, or if they give you read access to their timeline.

Related

How do I access the Twitter API from my website to display my latest tweet?

Background:
I'm using the react-boilerplate to build a personal website, and I would like to display my latest tweet in the footer. I do not want the embedded card, only the tweet itself (similar to the Momentum extension).
This appears to be what I am looking for:
https://dev.twitter.com/rest/reference/get/statuses/user_timeline
Question:
How is my website supposed to authenticate with the Twitter API, without including the authentication data in the website's codebase?
Should I have an app in the middle that processes the requests, or is it possible for my website to directly retrieve my latest tweet each time a user accesses my page?
Thanks

Fetching media by urls with Rest API

I would like to retrieve media inside statuses, but as I could read in the docs:
For media in direct messages, media_url_https must be accessed via an
authenticated twitter.com session or by signing a request with the
user’s access token using OAuth 1.0A. It is not possible to directly
embed these images in a web page
Now my question is, how to do that kind of request using Java API? or however what is the correct request with RestAPI, using App only auth?
another question: what is the difference for media in direct messages and media shared in Tweets? how can I see the difference inside json object representing a status?
what is the difference for media in direct messages and media shared in Tweets?
If an image is posted to a Twitter timeline, any Internet user can see it. For example on this Tweet the image is available to anyone, whether or not they're logged into Twitter. See https://pbs.twimg.com/media/CSGwFynWoAA2GGG.jpg
If an image is posted into a Direct Message, it is only possible for the sender and receiver to see the image. In order to enforce that, the user must either be signed in to their Twitter account, or send a signed request via an app.
For example, this image can only be seen by me & the person I sent it to https://ton.twitter.com/i/ton/data/dm/639737026624024579/639737026682691584/tg-4St-1.jpg
how can I see the difference inside json object representing a status?
The only difference (other than the API call you used to get the data) is the URl of the media. In a DM it starts with ton. e.g.
media_url": "https://ton.twitter.com/1.1/ton/data/dm/......
Whereas in a normal Tweet, it will look like e.g.
"media_url": "http://pbs.twimg.com/media/.......
Now my question is, how to do that kind of request using Java API? or however what is the correct request with RestAPI, using App only auth?
If the user is already logged in to Twitter, they will be able to download the image. For example, if you have written a web-app and the browser already contains the Twitter cookies etc.
If not - or you're using an app - you will need to sign the request on the user's behalf.
For REST - you need to send OAuth headers with the request. There's example code in the Twitter documentation
The extra header will look something like
Authorization:
OAuth oauth_consumer_key="xvz1evFS4wEEPTGEFPHBog",
oauth_nonce="kYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg",
oauth_signature="tnnArxj06cWHq44gCs1OSKk%2FjLY%3D",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="1318622958",
oauth_token="370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb",
oauth_version="1.0"
For Java, I'd suggest you take a look at how Twidere does it.

Pulling in my last tweet to my website

Since Twitter has changed its API I haven't yet coded anything that pulls in Twitter feeds.
How can I pull in my last tweet to my website and have it styled the way I want to like I used to be able to do before the change.
Assuming your website is developped in PHP, and you already have created your Twitter App, and generated the API and oAuth credentials here :
https://apps.twitter.com/
-> take a look here this is what you wanna do :
https://github.com/J7mbo/twitter-api-php/blob/master/index.php

Replacement for Twitter RSS API?

I'm currently using Twitter's RSS API (example) to retrieve people's tweets for an app. However, once version 1.1 of their API comes out, I won't be able to do this anymore. What's a simple replacement I can use for this?
Unfortunately the answer is: "There is none."
Twitter continues to lock down their platform, as they have since the switch to OAuth. If you want to add content to Twitter, you can do that easily. If you want to get content out of Twitter, well, you'll have to conform to Twitter's requirements.
RSS was an easy way of getting content out of Twitter, and so they killed it. They'll tell you that it wasn't really used, but that's a load of bull and they know it, but it sounds good and most people will simply swallow it.
There is a workaround that you can use until March 2013:
https://api.twitter.com/1/statuses/user_timeline/UserName.rss
Replace 'UserName' with the actual twitter username you want.
But after sometime in March/April 2013, that will cease to work and you'll have to use OAuth and json to parse Twitter feeds.
Use Twitter RSS - Google Apps Script from github to convert Twitter API 1.1 to RSS. Using this option you can get search results, users' timelines, users’ favorites or even Twitter Lists.
I've put together two mit licensed php scripts and instructions so you can fetch and cache twitter user timelines as RSS..
The most important is to cache the tweets since you are only allowed to call the API 15 times per 15 minutes..
Have a look at twitterrss.net
I've been looking for an answer to this for a while, basically as I wanted to provide a replacement for the Twitter triggers in IFTTT. When IFTTT removed them we could use Twitter's RSS feeds. However now, with v1 of their API retired, you have to authenticate any requests and they no longer off RSS feeds. It's a shame because it's closing the door for a lot of newbie developers out there.
I'd definitely recommend checking out twitter-rss.com in the answer above, but you might want to check out a solution I've come up with. It is called Twools and it's almost ready.
Twools started off as a way to get back RSS feeds from Twitter. Twitter
retired version 1 of their API in June 2013 as well as retiring RSS feeds. As
well as not having access to RSS feeds, you need to be authenticated to use
the API which
raises the bar for Twitter users and developers. It has been my intention to
make this as easy as possible for you install, however you do need to install
this on your own website (PHP is required). It is just a case of editing a few
lines in a file (with your Twitter app details) and uploading to your website.
Twools offers a number of RSS feeds from the Twitter API:
Your home timeline
User timeline (yours or another user's)
Your mentions
Your favorites
List timeline (from a list that you own)
Direct messages received (disabled by default)
Direct messages Sent (disabled by default)
Twitter Search
New followers
New friends
You can filter the results from the Twitter API by only outputting tweets
containing certain keywords, hashtags or screen names or even by the app used
to send the Tweet. As well as that you can filter based on the user (currently
their location and language). Finally, you can modify the data outputted in
the RSS feed by removing URLs, screen names, hashtags etc or share your recipe
with other folders. As well as an RSS feed generator, Twools has a basic
direct message spam filter (experimental- use at your own risk!) and a simple
social media management tool (basically an HTML version of the RSS filters).
You can also keep an eye on your API usage on the Status page.
With Twools and your app you could
Your tweets when you mention a specific hashtag
Your Twitter Faves:
Get new followers from the a certain country or location
Get tweets when someone mentions Starbucks negatively in a Tweet in the UK
Get tweets when someone tweets to an article on your website
For more information, see http://twools.it/

How to download Facebook page posts

I am an iOS developer and I am writing an app which needs to take statuses from my Facebook page and and display them in my app.
Does the Facebook API support that?
If it does, can anyone give a link for some tutorials or explain how can I make this?
I know that API supports an RSS feed but i don't found how to feed my statuses.
If you're using a Facebook page, you can easily use the graph API to query for posts made by that page. For example, for Starbucks:
http://graph.facebook.com/Starbucks/posts
You can simply load this in your browser to see the format the data comes back in, and all that's needed to access this data is a simple HTTP request. You can replace Starbucks with your Page's ID or username to get your Page's posts. These come back in JSON, which should be fairly easy to handle on your end.
Yes, the Facebook Graph API allows you to access your profile and extract any information you'd like from it.

Resources