Skip to content

rogerluan/app-store-connect-notifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

App Store Connect Notifier

Get those App Store Connect notifications delivered directly to Slack.

Latest Release Build Status Issues Follow on Twitter

View Demo · Report Bug · Request Feature


Intro

App Store Connect Notifier is a node.js app that fetches your app and build info directly from App Store Connect and posts changes in Slack as a bot. Since App Store Connect doesn't provide event webhooks (yet), these scripts use polling with the help of fastlane's Spaceship.

Preview

App Status

Build Status

Be notified when your builds are ready to be submitted!

Set Up

There are 2 versions of this service: a self-hosted version and a SaaS version — Statused.

While the self-hosted version is free, it requires you to host and maintain its server yourself. The SaaS version is a paid service, but it's fully managed and has a lot more features, such as support for Android apps, and a web dashboard to manage multiple apps, workflows, Slack channels, notification preferences, and more.

You can read more about the SaaS announcement here: #270

SaaS

You can use the SaaS version of this app, which evolved from this project, but eventually became a much more complete version of this simple tool. You can find out about it here:

Statused Social Banner

Forget about "When did release v2.1.3 go live again?" and "Is the app ready to be tested yet?"

Statused monitors App Store Connect and Google Play Store and sends you notifications about the status of your app release progress directly on Slack.

Learn more: statused.com

Self-hosted

If you prefer to host it yourself, you can follow the instructions below.

Prerequisites

You will need a Slack Bot to post updates on your behalf to your Slack workspace. If you still don't have one, check out this article on how to create a bot for your workspace.

Method 1: Heroku

Deploy

Method 2: Hosting Manually

Environment Variables

Be sure to set these to the appropriate values:

# Your App Store Connect username. Required when SPACESHIP_CONNECT_API_KEY is not used.
export ITC_USERNAME="[email protected]"

# Your App Store Connect password. Required if you're in a non-interactive environment. In interactive environments, it will ask for the password when executing and save it in Keychain.
export ITC_PASSWORD="your-app-store-connect-account-password"

# The [App Store Connect API key](https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api). Use this when on a non-interactive environment and you have 2FA set up. When using this, neither ITC_USERNAME or ITC_PASSWORD are used.
export SPACESHIP_CONNECT_API_KEY='-----BEGIN PRIVATE KEY-----
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxx
-----END PRIVATE KEY-----'

# The App Store Connect API Issuer ID. Required when SPACESHIP_CONNECT_API_KEY is used
export SPACESHIP_CONNECT_API_ISSUER_ID='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxx'

# The App Store Connect API Key ID. Required when SPACESHIP_CONNECT_API_KEY is used
export SPACESHIP_CONNECT_API_KEY_ID='xxxxxxxxxx'

# Optional: If you're in multiple teams, enter the IDs of your App Store Connect team here (comma separated).
export ITC_TEAM_IDS=132123123,456456456

# Comma-separated list of bundle identifiers of the apps you want these scripts to monitor. If this is not set, it will monitor all apps of your team.
export BUNDLE_IDENTIFIERS="com.apple.swift"

# Specify the channel you'd like the bot to post App Store Connect status updates. Don't forget to add the bot to this channel in Slack so it can post there. Required when BOT_SLACK_WEBHOOK_URL is not set.
export SLACK_CHANNEL_NAME="#ios-app-updates"

# Optional: Specify the channel you'd like the bot to post its uptime updates. Don't forget to add the bot to this channel in Slack so it can post there. If not provided, it won't post status updates. Not used when BOT_STATUS_SLACK_WEBHOOK_URL is set
export BOT_STATUS_SLACK_CHANNEL_NAME="#ios-bot-status-updates"

# The API token for your bot, provided by Slack. Required when BOT_SLACK_WEBHOOK_URL is not set.
export BOT_API_TOKEN="xoxb-123123123123-ASDASDASDASD-FGHFGHFGHFGH"

# The incoming webhook URL provided by Slack for your channel. When using this, SLACK_CHANNEL_NAME and BOT_API_TOKEN are not used.
export BOT_SLACK_WEBHOOK_URL="https://hooks.slack.com/services/XXXXXXXX/XXXXXXXX/XxxxXXXXXxxxxxxxxxxxx"

