SlideShare a Scribd company logo
1 of 11
Download to read offline
Progamming to the Twitter API
(ReTweeter)
Bar Camp Boston 3
May 18, 2008
John Eckman, jeckman@optaros.com
Agenda

  Twitter
  The Twitter API
  ReTweeter
  Lessons Learned
  Q&A




This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License   2
Twitter

  Lightweight micro-blogging platform
   • Short (<140) text messages to followers
   • River of updates from those you follow (friends)
  Some conventions:
   • d username = direct message
   • @username = reply
       – Unlike DMs, replies are public
       – User determines whether to see replies from
         folks not followed
   • #tag = hashtag (twemes.com, hashtags.org)
  Multiple modes of access
   • Mobile (SMS or Mobile Web)
   • Web Browser
   • Other Client (Using API)


This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License   3
The Twitter API

   Most access to Twitter is via the API
    • 10x more than the Web interface)
      (http://readwritetalk.com/2007/09/05/biz-stone-co-founder-twitter/)

      • Desktop clients like twhirl, twitterrific
      • Mobile clients TinyTwitter, PocketTweets, iTweet
   Well documented in Google Group
(http://groups.google.com/group/twitter-development-talk/web/api-documentation)

   Provides access to core data simply
    • XML, JSON data formats
    • RSS, ATOM syndication formats
   Basic http authentication where needed
   Rate limited
    • On reads (gets):
    • Unlimited writes (posts)


 This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License   4
The Twitter API: Basic Methods

  Status Methods:                                            User Methods:
     • public_timeline                                          • friends
     • friends_timeline                                         • followers
     • user_timeline                                            • featured
     • show                                                     • show
     • update                                                Direct Message Methods:
     • replies                                                  • direct_messages
     • destroy                                                  • sent
  Account Methods:                                              • new
     • verify_credentials                                       • destroy
     • end_session                                           Friendship Methods:
     • archive                                                  • create
     • update_location                                          • destroy
     • update_delivery_device                                   • exists




This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License   5
The Twitter API: Continued

  Favorite Methods:                                          Notification Methods:
     • favorites                                                • follow
     • create                                                   • leave
     • destroy                                               Block Methods
  Help Methods:                                                 • create
                                                                • destroy
     • test
     • downtime_schedule




This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License   6
ReTweeter

  Use the Twitter API to fake “group” functions
  Create a new “group” account
  Follow back folks who follow that account
  When those users tweet with a hashtag, repost that
  tweet so that all followers see it, prefaced with the
  username of the original poster
  Could have sent direct messages instead
  Hashtag could be the name of the account but doesn't
  have to be




This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License   7
ReTweeter Basic Flow of Code

   Whole thing runs on a cron job
      • Rate limiting – 70 requests in 60 minutes
      • Unlimited posting
   Get friends_timeline.xml
Returns the 20 most recent statuses posted in the last 24 hours from the
   authenticating user and that user's friends.
      curl -u email:password
        http://twitter.com/statuses/friends_timeline.xml
   Loop through posts in friends_timeline
      • Remove the group account itself (avoid loop!!)
      • Find all tweets in timeline beginning with hashtag
      • Put in database, with datestamp and id
   Pull all “un-retweeted” tweets from database
   Post those tweets, updating “retweeted” status as they
   post

 This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License   8
ReTweeter Code

  Time allowing, we'll look at the code
  Otherwise you can get it later:
     http://www.openparenthesis.org/code/twitter-api
  Open Source, GPLv3 license
  Uses:
     • PHP 5 (SimpleXMLElement rocks)
     • MySQL DB
     • cron or equivalent (scheduled command line invocation)
     • cURL




This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License   9
Lessons Learned

  Don't Test on the Live Account
     • Bad developer spams his followers
     • If they use SMS, this can have an actual financial cost in addition
       to annoyance
     • Thankfully people are forgiving, generally
  Use a desktop client like Twhirl
     • Multiple client support
     • Talk amongst yourselves
  Twitter will go down
     • Not if, but when
     • Handle errors gracefully
  Twitter can enable “auto-follow-back” for you
     • Sometimes following people fails for undetermined reasons
     • Since the group account can't follow them back they can't post!



This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License   10
Q&A

eckman.john@gmail.com
jeckman@optaros.com
http://twitter.com/jeckman


http://johneckman.com/ (lifestream, profile links)
http://www.openparenthesis.org/ (open source, web
  development, social applications)
http://www.goatless.org/ (travel, veganism, music)
http://www.optaros.com/user/jeckman (enterprise
  focus, how changes in the online industry affect
  Optaros clients and prospects)




