Welcome to the A-list

Note (5/31/2013): Recently, this app was featured in Lifehacker. Kindly note that this app is still in beta and there are probably many bugs that have yet to surface themselves (one such obvious one is checking in multiple passengers, as I wrote this for me and my buddies and didn’t have children to buy tickets and for whom to check-in). If you do run into any issues or have any feedback, feel free to tweet at me @andyjiang or comment on this blog post and I will make a note of it.

———————————

Recently, a conversation over dinner about personal life hacks without the direct intention of blatant commercialism spawned a neat idea that scratches an itch that us west coast jet setters face occasionally—not only just checking into Southwest flights, but also checking into those flights as early as possible to attain a highly coveted ‘A-list’ boarding group.

There have been too many times when the 24 hour period prior to the flight occurs when I’m away from my computer. This web application, however, will check into your Southwest flight for you.

Instead of going to a website where you input the information necessary for you to check in (name and confirmation number), you now can you just forward your Southwest flight confirmation email (the one with the subject that says ‘Your trip is right around the corner!’) to sw@to.andyjiang.com. Then, when the 24 hour check in window opens up, the web application will check in to the flight for you.

How does the app work?

The Mandrill (hosted by Mailchimp) server receives an inbound email and sends a POST request to the web server. The web server then extracts the text from the body of the email from the POST request and runs several regular expressions on it to get the following pieces of information: first name, last name, confirmation number, your email address, the URL it needs to go to in order to check in for you. It saves this data into a Mongo database (MongoHQ add-on with Heroku).

An hourly task runs on the server (Heroku Scheduler) to look at all of the records in the mongo database; for each record, if it is time to check in, the web server  uses the Mechanize library to get and parse the HTML of the confirmation web site, fill in the required information, and check in for you. Then it takes your boarding group and boarding position and sends you a confirmation email.

Tools I used

Since debugging is 90% of any project, it is important to learn to break the project into small, achievable goals, to quickly isolate problems and to iterate through working solutions. Below is a list of some of the tools I used to test quickly and build out the application.

RubularRegular expressions were critical to parsing the body of the inbound email. This nifty website allows you to test all of your regexp patterns against Strings of your choice. Combined with IRB and .class?, you can very quickly determine the right commands to extract the information needed from the text.

LocaltunnelLocaltunnel, hosted by Twilio, allows you to expose an endpoint on your local server to receive HTTP requests from other servers. This is important when you are using a service that will send you webhooks (Twilio, Mandrill inbound emails, etc.), so you don’t have to push your changes to a production server in order to test whether your app correctly processes the POST request to your endpoint. With Localtunnel, you just follow the instructions on the site, copy and paste the localtunnel URL/endpoint generated (tied to your local server), and provide it to the web service so it knows the address to send its request, thereby allowing you to test locally.

View Elements in Developer Tools: In Chrome (Firefox and Safari, also), you can view the HTML document of each page you are on by going to View > Developer > Developer Tools (or Option + Command + I). This is important when you are using Mechanize, which allows you to parse HTML given the HTML element, id, class, name, etc. I would test code by using IRB, initialize a Mechanize object, open up the browser, and navigate the web from the terminal.

Conclusion

Feedback is always welcome. If you think you are going to forget to use this next time you fly Southwest, go into your Gmail account right now and set up an instant email forwarding. Go to your Gmail’s Settings > Forwarding and POP/IMAP > Forwarding, then select Add a Forwarding Address. Type in “sw@to.andyjiang.com” and send the verification email that will contain the confirmation code.

Forwarding and POP/IMAP > Forwarding to set up a new email address to auto forward your Southwest itinerary emails" class /> Go to your Gmail's Settings > Forwarding and POP/IMAP > Forwarding to set up a new email address to auto forward your Southwest itinerary emails.

Forwarding and POP/IMAP > Forwarding to set up a new email address to auto forward your Southwest itinerary emails” class /> Go to your Gmail’s Settings > Forwarding and POP/IMAP > Forwarding to set up a new email address to auto forward your Southwest itinerary emails.

You will receive shortly an email that will provide you with the confirmation code that you can enter in the above field. The return email will also include a link that you can just click on to verify and confirm sw@to.andyjiang.com as the new forwarded email address.

The generated email with your confirmation code to verify the auto forwarding email address

The generated email with your confirmation code to verify the auto forwarding email address

Once you confirmed the email address to allow you to auto forward to it, then you will have to set up the filter for the right emails to be auto forwarded. Click on the link in the tip ‘You can also forward only some of your mail by creating a filter!’ and then either copy and paste “from:southwest subject:(Your trip is around the corner)” into your Gmail search bar or use the template in your ‘Show Search Options’ drop down below.

