Has your Twitter feed stopped working? Switching to their new API
Archive - Originally posted on "The Horse's Mouth" - 2013-06-23 05:50:32 - Graham EllisFrom my inbox...
"Got to keep your wits about you with this internet lark haven't you? Discovered the twitter feeds had disappeared from all my sites! Did you know Twitter had changed their APIs and the old ones no longer work!! Not seen anything about it until now..."

The changes were announced in August 2012 - there's background as to why [here]. In that article, Michael Sippy writes for Twitter:
"Currently, in v1.0 of the Twitter API we allow developers access to certain API endpoints without requiring their applications to authenticate, essentially enabling them to access public information from the Twitter API without us knowing who they are. For example, there are many applications that are pulling data from the Twitter API at very high rates (scraping, bots, etc.) where we only know the IP address of the applications. To prevent malicious use of the Twitter API and gain an understanding of what types of applications are accessing the API in order to evolve it to meet the needs of developers, it's important to have visibility into the activity on the Twitter API and the applications using the platform."
There are further implications - firstly, as developers no longer have the ability to simply drop a feed into the web sites they're developing without some sort of saying who they are, it's no longer possible simply to say "I would like feed X here" without setting something up ahead of time, so that (as stated) Twitter know who you are. That's extra work. And secondly, derived from that but not stated in information above, there's the who question of the control of where valuable social media data goes, and the Twitter folks are taking steps to be more owning and controlling of the data from their databases. Not only are they stopping very high pull rates and learning about the application needs, but they're also opening the way to being far more proactive as to who has what, and perhaps whether it contains advertising messages, or it costs money over and above certain volumes of hits.
A further article (last updated on 7th May this year) - [here] describes how JSON is the sole form of data supported, replacing XML (this is a trend we're seeing with services that other clinets are using) and much more. And the whole thing also looks much more complex.
Cutting to the Quick - My correspondent has a site with a feed of his own Twitter contributions keeping news lively on the front page. And he wants to keep something similar. Well - we had just the same thing on one of our pages. The old page included
<script src="http://widgets.twimg.com/j/2/widget.js"></script>
in the head, and at the position the feed was to display:
<script> new TWTR.Widget({ version: 2, type: 'profile', rpp: 3, interval:
6000, width: 200, height: 300, theme: { shell: { background: '#333333',
color: '#ffffff' }, tweets: { background: '#000000', color: '#ffffff',
links: '#4aed05' } }, features: { scrollbar: true, loop: false, live:
false, hashtags: false, timestamp: true, avatars: false, behavior: 'all'
} }).render().setUser('wellho').start(); </script>
And this code had been cut and pasted from a helper on the Twitter site.
For the new API, I have logged in to Twitter using my wellho account - the one that I want to show on the feed - and selected "settings" followed by "widgets". And I then created a user widget. Which results in the following code to be cut and pasted in place of all of the above:
<a class="twitter-timeline" href="https://twitter.com/wellho"
data-widget-id="348380091488808960">Tweets by @wellho</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],
p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id))
{js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js"
;fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
</script>
Clearly, that ID is my own key from the widget set up tool, and you can't just replace the "wellho" with something else for this to work for your own feed - you need to set up your own widget. But - hopefully - this little article will provide an answer to my correspondent so that he can get the feed, all be it looking a bit different, up and running again easily with - as he hints - so much else going on too!
P.S. This isn't the first time that Twitter have changed their feeds - see [here] for example. And a course that I've taken over that "needs a fresh lick of paint" also had other no-longer-working Twitter feed stuff in it. It can be a bit of a "game" sometimes - our recent upgrade of servers replaced some underlying 10 year old systems with brand new versions, and most of it just worked straight away, whereas some of these supposed "standards we can use" seem much more transient. I have no answer on this, just to reflect on my original correspondent - "Got to keep your wits about you with this internet lark haven't you?"