This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License   11

More Related Content

What's hot

BMPR - February 2010 Tips & Tricks
BMPR - February 2010 Tips & TricksBMPR - February 2010 Tips & Tricks
BMPR - February 2010 Tips & Tricks
BMPR
 
Seo Wordpress Blogs
Seo Wordpress BlogsSeo Wordpress Blogs
Seo Wordpress Blogs
Ron Edrote
 
Jason Tucker Wordpress 3rd Party Web Services
Jason Tucker Wordpress 3rd Party Web ServicesJason Tucker Wordpress 3rd Party Web Services
Jason Tucker Wordpress 3rd Party Web Services
Jason Tucker
 

What's hot (20)

8 Most Common Joomla! Hacks and How to Avoid Them
8 Most Common Joomla! Hacks and How to Avoid Them8 Most Common Joomla! Hacks and How to Avoid Them
8 Most Common Joomla! Hacks and How to Avoid Them
 
Earn $3000+ with autoblogs using free traffic
Earn $3000+ with autoblogs using free trafficEarn $3000+ with autoblogs using free traffic
Earn $3000+ with autoblogs using free traffic
 
WordPress Standardized Loop API
WordPress Standardized Loop APIWordPress Standardized Loop API
WordPress Standardized Loop API
 
Bootstrap 3 in Joomla!
Bootstrap 3 in Joomla!Bootstrap 3 in Joomla!
Bootstrap 3 in Joomla!
 
Killer word press-checklist
Killer word press-checklistKiller word press-checklist
Killer word press-checklist
 
BMPR - February 2010 Tips & Tricks
BMPR - February 2010 Tips & TricksBMPR - February 2010 Tips & Tricks
BMPR - February 2010 Tips & Tricks
 
Seo Wordpress Blogs
Seo Wordpress BlogsSeo Wordpress Blogs
Seo Wordpress Blogs
 
Joomla 1, Joomla 2, Joomla 3 (Joomla Versions Explained)
Joomla 1, Joomla 2, Joomla 3 (Joomla Versions Explained)Joomla 1, Joomla 2, Joomla 3 (Joomla Versions Explained)
Joomla 1, Joomla 2, Joomla 3 (Joomla Versions Explained)
 
Beginning WordPress Plugin Development
Beginning WordPress Plugin DevelopmentBeginning WordPress Plugin Development
Beginning WordPress Plugin Development
 
Seo Wordpress Blogs
Seo Wordpress BlogsSeo Wordpress Blogs
Seo Wordpress Blogs
 
15 Most Common WordPress Errors and Solution
15 Most Common WordPress Errors and Solution15 Most Common WordPress Errors and Solution
15 Most Common WordPress Errors and Solution
 
Squarespace Site Shack Training -11-05-2015
Squarespace Site Shack Training -11-05-2015Squarespace Site Shack Training -11-05-2015
Squarespace Site Shack Training -11-05-2015
 
Comparing Blogger And Wordpress
Comparing Blogger And WordpressComparing Blogger And Wordpress
Comparing Blogger And Wordpress
 
Joomla! Plugin Development
Joomla! Plugin DevelopmentJoomla! Plugin Development
Joomla! Plugin Development
 
Mobile web design
Mobile web designMobile web design
Mobile web design
 
Blog and search
Blog and searchBlog and search
Blog and search
 
Joomla Tomorrow and Beyond
Joomla Tomorrow and BeyondJoomla Tomorrow and Beyond
Joomla Tomorrow and Beyond
 
Pr7 8 clubwear-and-party-wear
Pr7 8 clubwear-and-party-wearPr7 8 clubwear-and-party-wear
Pr7 8 clubwear-and-party-wear
 
MA Magazines: City Uni - Further Wordpress customisations, process and plugin...
MA Magazines: City Uni - Further Wordpress customisations, process and plugin...MA Magazines: City Uni - Further Wordpress customisations, process and plugin...
MA Magazines: City Uni - Further Wordpress customisations, process and plugin...
 
