connecting to the pulse of the planet with the twitter platform

54
December 10, 2014 #phphants Connecting to the Pulse of the Planet

Upload: andy-piper

Post on 07-Jul-2015

3.632 views

Category:

Data & Analytics


1 download

DESCRIPTION

How the Twitter Web, Data and Mobile platforms enable developers to connect to the real-time pulse of the planet. Talk given at the PHP Hampshire meetup in Portsmouth, December 2014

TRANSCRIPT

Page 1: Connecting to the Pulse of the Planet with the Twitter Platform

December 10, 2014 #phphants

Connecting to the Pulse of the Planet

Page 2: Connecting to the Pulse of the Planet with the Twitter Platform

Andy PiperDeveloper Advocate

@andypiper

Page 3: Connecting to the Pulse of the Planet with the Twitter Platform
Page 4: Connecting to the Pulse of the Planet with the Twitter Platform

271M+

500M+

Active Users

Tweets per Day

2006 2014

Page 5: Connecting to the Pulse of the Planet with the Twitter Platform

Twitter is global,open and real-time

Page 6: Connecting to the Pulse of the Planet with the Twitter Platform

Twitter is the shortest distance between @you and your #interests

Page 7: Connecting to the Pulse of the Planet with the Twitter Platform

Twitter is there atworld events

Page 8: Connecting to the Pulse of the Planet with the Twitter Platform

Twitter is the pulseof the planet

Page 9: Connecting to the Pulse of the Planet with the Twitter Platform

143,199Tweets per second

5,700 TPS on average

Page 10: Connecting to the Pulse of the Planet with the Twitter Platform

How can you use Twitter Data to power your apps?

Page 11: Connecting to the Pulse of the Planet with the Twitter Platform
Page 12: Connecting to the Pulse of the Planet with the Twitter Platform
Page 13: Connecting to the Pulse of the Planet with the Twitter Platform
Page 14: Connecting to the Pulse of the Planet with the Twitter Platform

@andypiper

Page 15: Connecting to the Pulse of the Planet with the Twitter Platform

@andypiper

Page 16: Connecting to the Pulse of the Planet with the Twitter Platform

Web Platform

Page 17: Connecting to the Pulse of the Planet with the Twitter Platform
Page 18: Connecting to the Pulse of the Planet with the Twitter Platform
Page 19: Connecting to the Pulse of the Planet with the Twitter Platform

Twitter for Web• Tweet button • Follow button • Tweet embeds • Embeddable timelines • Web Intents

Driven by widgets.js

Page 20: Connecting to the Pulse of the Planet with the Twitter Platform

@TwitterAds | Confidential

Page 21: Connecting to the Pulse of the Planet with the Twitter Platform

@TwitterAds | Confidential@chabotc | platform overview

Page 22: Connecting to the Pulse of the Planet with the Twitter Platform

@TwitterAds | Confidential@chabotc | platform overview

<a href="https://twitter.com/share" class="twitter-share-button" data-via="andypiper">Tweet</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>

Page 23: Connecting to the Pulse of the Planet with the Twitter Platform

@TwitterAds | Confidential

Page 24: Connecting to the Pulse of the Planet with the Twitter Platform
Page 25: Connecting to the Pulse of the Planet with the Twitter Platform

Vine embedsGET https://vine.co/oembed.json

Returns oEmbed JSON data matching your query.

Data id: OvjwJIWQV2tmaxheight: 600maxwidth: 600omit_script

Page 26: Connecting to the Pulse of the Planet with the Twitter Platform

Vine embeds{ "version": 1.0, "type": "video", "cache_age": 3153600000, "provider_name": "Vine", "provider_url": "https://vine.co/", "author_name": "Andy Piper", "author_url": "https://vine.co/u/906305068322660352", "title": "ROBOT is awesome!", "thumbnail_url": "https://v.cdn.vine.co/r/videos/9B03025B6B1152337046950596608_3c86180121b.1.1.13598183071119429391.mp4.jpg?versionId=RK2EE1Qgw6r0EqeovdUlKOVHWAMhNVdC", "thumbnail_width": 480, "thumbnail_height": 480, "html": "<iframe class=\"vine-embed\" src=\"https://vine.co/v/OvjwJIWQV2t/embed/simple\" width=\"600\" height=\"600\" frameborder=\"0\"><\/iframe><script async src=\"//platform.vine.co/static/scripts/embed.js\"><\/script>", "width": 600, "height": 600}