# Optional: Specify the incoming webhook URL for the channel you'd like the bot to post its uptime updates. When using this, BOT_STATUS_SLACK_CHANNEL_NAME is not used.
export BOT_STATUS_SLACK_WEBHOOK_URL="https://hooks.slack.com/services/XXXXXXXX/XXXXXXXX/XxxxXXXXXxxxxxxxxxxxx"

# How often the script should check for updates (in seconds). Required.
export POLL_TIME_IN_SECONDS=120

# How many builds do you want to track simultaneously? Defaults to 1, as you usually just want to track the latest build. Set to 0 if you're not interested in receiving status updates on the builds.
export NUMBER_OF_BUILDS=1

Method 3: Docker

Use environment variables similarly to Method 2

docker run \
  -e SPACESHIP_CONNECT_API_KEY="$(cat api_key.p8)" \
  -e SPACESHIP_CONNECT_API_ISSUER_ID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxx" \
  -e SPACESHIP_CONNECT_API_KEY_ID="xxxxxxxxxx" \
  -e BOT_SLACK_WEBHOOK_URL="https://hooks.slack.com/services/XXXXXXXX/XXXXXXXX/XxxxXXXXXxxxxxxxxxxxx" \
  rogerluan/app-store-connect-notifier:latest

Method 4: Docker Compose

Use environment variables similarly to Method 2

services:
  app-store-connect-notifier:
    container_name: app-store-connect-notifier
    hostname: app-store-connect-notifier
    image: rogerluan/app-store-connect-notifier
    environment:
      SPACESHIP_CONNECT_API_KEY: |
        -----BEGIN PRIVATE KEY-----
        xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        xxxxxxxxxxxxxx
        -----END PRIVATE KEY-----
      SPACESHIP_CONNECT_API_ISSUER_ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxx
      SPACESHIP_CONNECT_API_KEY_ID: xxxxxxxxxx
      BOT_SLACK_WEBHOOK_URL: https://hooks.slack.com/services/XXXXXXXX/XXXXXXXX/XxxxXXXXXxxxxxxxxxxxx
Install
bundle install
npm install
Store your App Store Connect password

You can use fastlane's CredentialsManager to store your password. Enter this command and it will prompt you for your password:

bundle exec fastlane fastlane-credentials add --username [email protected]
Using App Store Connect API

For more information on how to use SPACESHIP_CONNECT_API_KEY, SPACESHIP_CONNECT_API_ISSUER_ID and SPACESHIP_CONNECT_API_KEY_ID to skip 2FA authentication, check out Apple Documentation and Using App Store Connect API on fastlane.

Running
npm start

Or you can use the forever tool to keep it up indefinitely:

forever start src/poll-itc.js

Project Structure

fetch_app_status.rb

Ruby script that uses Spaceship to connect to App Store Connect. It then stdouts a JSON blob with your app info.

poll-itc.js

Node script to invoke the ruby script at certain intervals. It uses a key/value store to keep track of app status changes, and then invokes post-update.js once the status changes.

post-update.js

Node script that uses Slack's node.js SDK to send a message as a bot. It also calculates the number of hours since submission.

Troubleshooting

Why does my app hosted on Heroku reboots all the time?

Heroku does something called Dyno cycling at least once a day, and you can't prevent that from happening, unfortunately. Rebooting is fine, actually, except that you will lose all your database of app statuses that you collected since the last reboot. This means that we can't add nice features such as tracking the delta time between status changes (reliably) without persisting the information using an external service.

Vision

The long-term goal of this project is to retire itself once App Store Connect finally starts supporting webhooks.

Once the App Store Connect APIs support webhooks, if a 3rd party app is still needed to receive those webhooks and post to Slack (i.e. if Apple doesn't provide one), then this project will be updated to provide those features as well.

Credits

This app is heavily based on @erikvillegas's itunes-connect-slack. Most of the credit goes to him for figuring out the integration between ruby and javascript.

License

This project is open source and covered by a standard 2-clause BSD license. That means you have to mention Roger Oba as the original author of this code and reproduce the LICENSE text inside your app, repository, project or research paper.