Image for post
Image for post

Hacking TestFlight Invites

Brian Donohue
Jan 14, 2015 · 3 min read

Beta distribution on iOS has always been a pain in the ass. At the end of 2010, TestFlight launched a solution that made iOS beta distribution considerably less painful. TestFlight provided a platform that allowed developers to manage a set of beta testers, upload beta versions of their apps, distribute those betas to the testers, and manage feedback from beta testers. TestFlight was a godsend for iOS developers.

Even with TestFlight, beta distribution on iOS was far from perfect. It was still cumbersome to manage testers’ devices properly, and developers were still subject to Apple’s 100 device per year limit. Apple obviously understood that beta distribution was still an area that needed lots of improvement because they acquired TestFlight in early 2014, and launched an official TestFlight integration in October 2014.

We beta tested Instapaper 6.1 using Apple’s TestFlight integration, and it’s incredibly well done. The new integration solves a lot of the pain points that the original TestFlight couldn’t address. Developers no longer have to manage a list of tester’s iOS devices, the 100 device limit was changed to a 1,000 user limit, and the entire process is more streamlined and straightforward. However, the old TestFlight did one thing much better than the new TestFlight integration: user invites.

Image for post
Image for post
Old TestFlight recruitment page

With the old TestFlight you could manually add users via email, but TestFlight also gave you a URL that you could share anywhere in order to recruit beta testers for your app. With the new TestFlight you only have the option to add testers via email, or bulk inviting testers by uploading a CSV file with email addresses.

Image for post
Image for post
New TestFlight invite page

Munging CSV files and manually entering email addresses is a hassle, and a big step back from the days of “Want to beta test? Sign up here!” I wanted to make recruiting beta testers for Instapaper easy again by allowing people to visit a URL, sign up for beta testing, and have their information automatically entered into Apple’s new TestFlight solution.

Research & Implementation

So I started by adding a tester in iTunes Connect and inspecting the page’s network requests to find the API call & payload Apple is expecting when adding a new tester to TestFlight:

Image for post
Image for post

Pretty straightforward. The next step was to figure out how to programmatically login to iTunes Connect, and manage the authorization cookies in the above request. Luckily, that problem had already been solved! I found a great script written by Kirby Turner that programmatically downloaded app sales data from iTunes Connect by first logging the user in, and then performing the necessary web requests. Jackpot!

Making it Usable

Once I modified the appdailysales.py script to successfully add a new user to TestFlight, I basically just needed to set up a page for Instapaper users to submit their email address & name (optional), and integrate my testflight_invite.py script into our code base. I’m pretty happy with the result:

Image for post
Image for post

I’ve put the code up on GitHub in case you’re interested in playing with it or scaffolding your own TestFlight invite page.

Oh! One more thing! If you want to help beta test Instapaper on iOS you can sign up here!

Edit: Within 5 hours we had 326 beta testers signup and the invite page is now closed!

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store