Post on 19-Aug-2015
Points of interest for Twitter Developers
30 June 2014
Angus FoxCo-Chair Social Developers London
@nuxnix
This talk draws on information fromdevelopers.facebook.com and dev.twitter.com but is in no way
endorsed by Twitter Corporation or Facebook Corporation #justsaying
TopicsThe first places to start are at dev.twitter.com and developers.facebook.com
@recorditapp
#worldcup• Prototype engagement
flow
Stream API• Sample• Filter• Context• Heatmap
@recorditapp using @STTLibrary
GIF support in the Twitter API Native Twitter authentication on OS X They use STTwitter - an Objective-C library for
Twitter REST API 1.1 and (often overlooked) AppleScript
After the user provides credentials, they can then be guaranteed that our API upload of the tweet with a GIF will work.
On first use only which makes it really simple to share GIFs.
https://github.com/nst/STTwitter @STTLibraryhttps://twitter.com/recorditapp/statuses/479723295550353409
AppleScript
If no such account exists, they use AppleScript plus Apple’s Scripting Bridge: -
tell application "System Preferences" activate set the current pane to pane id "com.apple.preferences.internetaccounts" get the name of every anchor of pane id "com.apple.preferences.internetaccounts" reveal anchor "com.apple.twitter.iaplugin" of pane id "com.apple.preferences.internetaccounts"end tell
Apple Script Bridge
Generates a header file with an API that you can use to communicate with another application using Objective-C code.
SystemPreferencesApplication *systemPreferences = [SBApplication applicationWithBundleIdentifier:@"com.apple.systempreferences"];
SystemPreferencesPane *pane = (SystemPreferencesPane *) [[systemPreferences panes] objectWithID:@"com.apple.preferences.internetaccounts"];
SystemPreferencesAnchor *anchor = (SystemPreferencesAnchor *) [[pane anchors] objectWithName:@"com.apple.twitter.iaplugin"];
[systemPreferences activate];
systemPreferences.currentPane = pane;[anchor reveal]
Tonight.
Twitter.Com has had a #worldcup makeover
https://twitter.com/i/start/world_cup/choose_team
After Choosing a team, encourages you to change profile pic
https://twitter.com/i/start/world_cup/setup_profile
Suggests followershttps://twitter.com/i/start/world_cup/follow_team
Tweet your support
Prototype Engagement Flow Twitter.Com has
had a #worldcup makeover
https://twitter.com/i/start/world_cup/choose_team
After Choosing a team, encourages you to change profile pic
https://twitter.com/i/start/world_cup/setup_profile
Suggests followershttps://twitter.com/i/start/world_cup/follow_team
Tweet your support
Get Started
Add some affinity to your twitter picture
Add followers with the same affinity
Tweet Support
Streaming APIA couple of Sample Apps might stimulate your appetite
#worldcup• Prototype
engagement flow
Stream API• Creating an App• Sample Endpoint• Heatmap
Connecting to the pulse of an event with Twitter APIs
Streaming APIs are at the cornerstone of the most fascinating products relying on Twitter data. Analyzing the mood of people in the world predicting elections detecting breaking news providing help to people during emergencies
https://blog.twitter.com/2014/connecting-to-the-pulse-of-the-planet-with-twitter-apis
https://dev.twitter.com/docs/streaming-apis/streams/public
https://github.com/romainhuet/twitter-platform-demos
Using the Sample endpoint Provides you with roughly 1% of all Tweets,
randomly selected from the firehose. There are 500 million Tweets posted every
single day, so 1% is still a very large number and statistically relevant for many use cases.
https://dev.twitter.com/docs/api/1.1/get/statuses/sample
DEMO OAuth signing results
Adding context and filtering Tweets
The filter endpoint, lets you receive Tweets matching different criteria to track Tweets with some keywords, from a selection of users around a location when users explicitly
choose to share it
Visualize Tweets on Google Maps
Stream geo-tagged tweets using Node.js The end result is a real-time heat map
depicting where in the world people are tweeting from
Download it from github
http://blog.safe.com/2014/03/twitter-stream-api-map/
March 25, 2014 - Stewart Harper
How it works
Package.json holds a variety of metadata related to the project and lists dependencies.
Server.js is where all of the logic lies. This code first sets up a web server using express, which serves the static web pages, loads socket.io the web socket module, and loads the Twitter API module.
Rate limited, authorised API
You must create an application on Twitter.
Set the API keys to those in the twitter API tab. API key > consumer_key API secret > consumer_secret Access token > access_token_key Access token secret >
access_token_secret
How it works
The client mapping application connects to the web socket server and triggers the connection listener.
Another listener, start tweets, is set up and a connected message is sent to the client telling them they are connected and everything is ready.
When the client receives this message, it sends a message to the start tweets listener and the Tweets get streamed. We only want to stream Tweets with location, so they
are parsed, and if they have coordinates we create a simple piece of JSON containing the location.
Twitterstream.js
This sets up the Google Map then opens up a websocket connection with the server.
Once the server confirms it has received the connection and is ready to start sending Tweets, the connected listener is called and the client sends a message back to the server to say it is ready via socket.emit(“start tweets”);.
The server responds with a stream of Tweets captured in the twitter-stream listener, where they are added to an array bound to a Google Maps heat layer.