Arthur Chang

Entrepreneur, Software Engineer, and Photographer
Feb 17

A few Superfeedr API tricks

Bloggers love being promoted inside apps like FanPulse!  We also love it when we can depend on some awesome people to write great sport posts to help people keep up with their favorite teams and games.  The problem is, lots of infrastructure needs to be put together on the backend to support the synchronization of our algorithms with the premium content from blogs and news sources.  Superfeedr fortunately has some tricks for me to automate the process of adding and removing sources on the fly.

When a new source is added to our database, I fire off an after filter that subscribes Superfeedr to that feed.  When the source is destroyed, I also unsubscribe with Superfeedr.  The API makes it super easy.  Here are some examples from FanPulse's Rails framework:

Adding a feed to Superfeedr to subscribe to:

I have a few constants in there that are specific to our app.  

  • SUPERFEEDR_URL = 'http://superfeedr.com/hubbub'
  • SUPERFEEDR_LOGIN = my_superfeedr_login_name
  • SUPERFEEDR_PASSWORD = my_superfeedr_password
  • SUPERFEEDR_CALLBACK = my_servers_callback_method

I'm using the RestClient gem by adamwiggins to make the calls, as you can see it's pretty darn easy.  "hub.topic" is the url for the feed,  "hub.callback" is the url I want future feeds to be pushed to using webhooks as well as subscribing internally, "hub.verify" should be set to sync since we're not doing an asynchronous call, and lastly "hub.mode" is set to subscribe since we want to add this new feed.

There are a few slight subtleties I did not mention, including the fact that your callback has to implement the basic PubSubHubbub subscribe / unsubscribe spec as usual.  That will have to be in another discussion though.

Lastly, if you want to destroy the source from your database, just make sure you hit the Superfeedr API to unsubscribe the feed as well.

Hope that helps!  Big thanks to Julien for all the support and help getting FanPulse running smoothly with the awesome Superfeedr.

About Arthur Chang

Life
I live in the San Francisco Bay Area and love to surround myself with friends and family. I'm a technology geek with an obsessive startup mentality, a photography nerd, and love to play sports (basketball, tennis, and more).

Startups
I am an entrepreneur with a background in software engineering. Most notably, I founded a company in 2009, Fanvibe.com, backed by investors including Y Combinator, which was acquired in 2011 by beRecruited.com. I am now the Lead of Product and Engineering (fancy title) of beRecruited.

Hacks
I graduated from UC Santa Barbara's College of Engineering with a B.S. in Computer Science in 2005. I've been developing and designing products in web and mobile platforms with large corporations and many of my own startups. I'm obsessed with disruptive apps, cutting edge tech, social game mechanics, social network development, software security, and all things code.

Photography
Photography is one of my biggest passions. Historically, it has been a hobby of capturing stories within still images. I photograph weddings, engagements, travel destinations, landscapes, various events, and many good cause events as a volunteer.

I shoot with a iPhone 4S and various Nikon SLR gear. I'm available to shoot events, weddings, and engagements. I am also always happy to volunteer my time to photograph good cause events.


TwitterFacebookmetaweblog

Search Blog

Get Updates

Tags

Archive

2012 (8)
2011 (20)
2010 (41)
2009 (83)
2008 (2)