microservices: utilizando o twitter como plataforma

51
MICROSERVICES: UTILIZANDO O TWITTER COMO PLATAFORMA @JCHAHOUD

Upload: juliana-chahoud

Post on 08-Feb-2017

606 views

Category:

Presentations & Public Speaking


3 download

TRANSCRIPT

Page 1: Microservices: Utilizando o Twitter como Plataforma

MICROSERVICES: UTILIZANDO O TWITTER

COMO PLATAFORMA@J C H A HOUD

Page 2: Microservices: Utilizando o Twitter como Plataforma

Juliana ChahoudDeveloper Advocate

@jchahoud

@TwitterDevBr

Page 3: Microservices: Utilizando o Twitter como Plataforma

320M+Active Users

2006 2016

Page 4: Microservices: Utilizando o Twitter como Plataforma

Twitter é global,aberto e real-time

Page 5: Microservices: Utilizando o Twitter como Plataforma

Twitter é a distância mais curta entre @voce e seus #interesses

Page 6: Microservices: Utilizando o Twitter como Plataforma

Twitter está presente nos eventos mundiais

Page 7: Microservices: Utilizando o Twitter como Plataforma

Twitter é o pulsodo planeta

Page 8: Microservices: Utilizando o Twitter como Plataforma

+ meio milhãoTweets por minuto - record

Page 9: Microservices: Utilizando o Twitter como Plataforma

Como usar serviços do Twitter nas suas aplicações?

Page 10: Microservices: Utilizando o Twitter como Plataforma

Microserviços: resolvem um determinado problema,

utilizam interfaces simples e bem definidas com outros módulos

Page 11: Microservices: Utilizando o Twitter como Plataforma
Page 12: Microservices: Utilizando o Twitter como Plataforma

Plataforma do Twitter

• Autenticação • Componentes para websites • Bots e Aplicações • Dados • Customer Service • Apps Mobile • mais…

Page 13: Microservices: Utilizando o Twitter como Plataforma

Autenticação

Page 14: Microservices: Utilizando o Twitter como Plataforma

Login

Page 15: Microservices: Utilizando o Twitter como Plataforma
Page 16: Microservices: Utilizando o Twitter como Plataforma

Componentes para Websites

Page 17: Microservices: Utilizando o Twitter como Plataforma
Page 18: Microservices: Utilizando o Twitter como Plataforma
Page 19: Microservices: Utilizando o Twitter como Plataforma

Twitter para Web• Timelines embedadas • Tweet button • Follow button • Tweet embedado • Web Intents

Através de widgets.js

Page 20: Microservices: Utilizando o Twitter como Plataforma

@TwitterAds | Confidential@chabotc | platform overview

<a class="twitter-grid" href="https://twitter.com/jchahoud/timelines/712260680670433280">PHPExperience2016</a> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

Page 21: Microservices: Utilizando o Twitter como Plataforma

@TwitterAds | Confidential@chabotc | platform overview

<a href="https://twitter.com/share" class="twitter-share-button" data-via="jchahoud">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 22: Microservices: Utilizando o Twitter como Plataforma

@TwitterAds | Confidential

Page 23: Microservices: Utilizando o Twitter como Plataforma
Page 24: Microservices: Utilizando o Twitter como Plataforma

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 25: Microservices: Utilizando o Twitter como Plataforma

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 26: Microservices: Utilizando o Twitter como Plataforma

Bots e Aplicações

Page 27: Microservices: Utilizando o Twitter como Plataforma

DELHI TRANSPORT

Page 28: Microservices: Utilizando o Twitter como Plataforma
Page 29: Microservices: Utilizando o Twitter como Plataforma
Page 30: Microservices: Utilizando o Twitter como Plataforma

Dados

Page 31: Microservices: Utilizando o Twitter como Plataforma
Page 32: Microservices: Utilizando o Twitter como Plataforma

APIs do Twitter: o que está acontecendo agora

e o que já aconteceu

Page 33: Microservices: Utilizando o Twitter como Plataforma

Streaming APIs permitem trabalhar com o que está acontecendo agora

Page 34: Microservices: Utilizando o Twitter como Plataforma

Streaming APIs: o que está acontecendo agoraPOST https://stream.twitter.com/1.1/statuses/filter.json

Retorna Tweets de acordo com critérios.

Data follow track: #phpexperience2016 locations language

Page 35: Microservices: Utilizando o Twitter como Plataforma

Streaming APIs: o que está acontecendo agoraGET https://stream.twitter.com/1.1/statuses/sample.json

Retorna ~1% dos dados, relevantes estatisticamente.

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

Retorna todos os dados, requer acordo comercial

Page 36: Microservices: Utilizando o Twitter como Plataforma

Streaming APIs: o que está acontecendo agora{"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: Microservices: Utilizando o Twitter como Plataforma

Anatomia de um 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 38: Microservices: Utilizando o Twitter como Plataforma

REST APIs permite executar ações e acessar o que já aconteceu

Page 39: Microservices: Utilizando o Twitter como Plataforma

Twitter APIMais de 100 endpoints

• Obter dados do Twitter ‣ GET /search/tweets

• Engajar usuários socialmente ‣ POST /statuses/update

Page 40: Microservices: Utilizando o Twitter como Plataforma

REST APIs permite executar ações e acessar o que já aconteceuTweets & 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

Mais: Users, Favorites, Direct Messages, Block/Mute, Followers, Lists, Trends, Geo…

Page 41: Microservices: Utilizando o Twitter como Plataforma

Customer Service

Page 42: Microservices: Utilizando o Twitter como Plataforma

Mais tweets

Tweets diretos para empresas B2C

Page 43: Microservices: Utilizando o Twitter como Plataforma
Page 44: Microservices: Utilizando o Twitter como Plataforma
Page 45: Microservices: Utilizando o Twitter como Plataforma

Apps Mobile

Page 46: Microservices: Utilizando o Twitter como Plataforma
Page 47: Microservices: Utilizando o Twitter como Plataforma

CRASHLYTICS DIGITS MOPUB TWITTER KITANSWERS

Page 48: Microservices: Utilizando o Twitter como Plataforma

Recursos úteis

Page 49: Microservices: Utilizando o Twitter como Plataforma

PHP Libraries

Page 50: Microservices: Utilizando o Twitter como Plataforma

Links

• https://dev.twitter.com/ • https://apps.twitter.com/ • https://github.com/twitterdev

Page 51: Microservices: Utilizando o Twitter como Plataforma

#Obrigada@jchahoud

@TwitterDevBr