Switchfly Fedex Day Projects: Facebook integration, Passbook Integration

My company, Switchfly have events called FedEx days, which basically means we set aside 24 hours for employees to work on whatever project they wanted given that it provides some business value to our application.

Fedex Day 1:
So, I joined with a few other engineers and business people to create Facebook sharing and liking for hotels and itineraries.
So, after 24 hours of toiling, we had a few mockups to present.

Facebook Like for Hotels
Facebook’s Like feature relies heavily on the Graph API, and the most difficult part of implementing this is due to FB having to have a public, static, unique URL for every page that you want to link Like with. Since our hotels are generated with a random key, this proved quite difficult, and in addition, FB like requires heavy use of metadata tags, which have to be inserted into the body. The problem is that the info required for the metadata, such as the Hotel name, Hotel description, is available only after the page renders, and inserting meta tags dynamically into the head of the page breaks the Like feature. So, using PHP or Coldfusion, the page has to grab info from the shared database at page render time, so that the meta data exist in the source, and publicly pingable by FB. So our mockup looks like this:

Liking hotels using FB API
Liking hotels using FB API

Meta data on the page looks like this:

<meta content="Sheraton Vistana Resort" /><meta content="hotel" /><meta content="https://airbnb.com/show_hotel_details.php?page=sheraton_vistana_resort" /><meta content="The all villa resort in Lake Buena Vista rests on 135 acres of waterfalls fountains and tropical landscaping. Each one and two-bedroom spacious vacation villa boasts a fully equipped kitchen with appliances amenities and all accommodation necessities. The resort does not charge additional person or resort fees. Guests may enjoy free parking wireless internet access and daily scheduled transportation to all four Walt Disney World® Theme Parks. Local attractions include SeaWorld Walt Disney World® Resort Universal Orlando® Resort and the Orange County Convention Center. The airport is only 13 miles away.The resort features 7 heated outdoor swimming pools 5 kids' pools 13 tennis courts 3 fitness centers spa services basketball and volleyball courts and its own Market Place where you may find souvenirs groceries Boars Head Deli and even Starbucks Coffee. Additional amenities include an 18-hole miniature golf course room service video arcades 6 restaurants including the KFC Express A&amp;W Express and Pizza Hut Express at the newly built Fountains Food Court and two bars.FL Resident Rates--Proof of residency will be required at check in. Failing to provide proper Identification at check-in will default reservation to best available rate of the day." /><meta content="8800 Vistana Centre Dr" /><meta content="Orlando" /><meta content="FL" /><meta content="32821" /><meta content="USA" /><meta content="http://d2whcypojkzby.cloudfront.net/imageRepo/1/0/24/953/468/30783_F.jpg" /><meta content="Switchfly" />

This will share this hotel or send your friends a message telling them what hotel you are looking at.

Facebook Share your Trip
So, we also have FB sharing your trip after you make a booking. This is done via simple facebook API functions, and currently sends a link on FB that leads to the same hotel/flight search that you did, but if we were to expand it, it could look something like this:

Facebook Trip Sharing
Facebook Trip Sharing

Basically, we want to be able to make custom objects and custom actions using Graph API to post information about your itinerary to your friends. You can see what friends are on your flight, and change your flight plan, book a hotel, change a reservation, or rent a car using the post. Anyways, for 24 hours, building these two proof of concepts have been pretty fun, and I someday hope to implement these features in full.

Fedex Day 2:
For Fedex day 2, we decided to make Passbook integration for our itineraries. I was the only engineer on this project this time around (and again toiled for 24 hours).

Passbook Generation
So, Passbook is an Apple application, and in order to integrate with Passbook, you need to be an Apple dev with provisioning to generate a Passbook id for integration. This part was kind of confusing because of the way how certificates and certificate requests were set up. But after looking at the Passbook documentation, I managed to generate some sample passes for our app.

Amex Switchfly Air Passbook
Amex Switchfly Air Passbook
Amex Switchfly Hotel Passbook
Amex Switchfly Hotel Passbook

Integrating with the application

Passbook and SMS Integration
Passbook and SMS Integration

Integration with the application was more difficult. Firstly, the SMS service I wrote (to send users links to their booking confirmation) integrated well with Twilio, and that API was fairly straightforward to set up (Kudos to Twilio), the limiting factor I found being the 160 char limit on SMS texts and the trial account. Secondly, the passbook service was more difficult. Basically, I had to capture the information on the page into json, and ajax it over to our coldfusion/sitebricks endpoint so that we can make use of it. Unfortunately the signing of the pass required a cryptographic algorithm which Apple doesn’t help you with. I had to use Jpasskit, a third party library to help me with that. Even then, the main issues I ran into were:

1) Passbook only contains limited space on the front. Doesn’t even have enough room to put a roundtrip flight, let alone flight + hotel.
2) Each passbook needs to be signed by a certificate which has a keystore and a password from somewhere on the server.
3) Our context and encoding filters prevent .pkpass from being distributed.
4) Even if it was working, only Mac OS and iOS users would be able to make use of it (via email or Safari).
5) Not sure how I could get the SSL Handshake with Apple’s restrictions working.

So because of these issues, not sure if this will make it to prod, but it was a good learning experience nonetheless.

  • Neida Uyeno

    FedEx Corp. acquired privately held Kinko’s Inc. in February 2004 and rebranded it FedEx Kinko’s. The acquisition was made to expand FedEx retail access to the general public. After the acquisition, all FedEx Kinko’s locations exclusively offered only FedEx shipping.”

    Our very own web portal
    <http://caramoan.ph/