diff --git a/README.md b/README.md index 29b71de6..18a501d0 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,7 @@ To secure your webpage, you only have to set the `ITC_TOKEN` environment variabl - `ITC_CLOSED_TEXT` Set this text to temporary disable enrollment of new beta testers - `RESTRICTED_DOMAIN` Set this domain (in the format `domain.com`) to restrict users with emails in another domain from signing up. This list supports multiple domains by setting it to a comma delimited list (`domain1.com,domain2.com`) - `FASTLANE_ITC_TEAM_NAME` If you're in multiple teams, enter the name of your iTC team here. Make sure it matches. +- `SLACK_WEBHOOK_URL` If you want boarding to sent you a notification about a new tester using slack enter a Slack WebHook URL here ## Custom Domain diff --git a/app/controllers/invite_controller.rb b/app/controllers/invite_controller.rb index 8fe985dd..30f18a72 100644 --- a/app/controllers/invite_controller.rb +++ b/app/controllers/invite_controller.rb @@ -1,4 +1,5 @@ require 'spaceship' +require 'slack-notifier' class InviteController < ApplicationController before_action :set_app_details before_action :check_disabled_text @@ -92,6 +93,7 @@ def submit logger.info "Addding tester to application" app.default_external_group.add_tester!(tester) logger.info "Done" + notify_slack(first_name,last_name,email) end if testing_is_live? @@ -187,4 +189,13 @@ def testing_is_live? end return false end + + def notify_slack(first_name,last_name,email) + if ENV["SLACK_WEBHOOK_URL"] + notifier = Slack::Notifier.new ENV["SLACK_WEBHOOK_URL"], username: "Boarding Bot" + + notifier.ping text: "Added new tester to TestFlight App #{app_metadata[:title]}: #{first_name} #{last_name}", icon_emoji: ":airplane:" + end + end + end