Page 27: Connecting to the Pulse of the Planet with the Twitter Platform

Vine embeds{ "version": 1.0, "type": "video", "cache_age": 3153600000, "provider_name": "Vine", "provider_url": "https://vine.co/", "author_name": "Andy Piper", "author_url": "https://vine.co/u/906305068322660352", "title": "ROBOT is awesome!", "thumbnail_url": "https://v.cdn.vine.co/r/videos/9B03025B6B1152337046950596608_3c86180121b.1.1.13598183071119429391.mp4.jpg?versionId=RK2EE1Qgw6r0EqeovdUlKOVHWAMhNVdC", "thumbnail_width": 480, "thumbnail_height": 480, "html": "<iframe class=\"vine-embed\" src=\"https://vine.co/v/OvjwJIWQV2t/embed/simple\" width=\"600\" height=\"600\" frameborder=\"0\"><\/iframe><script async src=\"//platform.vine.co/static/scripts/embed.js\"><\/script>", "width": 600, "height": 600}

Page 28: Connecting to the Pulse of the Planet with the Twitter Platform

Cards

Page 29: Connecting to the Pulse of the Planet with the Twitter Platform

Cards

<meta name="twitter:card" content="summary"><meta name="twitter:site" content="@nytimes"><meta name="twitter:creator" content="@SarahMaslinNir"><meta name="twitter:title" content="Parade of Fans for Houston’s Funeral"><meta name="twitter:description" content="The guest list and parade of limousines ..”><meta name="twitter:image" content="http://graphics8.nytimes.com/images/2012/02/19/us/19whitney-span/19whitney-span-article.jpg">

Page 30: Connecting to the Pulse of the Planet with the Twitter Platform

Photo Card

Player CardLarge Image

Summary Card

Summary Card

App Card

General Assembly @GA

Sar***@***email.com

10-Week Front-End Web Development Course in San FranciscoAccept this offer by sharing your email address with General Assembly

Request More Info

Sarah Lindberg@selindberg

View advertiser privacy policy

4 JunLearn HTML, CSS, JavaScript in 10 Saturdays in SF — impressfriends, potential employers, Twitter followers:cards.twitter.com/cards/2tg4az/1p Hide promotion Reply Retweet Favorite More

Lead Gen Card

Gallery Card

Product Card

Page 31: Connecting to the Pulse of the Planet with the Twitter Platform

Data Platform

Page 32: Connecting to the Pulse of the Planet with the Twitter Platform

Twitter APIs deal both with the right now and what happened

Page 33: Connecting to the Pulse of the Planet with the Twitter Platform

Streaming APIs allow you to ingest what’s happening right now

Page 34: Connecting to the Pulse of the Planet with the Twitter Platform

Streaming APIs let you ingest what’s happening right nowPOST https://stream.twitter.com/1.1/statuses/filter.json

Returns Tweets matching your criteria.

Data follow: 3946301 track: #phphants locations: 2.1733,41.3633,2.1933,41.4033 language: en

Page 35: Connecting to the Pulse of the Planet with the Twitter Platform

Streaming APIs let you ingest what’s happening right nowGET https://stream.twitter.com/1.1/statuses/sample.json

Returns ~1% of all firehose data, statistically relevant.

GET https://stream.twitter.com/1.1/statuses/firehose.json

Returns all firehose data, requires business deal.

Page 36: Connecting to the Pulse of the Planet with the Twitter Platform