Jason Tucker Wordpress 3rd Party Web Services
Jason Tucker Wordpress 3rd Party Web ServicesJason Tucker Wordpress 3rd Party Web Services
Jason Tucker Wordpress 3rd Party Web Services
 

Similar to Programming to the Twitter API: ReTweeter

Insecure Implementation of Security Best Practices: of hashing, CAPTCHA's and...
Insecure Implementation of Security Best Practices: of hashing, CAPTCHA's and...Insecure Implementation of Security Best Practices: of hashing, CAPTCHA's and...
Insecure Implementation of Security Best Practices: of hashing, CAPTCHA's and...
amiable_indian
 

Similar to Programming to the Twitter API: ReTweeter (20)

Defeating Comment Spam
Defeating Comment SpamDefeating Comment Spam
Defeating Comment Spam
 
what is-twitter
what is-twitterwhat is-twitter
what is-twitter
 
Community 2.0 Community Bootcamp: the technology part by Tara Hunt
Community 2.0 Community Bootcamp: the technology part by Tara HuntCommunity 2.0 Community Bootcamp: the technology part by Tara Hunt
Community 2.0 Community Bootcamp: the technology part by Tara Hunt
 
Why HATEOAS
Why HATEOASWhy HATEOAS
Why HATEOAS
 
OpenID Intro @ Barcamp Brussels 3
OpenID Intro @ Barcamp Brussels 3OpenID Intro @ Barcamp Brussels 3
OpenID Intro @ Barcamp Brussels 3
 
Webspam (English Version)
Webspam (English Version)Webspam (English Version)
Webspam (English Version)
 
How To Integrate Social Media Into Your Wordpress Site
How To Integrate Social Media Into Your Wordpress SiteHow To Integrate Social Media Into Your Wordpress Site
How To Integrate Social Media Into Your Wordpress Site
 
Twitter Applications
Twitter ApplicationsTwitter Applications
Twitter Applications
 
Leveraging Twitter Tools for Maximum Use
Leveraging Twitter Tools for Maximum UseLeveraging Twitter Tools for Maximum Use
Leveraging Twitter Tools for Maximum Use
 
Gates Toorcon X New School Information Gathering
Gates Toorcon X New School Information GatheringGates Toorcon X New School Information Gathering
Gates Toorcon X New School Information Gathering
 
Citizen Happiness Workshop Part 2: The Building Blocks
Citizen Happiness Workshop Part 2: The Building BlocksCitizen Happiness Workshop Part 2: The Building Blocks
Citizen Happiness Workshop Part 2: The Building Blocks
 
Goodle Developer Days Madrid 2008 - Open Social Update
Goodle Developer Days Madrid 2008 - Open Social UpdateGoodle Developer Days Madrid 2008 - Open Social Update
Goodle Developer Days Madrid 2008 - Open Social Update
 
Seven Reasons for Code Bloat
Seven Reasons for Code BloatSeven Reasons for Code Bloat
Seven Reasons for Code Bloat
 
Futuropolis 2058 Singapore - OpenSocial, a standard for the social web
Futuropolis 2058 Singapore - OpenSocial, a standard for the social webFuturopolis 2058 Singapore - OpenSocial, a standard for the social web
Futuropolis 2058 Singapore - OpenSocial, a standard for the social web
 
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRF
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRFBe Afraid. Be Very Afraid. Javascript security, XSS & CSRF
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRF
 
Sourcer\'s Daily Dozen for ERE- Arbita JobMachine
Sourcer\'s Daily Dozen for ERE- Arbita JobMachineSourcer\'s Daily Dozen for ERE- Arbita JobMachine
Sourcer\'s Daily Dozen for ERE- Arbita JobMachine
 
Web 2.0 Expo
Web 2.0 ExpoWeb 2.0 Expo
Web 2.0 Expo
 
Twitter for Archivists
Twitter for ArchivistsTwitter for Archivists
Twitter for Archivists
 
Insecure Implementation of Security Best Practices: of hashing, CAPTCHA's and...
Insecure Implementation of Security Best Practices: of hashing, CAPTCHA's and...Insecure Implementation of Security Best Practices: of hashing, CAPTCHA's and...
Insecure Implementation of Security Best Practices: of hashing, CAPTCHA's and...
 
FOSDEM 2009 Thunderbird 3 talk
FOSDEM 2009 Thunderbird 3 talkFOSDEM 2009 Thunderbird 3 talk
FOSDEM 2009 Thunderbird 3 talk
 

