// channels builds a list of channels the account + user have enabled. func (n *notificator) channels(p *doorbot.Person) []Notifier { var notifiers []Notifier if p.NotificationsChatEnabled { // HipChat if n.Config.Account.NotificationsHipChatEnabled { notifiers = append(notifiers, hipchat.New(n.Config.Account, n.Config.HipChat)) } // Slack if n.Config.Account.NotificationsSlackEnabled { notifiers = append(notifiers, slack.New(n.Config.Account, n.Config.Slack)) } } if p.NotificationsSMSEnabled { // Nexmo if n.Config.Account.NotificationsNexmoEnabled { if len(p.PhoneNumber) > 6 { notifiers = append(notifiers, nexmo.New(n.Config.Account, n.Config.Nexmo)) } } // Twilio if n.Config.Account.NotificationsTwilioEnabled { if len(p.PhoneNumber) > 6 { notifiers = append(notifiers, twilio.New(n.Config.Account, n.Config.Twilio)) } } } if p.NotificationsEmailEnabled { // Mailgun if n.Config.Account.NotificationsMailgunEnabled { notifiers = append(notifiers, mailgun.New(n.Config.Account, n.Config.Mailgun)) } // Postmark if n.Config.Account.NotificationsPostmarkEnabled { notifiers = append(notifiers, postmark.New(n.Config.Account, n.Config.Postmark)) } } return notifiers }
// AccountCreated sends an email to Doorbot func (n *notificator) AccountCreated(a *doorbot.Account, p *doorbot.Person, password string) { en := mailgun.New(a, n.Config.Mailgun) go en.AccountCreated(p, password) }