Streaming APIs let you ingest what’s happening right now{"created_at":"Sun Dec 01 21:44:59 +0000 2013","id":407264085194330112,"id_str":"407264085194330112","text":"\u201c@DM_Minions: The minion mobile! http:\/\/t.co\/Tq8AQoXcVy\u201d shall I get it, @CourtneyLouu \ud83d\ude0f\ud83d\ude18","source":"\u003ca href=\"http:\/\/twitter.com\/download\/iphone\" rel=\"nofollow\"\u003eTwitter for iPhone\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":407263303405023232,"in_reply_to_status_id_str":"407263303405023232","in_reply_to_user_id":948825632,"in_reply_to_user_id_str":"948825632","in_reply_to_screen_name":"DM_Minions","user":{"id":404024178,"id_str":"404024178","name":"emilyjade","screen_name":"_emilyjade","location":"","url":null,"description":"'what is essential, is invisible to the eye'","protected":false,"followers_count":156,"friends_count":287,"listed_count":0,"created_at":"Thu Nov 03 10:18:49 +0000 2011","favourites_count":379,"utc_offset":null,"time_zone":null,"geo_enabled":true,"verified":false,"statuses_count":8506,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"EBEBEB","profile_background_image_url":"http:\/\/abs.twimg.com\/images\/themes\/theme7\/bg.gif","profile_background_image_url_https":"https:\/\/abs.twimg.com\/images\/themes\/theme7\/bg.gif","profile_background_tile":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/378800000811908687\/bc82e20db7c7812a1f61f72998f948e9_normal.jpeg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/378800000811908687\/bc82e20db7c7812a1f61f72998f948e9_normal.jpeg","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/404024178\/1385914936","profile_link_color":"990000","profile_sidebar_border_color":"DFDFDF","profile_sidebar_fill_color":"F3F3F3","profile_text_color":"333333","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":null,"follow_request_sent":null,"notifications":null},"geo":{"type":"Point","coordinates":[51.35264663,-1.15710757]},"coordinates":{"type":"Point","coordinates":[-1.15710757,51.35264663]},"place":{"id":"d009bfdb11c20f3e","url":"https:\/\/api.twitter.com\/1.1\/geo\/id\/d009bfdb11c20f3e.json","place_type":"city","name":"Basingstoke and Deane","full_name":"Basingstoke and Deane, Hampshire","country_code":"GB","country":"United Kingdom","contained_within":[],"bounding_box":{"type":"Polygon","coordinates":[[[-1.4601689999999998,51.133537999999994],[-1.4601689999999998,51.383949],[-0.9748119999999999,51.383949],[-0.9748119999999999,51.133537999999994]]]},"attributes":{}},"contributors":null,"retweet_count":0,"favorite_count":0,"entities":{"hashtags":[],"symbols":[],"urls":[],"user_mentions":[{"screen_name":"DM_Minions","name":"DespicableMe Minions","id":948825632,"id_str":"948825632","indices":[1,12]},{"screen_name":"CourtneyLouu","name":"coourts","id":43456930,"id_str":"43456930","indices":[73,86]}],"media":[{"id":407263303325335552,"id_str":"407263303325335552","indices":[33,55],"media_url":"http:\/\/pbs.twimg.com\/media\/Babj0QzCQAAMrX4.jpg","media_url_https":"https:\/\/pbs.twimg.com\/media\/Babj0QzCQAAMrX4.jpg","url":"http:\/\/t.co\/Tq8AQoXcVy","display_url":"pic.twitter.com\/Tq8AQoXcVy","expanded_url":"http:\/\/twitter.com\/DM_Minions\/status\/407263303405023232\/photo\/1","type":"photo","sizes":{"small":{"w":339,"h":236,"resize":"fit"},"large":{"w":958,"h":666,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"medium":{"w":599,"h":417,"resize":"fit"}},"source_status_id":407263303405023232,"source_status_id_str":"407263303405023232"}]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"filter_level":"medium","lang":"en"}{"created_at":"Sun Dec 01 21:44:59 +0000 2013","id":407264086347747328,"id_str":"407264086347747328","text":"@DannyArratoon already eaten it but you can bring me another one?","source":"\u003ca href=\"http:\/\/twitter.com\/download\/iphone\" rel=\"nofollow\"\u003eTwitter for iPhone\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":407263944844533761,"in_reply_to_status_id_str":"407263944844533761","in_reply_to_user_id":210579473,"in_reply_to_user_id_str":"210579473","in_reply_to_screen_name":"DannyArratoon","user":{"id":495068253,"id_str":"495068253","name":"eleanor","screen_name":"ell_eysselinck","location":"london","url":null,"description":null,"protected":false,"followers_count":430,"friends_count":345,"listed_count":0,"created_at":"Fri Feb 17 15:23:34 +0000 2012","favourites_count":3934,"utc_offset":0,"time_zone":"London","geo_enabled":true,"verified":false,"statuses_count":7800,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"000000","profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/635582704\/nud5dpj44ngj5bgv5k55.jpeg","profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/635582704\/nud5dpj44ngj5bgv5k55.jpeg","profile_background_tile":true,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/378800000812022272\/b0218f45cb51525440be4f5782aaba6b_normal.jpeg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/378800000812022272\/b0218f45cb51525440be4f5782aaba6b_normal.jpeg","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/495068253\/1378837388","profile_link_color":"EB091C","profile_sidebar_border_color":"C0DEED","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":null,"follow_request_sent":null,"notifications":null},"geo":{"type":"Point","coordinates":[51.37097685,-0.21992044]},"coordinates":{"type":"Point","coordinates":[-0.21992044,51.37097685]},"place":{"id":"8840213b5fc1032a","url":"https:\/\/api.twitter.com\/1.1\/geo\/id\/8840213b5fc1032a.json","place_type":"city","name":"Sutton","full_name":"Sutton, London","country_code":"GB","country":"United Kingdom","contained_within":[],"bounding_box":{"type":"Polygon","coordinates":[[[-0.24586899999999998,51.321324999999995],[-0.24586899999999998,51.393378999999996],[-0.117306,51.393378999999996],[-0.117306,51.321324999999995]]]},"attributes":{}},"contributors":null,"retweet_count":0,"favorite_count":0,"entities":{"hashtags":[],"symbols":[],"urls":[],"user_mentions":[{"screen_name":"DannyArratoon","name":"Danny","id":210579473,"id_str":"210579473","indices":[0,14]}]},"favorited":false,"retweeted":false,"filter_level":"medium","lang":"en"}{"created_at":"Sun Dec 01 21:44:59 +0000 2013","id":407264087085953025,"id_str":"407264087085953025","text":"@brontemaria22 #firstin","source":"\u003ca href=\"http:\/\/twitter.com\/download\/iphone\" rel=\"nofollow\"\u003eTwitter for iPhone\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":407262865251643392,"in_reply_to_status_id_str":"407262865251643392","in_reply_to_user_id":771468884,"in_reply_to_user_id_str":"771468884","in_reply_to_screen_name":"brontemaria22","user":{"id":442104599,"id_str":"442104599","name":"zolf","screen_name":"FleurMarie32","location":"","url":null,"description":null,"protected":false,"followers_count":360,"friends_count":238,"listed_count":0,"created_at":"Tue Dec 20 19:13:40 +0000 2011","favourites_count":563,"utc_offset":null,"time_zone":null,"geo_enabled":true,"verified":false,"statuses_count":3092,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"BADFCD","profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/

Page 37: Connecting to the Pulse of the Planet with the Twitter Platform

{"created_at":"Sun Dec 01 21:45:05 +0000 2013"-___-","source":"\u003ca href=\"http:\/\/twitter.com\/download\/android\" rel=\"nofollow\"\u003eTwitter for Android\u003c\/a\u003e","truncated"227832638,"id_str"\u2654","protected"0,"time_zone":"London"1403,"lang":"en",378800000083305114\/ee1c2e7794e0c51e4e7b2ba0f6a7945c.jpeg"ee1c2e7794e0c51e4e7b2ba0f6a7945c.jpeg"1a36a16793ca9b2a0a03394882c915d7_normal.jpeg"1a36a16793ca9b2a0a03394882c915d7_normal.jpeg"1373062307","profile_link_color"ault_profile":false[51.4083624,-0.1741862322798d3ff5fc1ad.json"{"type":"Polygon"[-0.12430899999999999[]},"favorited":false{"created_at":"Sun Dec 01 21:45:06 +0000 2013"twice this week and Saturday.!!!"\u003e","truncated"58238096,"id_str"@Anthonystrong_ @davidbrewis @JYEFRASCA @carl_au are all amazing \u2764"+0000 2009","favourites_count"40816,"lang":"en"220812468\/JERSEY_BOYS_NEW_CAST_006.JPG"JERSEY_BOYS_NEW_CAST_006.JPG"d0a6185642c03999dc9c2c6ca410489b_normal.jpeg"d0a6185642c03999dc9c2c6ca410489b_normal.jpeg"1375203290","profile_link_color"ault_profile":false[51.48904526,-0.2254063221ef55ae159be7da.json"[],"bounding_box"{}},"contributors"[]},"favorited":false{"created_at":"Sun Dec 01 21:45:05 +0000 2013"pnvVA8zrok","source":null,"user":{"id"\/amipunkrockyett.tumblr.com\/"4","protected":false0,"time_zone":"London"26741,"lang":"en"378800000114001873\/7f775c54b55953b18d27d6310bb7966e.jpeg"7f775c54b55953b18d27d6310bb7966e.jpeg"7170dbfc17305c648928ba02d8dc6acc_normal.png"7170dbfc17305c648928ba02d8dc6acc_normal.png"1385846550","profile_link_color"fault_profile":false{"id":"5d838f7a011f4a2d"England","country_code"[0.334433,51.691672[],"media":[{"id"pbs.twimg.com\/media\/BabkjZFCUAEWsGT.png"407264112997978112\/photo\/1"{"w":500,"h":654,

Page 38: Connecting to the Pulse of the Planet with the Twitter Platform

Anatomy of a Tweet{ "created_at": "Wed Oct 02 15:53:43 +0000 2013", "id": 385432417126739968, "id_str": "385432417126739968", "text": "Learn more about the powerful #Linux container engine @docker in this video intro with @solomonstre - http:\/\/t.co\/QJLdA1762Y @TwitterOSS", "source": "web", "truncated": false, "in_reply_to_status_id": null, "in_reply_to_status_id_str": null, "in_reply_to_user_id": null, "in_reply_to_user_id_str": null, "in_reply_to_screen_name": null, "user": { "id": 1665823832, "id_str": "1665823832", "name": "Twitter University", "screen_name": "university", "location": "", "description": "Building a culture of learning for @TwitterEng and the world at large", "url": "http:\/\/t.co\/c8IHJLE1Y8", "entities": { "url": { "urls": [{ "url": "http:\/\/t.co\/c8IHJLE1Y8", "expanded_url": "http:\/\/youtube.com\/twitteruniversity", "display_url": "youtube.com\/twitterunivers\u2026", "indices": [0, 22]

Page 39: Connecting to the Pulse of the Planet with the Twitter Platform

"favorite_count": 25, "entities": { "hashtags": [{ "text": "Linux", "indices": [30, 36] }], "symbols": [], "urls": [{ "url": "http:\/\/t.co\/QJLdA1762Y", "expanded_url": "http:\/\/youtu.be\/Q5POuMHxW-0", "display_url": "youtu.be\/Q5POuMHxW-0", "indices": [102, 124] }], "user_mentions": [{ "screen_name": "docker", "name": "Docker", "id": 1138959692, "id_str": "1138959692", "indices": [54, 61] }, { "screen_name": "solomonstre", "name": "Solomon Hykes", "id": 9551792, "id_str": "9551792", "indices": [87, 99] }, { "screen_name": "TwitterOSS", "name": "Twitter Open Source", "id": 376825877, "id_str": "376825877", "indices": [125, 136] }] }, "favorited": false, "retweeted": true, "possibly_sensitive": false, "lang": "en"}

Page 40: Connecting to the Pulse of the Planet with the Twitter Platform

REST APIs let you perform actions and access what happened

Page 41: Connecting to the Pulse of the Planet with the Twitter Platform

The Twitter APIOver 100 REST API endpoints

• Tap into Twitter data ‣ GET /search/tweets

• Engage users socially ‣ POST /statuses/update

Page 42: Connecting to the Pulse of the Planet with the Twitter Platform

REST APIs let you perform actions and access what happenedTweets & Media GET statuses/lookup POST statuses/update

POST media/upload

Timelines GET statuses/home_timelineGET statuses/user_timeline

GET statuses/mentions_timeline

Search GET tweets/search

Following GET friends/list

And many more: Users, Favorites, Direct Messages, Block/Mute, Followers, Lists, Trends, Geo…

Page 43: Connecting to the Pulse of the Planet with the Twitter Platform

Mobile Platform

Page 44: Connecting to the Pulse of the Planet with the Twitter Platform
Page 45: Connecting to the Pulse of the Planet with the Twitter Platform
Page 46: Connecting to the Pulse of the Planet with the Twitter Platform

TwitterDev

Page 47: Connecting to the Pulse of the Planet with the Twitter Platform

TwitterDev• Encourage, enable & engage

with the community

• Write code

• Advocate for the Twitter developer

Page 48: Connecting to the Pulse of the Planet with the Twitter Platform

Build awesome open-source applications

t.co/code

Page 49: Connecting to the Pulse of the Planet with the Twitter Platform
Page 50: Connecting to the Pulse of the Planet with the Twitter Platform
Page 51: Connecting to the Pulse of the Planet with the Twitter Platform

Open Source libraries 50+ open-source client libraries

10+ languages & platforms

t.co/libs

Page 52: Connecting to the Pulse of the Planet with the Twitter Platform

+t.co/libs

Page 53: Connecting to the Pulse of the Planet with the Twitter Platform

Communicate fearlessly to build trust

t.co/forum

Page 54: Connecting to the Pulse of the Planet with the Twitter Platform

@andypiper

#ThankYou

Andy Piper [email protected]