"Is this version done with App Store review?"
Startup Automation to Boost Productivity by 200% (Part 2)
"Is this version done with App Store review?" If you get this question a lot, you definitely need to read this post.
You can check your App Store review status through push notifications or emails from the Connect app. But when working as a team, you need a better way. Which version is currently deployed? When was the review submitted? If a review gets rejected, you need to respond quickly, and finding out late means a delayed response.
Let's build an automation that shares App Store review statuses directly to Slack. We'll be using a Cloudflare Worker and the App Store Connect API.
First, you'll need a Cloudflare account. It's free for up to 100,000 requests per day, so you won't have to pay a dime. All you have to do is hit Like on this post.
Creating a Cloudflare Worker
Cloudflare Workers is a service that provides serverless application functionality by running JavaScript code on Cloudflare's global network edge.
We'll use TypeScript, a Slack bot, and Cloudflare's Cron Triggers to ping the App Store Connect API every 10 minutes and send a Slack message if there are any changes. You won't actually need to code since we'll just be using an existing codebase.
We're going to use rocket-lite. You can fork it or just use it as is.
Log in to your Cloudflare account in the terminal and deploy rocket-lite.
git clone https://github.com/trilliwon/rocket-lite.git
cd rocket-lite
npx wrangler login
npx wrangler deployIt failed, right?
If you check the error message, it says it can't find a KV namespace. KV is Cloudflare's key-value data storage. We use it to save the latest App Store status under the key APPSTORECONNECT_TOKEN_STORE to prevent sending duplicate messages. So, we just need to create a KV namespace.
If you're using Cursor AI, it might be a good idea to try it like this.
You can create one using the command below in your terminal. That will give you an ID, as shown in the image below. Just update this ID in your wrangler.toml file.
npx wrangler kv:namespace create "APPSTORECONNECT_TOKEN_STORE"Let's try deploying again.
npx wrangler deployI assume it deployed successfully without any issues. We'll be using the URL printed in the console. Mine looks like this: https://rocket-lite.trilliwon-5e7.workers.dev/.
Creating a Slack App
Go to https://api.slack.com/apps/, click Create New App > From scratch, give your app a suitable name, and create it.
Now we need to connect the Slack App and the Worker. If you look at the Env.ts file, you'll see:
SLACK_SIGNING_SECRET
SLACK_BOT_USER_OAUTH_TOKEN
You need these two. Copy the Signing Secret from the Basic Information section on your Slack app page and add it like below. For the BOT_USER_OAUTH_TOKEN, use the one under OAuth & Permissions > Bot User OAuth Token.
npx wrangler secret put SLACK_SIGNING_SECRET
npx wrangler secret put SLACK_BOT_USER_OAUTH_TOKENInstalling the Slack App
Add Bot Token Scopes in OAuth & Permissions. I only selected these two, but you can always add more when needed. If you scroll up a bit,
There is an Install to {WORKSPACE_NAME} button. Just install it using this button and you're good to go.
Wait, we're not done. 😓
Select Event Subscriptions on the Slack app settings page. Here, you'll use the worker URL we made earlier.
Append slack/events to the end of the Cloudflare worker URL. Like this:
https://rocket-lite.trilliwon-5e7.workers.dev/slack/eventsOnce everything is complete, try tagging the Slack bot and talking to it. If it responds like below, you've succeeded.
Receiving App Store Review Status Alerts
If you look at the Env.ts file, there are 3 environment variables like below. Add these, and we're seriously done.
// Env.ts file
...
// App Store Connect
APP_STORE_KEY_ID: string;
APP_STORE_ISSUER_ID: string;
APP_STORE_PRIVATE_KEY: string;
...Log in to App Store Connect. Select the Users and Access > Integrations tab.
Copy the Issuer ID and add it using the command below.
npx wrangler secret put APP_STORE_ISSUER_IDGenerate an API Key with Developer access and add the secret value.
npx wrangler secret put APP_STORE_KEY_ID
...
npx wrangler secret put APP_STORE_PRIVATE_KEYOpen the downloaded AuthKey_{KEY_ID}.p8 file in a text editor, replace the line breaks with \n, and add it. Like this:
-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBBBBBBBBBB9AgEGCCqGSBBBAwEHBHkwdwIBAQQgUdON+clekkc9UMYc\nQgG/y7ovUxoq+WQHa03wMO0MO7WgCgYIKoZIzj0DAQehRANCAATTrVb0ymUm5b5t\nAXND4cMu0NElkjA2iC7nvYZZp5a2XxQ12fP0duFOkqtIW2xWEmJosBM0bS2xuwB8
K162pYAB\n-----END PRIVATE KEY-----If you receive a message like this, it's a success.
If you want to check the review status more frequently, try reducing the Cron Trigger time to 1 minute.
You just need to change the [triggers] section in the wrangler.toml file.
All the code is publicly available here.
GitHub - trilliwon/rocket-lite
Extending the Features
Creating a Slack app, deploying a Cloudflare worker, and running cron triggers just to get App Store review status messages seems like a lot, right? But once you've built a Slack bot, you can use it for all sorts of things. For example, you can easily build a feature that deploys to TestFlight or Firebase using slash commands in Slack. And sharing those results becomes incredibly easy.
In the next post, let's build a deployment process using Rocket-lite and the GitHub API.
Productivity Series
What are some things in life you feel are a waste?