More from John Eckman

Taking Back What and From Whom?: Imagined Communities and Role of WordPress i...
Taking Back What and From Whom?: Imagined Communities and Role of WordPress i...Taking Back What and From Whom?: Imagined Communities and Role of WordPress i...
Taking Back What and From Whom?: Imagined Communities and Role of WordPress i...
John Eckman
 

More from John Eckman (20)

Don't fear the block: Gutenberg is gettin' good
Don't fear the block: Gutenberg is gettin' goodDon't fear the block: Gutenberg is gettin' good
Don't fear the block: Gutenberg is gettin' good
 
#NoStalking: Advertising & User Privacy
#NoStalking: Advertising & User Privacy#NoStalking: Advertising & User Privacy
#NoStalking: Advertising & User Privacy
 
There's a Reason We Call Them Institutions: Working in Higher Education Witho...
There's a Reason We Call Them Institutions: Working in Higher Education Witho...There's a Reason We Call Them Institutions: Working in Higher Education Witho...
There's a Reason We Call Them Institutions: Working in Higher Education Witho...
 
Working the Open: Open Source in an Agency
Working the Open: Open Source in an AgencyWorking the Open: Open Source in an Agency
Working the Open: Open Source in an Agency
 
GDPR FTW, or, How I Learned to Stop Worrying and Love Privacy By Design
GDPR FTW, or, How I Learned to Stop Worrying and Love Privacy By DesignGDPR FTW, or, How I Learned to Stop Worrying and Love Privacy By Design
GDPR FTW, or, How I Learned to Stop Worrying and Love Privacy By Design
 
The Blob, the Chunk, & the Block: Structured Content in the Age of Gutenberg
The Blob, the Chunk, & the Block: Structured Content in the Age of GutenbergThe Blob, the Chunk, & the Block: Structured Content in the Age of Gutenberg
The Blob, the Chunk, & the Block: Structured Content in the Age of Gutenberg
 
Taking Back What and From Whom?: Imagined Communities and Role of WordPress i...
Taking Back What and From Whom?: Imagined Communities and Role of WordPress i...Taking Back What and From Whom?: Imagined Communities and Role of WordPress i...
Taking Back What and From Whom?: Imagined Communities and Role of WordPress i...
 
Gutenberg for Agencies
Gutenberg for AgenciesGutenberg for Agencies
Gutenberg for Agencies
 
Engaging in Digital: Sites for Non-Profits
Engaging in Digital: Sites for Non-ProfitsEngaging in Digital: Sites for Non-Profits
Engaging in Digital: Sites for Non-Profits
 
Dear Firstname Lastname: Personalization & Content Targeting
Dear Firstname Lastname: Personalization & Content TargetingDear Firstname Lastname: Personalization & Content Targeting
Dear Firstname Lastname: Personalization & Content Targeting
 
But Why? Use Cases for the REST API
But Why? Use Cases for the REST APIBut Why? Use Cases for the REST API
But Why? Use Cases for the REST API
 
WPDrama & The Four Agreements
WPDrama & The Four AgreementsWPDrama & The Four Agreements
WPDrama & The Four Agreements
 
Distributed, not Disconnected: Employee Engagement for Remote Companies
Distributed, not Disconnected: Employee Engagement for Remote CompaniesDistributed, not Disconnected: Employee Engagement for Remote Companies
Distributed, not Disconnected: Employee Engagement for Remote Companies
 
Disrupting Distribution
Disrupting DistributionDisrupting Distribution
Disrupting Distribution
 
Managing Clients without Going Crazy
Managing Clients without Going CrazyManaging Clients without Going Crazy
Managing Clients without Going Crazy
 
Stop Gathering Requirements - Start Defining Success
Stop Gathering Requirements - Start Defining SuccessStop Gathering Requirements - Start Defining Success
Stop Gathering Requirements - Start Defining Success
 
Client Diplomacy: From Adversaries to Allies
Client Diplomacy: From Adversaries to AlliesClient Diplomacy: From Adversaries to Allies
Client Diplomacy: From Adversaries to Allies
 
WordPress as a CMS Platform: Gilbane 2015
WordPress as a CMS Platform: Gilbane 2015WordPress as a CMS Platform: Gilbane 2015
WordPress as a CMS Platform: Gilbane 2015
 