Setting up autoforward for any Southwest itinerary emails to sw@to.andyjiang.com

Setting up autoforward for any Southwest itinerary emails to sw@to.andyjiang.com

Creating the filter to auto forward specific emails to sw@to.andyjiang.com

Creating the filter to auto forward specific emails to sw@to.andyjiang.com

 

 

 

 

 

 

 

 

 

 

 

 

That should set it up so that any future email from Southwest with that particular subject will be automatically forwarded to my web app, which should hopefully check you in so you won’t have to sit in the back between the two fat, sweaty guys.

I will blog more about the actual code in future posts.

If you have any questions, please let me know!

Andy

[EDIT]: Please note that this is still not 100% battle tested, but it will improve over time the more emails it receives! Thanks, everyone!

Advertisements
Tagged , , , , ,

55 thoughts on “Welcome to the A-list

  1. connie jiang says:

    very cool, great job!

  2. David says:

    This is pretty genius. What would it take for you to adapt the code so it can support other airlines, like United?

    • Andy Jiang says:

      Not sure what the workflow is like for United or other airlines. But it would probably be a whole new unique set of Regex and HTML parsing to input the right fields and submit them.

  3. PB says:

    Is there a way to enter this manually? Sometime I get my reservations through a third party site and don’t get an email from southwest.

  4. Adam says:

    Neat idea and good luck avoiding the WN legal team. If I recall there was another website out there once that did something similar before WN figured out they could charge people more for Biz Select and for automatic check-in.

  5. Ankush says:

    You should make this open source so that people can help make it better and keep it up if you get too much traffic!

  6. shyamuw says:

    Andy,

    I forwarded an itinerary with 2 people in it and the auto acknowledgement email addressed it to the first name of one person and the last name of another person.

    Will both be checked in or only one?

    • Andy Jiang says:

      I didn’t think through all of the edge cases, but this is something I will add in the near future. I’d check yourselves in manually in _just in case_ 🙂

  7. Jeff says:

    This is awesome! Great work.
    Can it handle reservation emails for multiple people, or does the regex just pick off the first name? I can send you an example if you’d like something to work off of.

    • Andy Jiang says:

      Hey Jeff, thanks. I didn’t plan for it to handle reservations for multiple people (I made this for myself and some friends really). There are some submissions that include more than one people and I will be working to make sure that it works for them.

      • Jeff says:

        As a quick workaround, I took the email with multiple people and forwarded it again after deleting the first person in the list. I got a confirmation for the second person that time.

  8. This is fantastic … I always set a reminder to check in 24 hrs ahead of time, but always miss the window. This is perfect. Another + for open sourcing.

  9. Does it check in every passenger if you purchased multiple tickets at once?

  10. Ann says:

    Hi Andy-

    This is so cool! If there is more than one person traveling, will forwarding the email actually “check-in” for all the people listed in the reservation?

    Thanks.

    Ann

  11. reno says:

    Can this handle checking in multiple passengers from the same email? I just forwarded a confirmation email for two passengers and got two identical auto-replies each addressed to a mix of the two passenger names, [FIRST NAME OF PASSENGER 1] [LAST NAME OF PASSENGER 2]. Is this just a kink in the auto-reply or will the app attempt to check in this fictitious passenger (twice)?

    Thanks for the help. This is a brilliant app!

  12. W says:

    Good luck with this, heh! You will never beat a true A-List or A-List preferred member. Those Px are quasi-checked in before the 24 hour window. It’s mighty claim you can get someone the A position. On one of my commuting routes, the entire A group and early B group are A-List members – Southwest system sophisticated enough these days, you can’t can’t get people ahead, unless you hacked their system.

    • WallE says:

      I think it’s pretty obvious the developer is not saying this app will put you ahead of A-List members auto-checked in. The point is that it checks you in at the 24 hour mark, which, ideally, gets you a lower seating assignment than you would checking in manually. No reason to be so defensive or negative about his work.

  13. […] all goes right, you’ll get a boarding pass in the A group. But as the developer, Andy Jiang, pointed out this morning, the service is in its infancy, and there are going t… [Read […]

  14. […] all goes right, you’ll get a boarding pass in the A group. But as the developer, Andy Jiang, pointed out this morning, the service is in its infancy, and there are going t… [Read […]

  15. Mark S says:

    will this also work for the other SWA company AirTran?

  16. Gary says:

    My wife and I have separate confirmations. We sent both in. She got acknowledgement but I did not, however it listed her flight TO our destination (last week) instead of our return flight FROM our destination (tomorrow).

    • Andy Jiang says:

      Thanks for the comment. There are still some bugs that I am trying to sort out, so I would recommend checking in manually just to be safe. Thanks again and safe travels!

  17. Marty says:

    Years ago I was commuting to Seattle weekly during the deepest part of the “recession.” SWA one-way price was down around $40 from OAK. I too had no desire to sit between a couple of line-backers and oozed out some gray-matter to write a bit of code myself. Later, I qualified for A-list for a year and didn’t really need it.

    One item that perplexed me was that I would never get a seat below A-15. I finally discovered that those are even more “privileged” than standard A-listers 🙂

    Thanks for the link! I’ll try it out, now that I finally have a job again, despite being over 40.

    Marty

  18. Pat W says:

    I book my travel through a corporate site and do not receive confirmation e-mails directly from Southwest. Can you send me a sample e-mail from Southwest so I can enter my own data in the proper places and use your tool? Thank you!

  19. This app may help forgetful people or those away from their computer at the “T minus 24 hour” mark. But I don’t see how it would necessarily help anyone else. Every time I’ve used SW, I’ve had the check-in page loaded at the 24 hour mark, quickly filled in my info, and clicked “submit”. I’m sure my request landed within 5 seconds of the window opening, yet I’ve always gotten the end of the “A” group or the “B” group. I suspect there’s something going on, like SW keep some A places “on hold” for a while. Sometimes, after I check-in, I get an email saying, “Hey, we can get you a better boarding position for just $XX”.

  20. sduds says:

    The description says the Heroku Scheduler runs hourly. Is this correct? Does it check everyone in on the hour or at the correct minutes past the hour for your individual flight?

    • Andy Jiang says:

      It checks everyone in on the hour. If the flight is 9:05pm, it’ll check that flight in at the following hour, which is 10:00pm. Any suggestions to improve the check in time? I was wary of running scheduler all the time. I could setup a second node.js server that sends cronjobs at a smaller interval.

  21. S B says:

    This didn’t work for me, I got a confirmation email that I was signed up for this, but it did not check me in

    • Andy Jiang says:

      What is the email you used to check in? There will be bugs here and there, as I probably haven’t anticipated nearly half of all the edge cases. I’d be happy to take a look at your specific case to see if I can fix it for future iterations. Thanks for trying the service and for the heads up!

  22. Dan says:

    My confirmation email from a Southwest flight purchase had the Subject Line:

    Southwest Airlines Confirmation…

    Will forwarding this one to your address work as well?

  23. Wess says:

    What are the privacy issues related to this app? It seems like having all that flight information could prove problematic. I do love the idea.

    • Andy Jiang says:

      I should probably include a line stating that you will be giving up your flight details to me and only me, but the benefit of not having to remind yourself to check into the flight.

  24. Adam says:

    Hey Andy,

    Flight out worked, B44, so not too bad, and certainly easier than doing it myself.

    Return flight no go, now I pay the C-group price, no biggie if a bit less than ideal. Perhaps my case can help you refine the system, though, let me know!

    • Andy Jiang says:

      Hey Adam,

      Thanks for trying out the A-list (yes, a bit of a misnomer). It appears that 1) sometimes people pay the $13 for an early check-in and 2) the app checks in on the next hour (so if your flight is at 8:10, then you would get checked in at 9).

      There are ways to run the check in routine in smaller increments than by the hour, but since I do have a full time job, it will probably be a while until I get to it 🙂

      • Adam says:

        Thanks for your reply Andy,

        My comment must not have been clear. By “no go” I meant the script never ran for my return flight. I manually checked in for that many hours later when I realized before bed I hadn’t gotten a confirmation like I had for the outbound flight.

      • Andy Jiang says:

        Oh interesting. Was there not a separate ‘Your trip is around the corner’ email for the return leg of the trip?

      • Adam says:

        There was… I hadn’t set up an auto forward of those emails, though. It never occurred to me it would need both since they are identical. I’m guessing my assumption was wrong?

      • Andy Jiang says:

        I see; unfortunately, you would have to forward the second email in order to get checked in to the return leg of the flight.

        I probably should make that clear somewhere! Thanks again.

  25. Detox says:

    I believe I checked out another post like this one in before. It seemed to be the exact same material and is just as well written.

  26. James Reid says:

    Hi Andy,

    I just found this. Is your application still active?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: