Social Developers London update for Twitter Developers


Published on

Social Developers London Presetation featuring @recorditapp, @STTLibrary, ‏and Real-time demos with Node.js and WebSockets from @romainhuet and Stewart Harper (see links)

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Logo
  • @recorditapp.

  • Twitter is a global, real-time platform; an indispensable companion to life in the moment. As such, Twitter is a reflection of what’s happening in the world at any given time and the Twitter APIs give developers the opportunity to tap into the pulse of the planet and use that data in innovative ways.
  • What are you going to engage people with about your product/brand/service?

    Using the Twitter Stream API to
  • As you can see on the screenshot, you can expect on average between 50 and 60 Tweets per second (TPS) when connecting to the sample endpoint.

    Twitter see on average 5,700 TPS on the platform, with a record at 143,199 TPS, which is why the complete firehose is very hard to consume without a high-capacity platform behind an application.
  • Beyond the sample, one of the most interesting way to collect Tweets in real time is the filter endpoint, which lets you receive Tweets matching different criteria. Whether you want to track Tweets with some keywords, Tweets from a selection of users, or Tweets posted around a location when users explicitly choose to share it, this endpoint is fascinating since it makes it possible to connect to the pulse of the planet in a way that is relevant to a very specific context.
    The following demo provides a simple interface for the different parameters offered by this endpoint. By sending the selected options such as a hashtag and a bounding box on the map over a WebSocket, the Node server establishes a connection to the filter endpoint which starts streaming Tweets matching at least one of the criteria. For example, on the screenshot below, Tweets containing #WorldCup or sent from a region in Brazil are sent over the WebSocket and displayed on the web page.
  • Social Developers London update for Twitter Developers

    1. 1. Angus Fox Co-Chair Social Developers London @nuxnix This talk draws on information from and but is in no way endorsed byTwitter Corporation or Facebook Corporation  #justsaying
    2. 2. The first places to start are at and @recorditapp #worldcup • Prototype engagement flow Stream API • Sample • Filter • Context • Heatmap
    3. 3. GIF support in theTwitter API NativeTwitter authentication on OS X They use STTwitter - an Objective-C library forTwitter REST API 1.1 and (often overlooked)AppleScript After the user provides credentials, they can then be guaranteed that ourAPI upload of the tweet with a GIF will work. On first use only which makes it really simple to share GIFs. @STTLibrary
    4. 4. 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 "" get the name of every anchor of pane id "" reveal anchor "" of pane id "" end tell
    5. 5. Generates a header file with an API that you can use to communicate with another application using Objective-C code. SystemPreferencesApplication *systemPreferences = [SBApplication applicationWithBundleIdentifier:@""]; SystemPreferencesPane *pane = (SystemPreferencesPane *) [[systemPreferences panes] objectWithID:@""]; SystemPreferencesAnchor *anchor = (SystemPreferencesAnchor *) [[pane anchors] objectWithName:@""]; [systemPreferences activate]; systemPreferences.currentPane = pane; [anchor reveal]
    6. 6. Lets talk about the world cup
    7. 7. Twitter.Com has had a #worldcup makeover m After Choosing a team, encourages you to change profile pic Suggests followers Tweet your support
    8. 8. Twitter.Com has had a #worldcup makeover m After Choosing a team, encourages you to change profile pic Suggests followers Tweet your support Get Started Add some affinity to your twitter picture Add followers with the same affinity Tweet Support
    9. 9. A couple of SampleApps might stimulate your appetite #worldcup • Prototype engagement flow Stream API • Creating an App • Sample Endpoint • Heatmap
    10. 10. Streaming APIs are at the cornerstone of the most fascinating products relying onTwitter data.  Analyzing the mood of people in the world  predicting elections  detecting breaking news  providing help to people during emergencies the-planet-with-twitter-apis
    11. 11. Provides you with roughly 1% of allTweets, randomly selected from the firehose. There are 500 millionTweets posted every single day, so 1% is still a very large number and statistically relevant for many use cases. s/sample DEMO OAuth signing results
    12. 12. The filter endpoint, lets you receiveTweets matching different criteria to trackTweets  with some keywords,  from a selection of users  around a location when users explicitly choose to share it
    13. 13. 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 api-map/  March 25, 2014 - Stewart Harper
    14. 14. 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 the web socket module, and loads theTwitterAPI module.
    15. 15. You must create an application onTwitter. Set the API keys to those in the twitterAPI tab.  API key > consumer_key  API secret > consumer_secret  Access token > access_token_key  Access token secret > access_token_secret
    16. 16. 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 theTweets get streamed.  We only want to streamTweets with location, so they are parsed, and if they have coordinates we create a simple piece of JSON containing the location.
    17. 17. 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 sendingTweets, 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 ofTweets captured in the twitter-stream listener, where they are added to an array bound to a Google Maps heat layer.
    18. 18. Presentations are available from Slideshare Slides