WordPress and the Enterprise Disconnect
WordPress and the Enterprise DisconnectWordPress and the Enterprise Disconnect
WordPress and the Enterprise Disconnect
 
The Future of WordPress (and Your Role In It)
The Future of WordPress (and Your Role In It)The Future of WordPress (and Your Role In It)
The Future of WordPress (and Your Role In It)
 

Recently uploaded

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

Programming to the Twitter API: ReTweeter

  • 1. Progamming to the Twitter API (ReTweeter) Bar Camp Boston 3 May 18, 2008 John Eckman, jeckman@optaros.com
  • 2. Agenda Twitter The Twitter API ReTweeter Lessons Learned Q&A This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License 2
  • 3. Twitter Lightweight micro-blogging platform • Short (<140) text messages to followers • River of updates from those you follow (friends) Some conventions: • d username = direct message • @username = reply – Unlike DMs, replies are public – User determines whether to see replies from folks not followed • #tag = hashtag (twemes.com, hashtags.org) Multiple modes of access • Mobile (SMS or Mobile Web) • Web Browser • Other Client (Using API) This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License 3
  • 4. The Twitter API Most access to Twitter is via the API • 10x more than the Web interface) (http://readwritetalk.com/2007/09/05/biz-stone-co-founder-twitter/) • Desktop clients like twhirl, twitterrific • Mobile clients TinyTwitter, PocketTweets, iTweet Well documented in Google Group (http://groups.google.com/group/twitter-development-talk/web/api-documentation) Provides access to core data simply • XML, JSON data formats • RSS, ATOM syndication formats Basic http authentication where needed Rate limited • On reads (gets): • Unlimited writes (posts) This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License 4
  • 5. The Twitter API: Basic Methods Status Methods: User Methods: • public_timeline • friends • friends_timeline • followers • user_timeline • featured • show • show • update Direct Message Methods: • replies • direct_messages • destroy • sent Account Methods: • new • verify_credentials • destroy • end_session Friendship Methods: • archive • create • update_location • destroy • update_delivery_device • exists This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License 5
  • 6. The Twitter API: Continued Favorite Methods: Notification Methods: • favorites • follow • create • leave • destroy Block Methods Help Methods: • create • destroy • test • downtime_schedule This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License 6
  • 7. ReTweeter Use the Twitter API to fake “group” functions Create a new “group” account Follow back folks who follow that account When those users tweet with a hashtag, repost that tweet so that all followers see it, prefaced with the username of the original poster Could have sent direct messages instead Hashtag could be the name of the account but doesn't have to be This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License 7
  • 8. ReTweeter Basic Flow of Code Whole thing runs on a cron job • Rate limiting – 70 requests in 60 minutes • Unlimited posting Get friends_timeline.xml Returns the 20 most recent statuses posted in the last 24 hours from the authenticating user and that user's friends. curl -u email:password http://twitter.com/statuses/friends_timeline.xml Loop through posts in friends_timeline • Remove the group account itself (avoid loop!!) • Find all tweets in timeline beginning with hashtag • Put in database, with datestamp and id Pull all “un-retweeted” tweets from database Post those tweets, updating “retweeted” status as they post This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License 8
  • 9. ReTweeter Code Time allowing, we'll look at the code Otherwise you can get it later: http://www.openparenthesis.org/code/twitter-api Open Source, GPLv3 license Uses: • PHP 5 (SimpleXMLElement rocks) • MySQL DB • cron or equivalent (scheduled command line invocation) • cURL This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License 9
  • 10. Lessons Learned Don't Test on the Live Account • Bad developer spams his followers • If they use SMS, this can have an actual financial cost in addition to annoyance • Thankfully people are forgiving, generally Use a desktop client like Twhirl • Multiple client support • Talk amongst yourselves Twitter will go down • Not if, but when • Handle errors gracefully Twitter can enable “auto-follow-back” for you • Sometimes following people fails for undetermined reasons • Since the group account can't follow them back they can't post! This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License 10
  • 11. Q&A eckman.john@gmail.com jeckman@optaros.com http://twitter.com/jeckman http://johneckman.com/ (lifestream, profile links) http://www.openparenthesis.org/ (open source, web development, social applications) http://www.goatless.org/ (travel, veganism, music) http://www.optaros.com/user/jeckman (enterprise focus, how changes in the online industry affect Optaros clients and prospects) This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License 11