In this post I want to share a script that I wrote to parse through the iTunes Connect Test Flight external user test to determine which users have been notified of my new app build but who have not installed. The goal is to gather up the list of those users and re-create a new comma separated file for upload. This will cause all those users to be re-notified and will hopefully lead to more downloads of test builds.
Note: This script requires you install node.js to work.
Step 1: Get users into a users.txt file.
Log into iTunes connect, click on my apps, click on your app name, visit the test flight section, click on external testers. Highlight and copy/paste the list of users into a new text file called users.txt and place into a directory. The file should look similar to this screenshot below.
Step 2: In the same directory as this users.txt file copy and paste the following javascript file.
var fs = require('fs');
var lineReader = require('readline').createInterface({
input: require('fs').createReadStream('users.txt')
});
var date = new Date();
var day = date.getDate();
var monthIndex = date.getMonth();
var year = date.getFullYear();
var csvFile = 'notify_' + monthIndex + day + year + '.csv';
console.log('csvFile:' + csvFile);
fs.closeSync(fs.openSync(csvFile, 'w'));
var cnt = 0;
var fName = '';
var lName = '';
var email = '';
var notified = false;
lineReader.on('line', function (line) {
if (line != '') {
line = line.replace(',', '');
switch (cnt) {
case 0:
email = line;
break;
case 1:
var names = line.split(' ');
fName = names[0];
lName = names[1];
break;
case 2:
if (line === 'Notified') {
notified = true;
}
break;
default:
}
cnt = cnt + 1;
} else {
if (notified) {
var lne = fName + ',' + lName + ',' + email + '\n';
fs.appendFile(csvFile, lne, function (err) {
if (err !== null) {
console.log('err:' + err);
}
});
}
cnt = 0;
fName = '';
lName = '';
email = '';
notified = false;
}
});
Step 3: Run Script
Open up a terminal and go into the directory where the user.txt and the above script are found. (I called mine ReadFile.js).
Davids-MacBook-Air:itunes dbell$ node ReadFile.js
csvFile:notify_532016.csv
When you run the file it should produce a new notify csv file. View the file (I used cat) and you should see only those users listed who need to be notified again.
Davids-MacBook-Air:itunes dbell$ cat notify_532016.csv
Bob,Smith,bobsmith@outlook.com
Step 4: iTunes CSV Load
Go back into iTunes connect now where you copied out your users. Edit and remove each user manually who had only notified next to their name. You can use this new notify csv as a reference for who to remove. Then after they are removed use the add functionality to upload a csv file. Select your new csv file and then click on save.
In my next Javascript post I will use the same users.txt file to determine how many users have installed and what build and how many are only notified as a means to provide a statistic for your app.
Enjoy!