Skip to content

Commit

Permalink
Notify slack about a new tester signing up
Browse files Browse the repository at this point in the history
  • Loading branch information
plaetzchen committed Apr 24, 2017
1 parent 7537b3d commit 22ea24b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 11 additions & 0 deletions app/controllers/invite_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'spaceship'
require 'slack-notifier'
class InviteController < ApplicationController
before_action :set_app_details
before_action :check_disabled_text
Expand Down Expand Up @@ -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?
Expand Down Expand Up @@ -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]}: #{email} - #{first_name} #{last_name}", icon_emoji: ":airplane:"
end
end

end

0 comments on commit 22ea24b

Please sign in to comment.