I previously talked about the importance of automating what you can at your startup. This frees up valuable time to work of what really matters and focus your attention. It can also help prevent mistakes resulting from human error. In this post, I will show you how to automate your beta signup and distribution process. The tutorial will use Node.js and Express.js. If you don’t already have those installed, I would recommend that you do that before going any further.
It is highly beneficial to use a framework for beta testing. You can package it with your app and get detailed crash reports sent back to you. For this tutorial, we will be using Crashlytics. After you register for an account and build your app, be sure to get a distribution link. This allows your app to be downloaded directly.
There are a few different email API services out there. We chose Mailgun over Mandrill because they have free tier. You will need to register an account with them and set up a domain. This will allow the emails to be sent automatically to your testers.
Now we get to the meaty part. This assumes that you already have a client side signup form that can make an AJAX call to the server. This is very easy to do and quickly learned if you don’t know how to do it.
First, we will setup an simple Express app with a “signup” endpoint. All signup requests will go to this endpoint via the AJAX call. The server will then take care of all of the logic needed for a tester to signup and get your app. We will fill the logic in section by section.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Filling It All In
Get Name and Email
First, we will need to get the name and email of the tester. This is very simple and can be accessed via the request’s body.
Insert into Database
I have skipped this part since I wanted to keep the focus on the automation aspect. You simply insert the user’s name and email into the whichever database you are using. I will leave this as an exercise for the reader.
Next, we need to construct the message we will be sending to the tester. The tester’s email and name (to make it more personal), and the distribution link will need to be included. Here, we use HTML for the email body. I found it a bit more expressive than plain-text. Plain-text is an option and you can visit the Mailgun documentation to learn more.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
Finally, the message needs to be sent. We pass the
send() function our message data. Mailgun will then attempt to send the message. If there is an error, we can display the error page to the user. If the message is successfully sent, we can send a message back to the client telling them they successfully signed up and will be receiving the app. This can be put into an alert box that is displayed. This can also be done when there is an error. You also have the option of rendering a new page letting the tester know they successfully signed up.
1 2 3 4 5 6 7 8 9 10 11
The Final Product
Then we put it all together. We now have an automated beta signup and distribution system. This can also be easily integrated into an existing express app.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60