-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Slack Notifications for New User Registrations #413
base: main
Are you sure you want to change the base?
Conversation
…s also update env's
services/slack.go
Outdated
return nil | ||
} | ||
|
||
func contains(slice []string, str string) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sundayonah this should be moved to utils.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good so far. Wanted to know if you actually tested this Slack WEBHOOK with live credentials say via Postman and it worked?
…ize existing Contains function, and add new Slack webhook URL
services/slack.go
Outdated
|
||
// Log error if notification failed, but don't interrupt registration | ||
if resp.StatusCode != http.StatusOK { | ||
logger.Errorf("Slack notification failed with status: %d", resp.StatusCode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this error should be returned since it's handled in auth.go
…m/paycrest/aggregator into add-slack-notifications-on-signup
…m/paycrest/aggregator into add-slack-notifications-on-signup
controllers/accounts/auth.go
Outdated
// Assign providerCurrency from the first valid fiat currency | ||
if len(fiatCurrencies) > 0 { | ||
providerCurrency = fiatCurrencies[0].Code | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this code isn't needed... all currencies should be sent in the notification
controllers/accounts/auth.go
Outdated
if err := ctrl.slackService.SendUserSignupNotification(user, scopes, providerCurrency); err != nil { | ||
logger.Errorf("failed to send Slack notification: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
include all the provided currencies in the slack notification separated by comma
e.g
NGN, KES
…es in Slack notification as comma-separated list
Description
Implements Slack notifications for new user signups, notifying administrators when a user registers. This feature includes user details such as user ID, email, first name, last name, role (provider or sender), and provider-specific details (e.g., currency for providers). The notifications will be sent only in the production environment, and errors in sending the notifications will be logged without interrupting the registration process.
References
n/a
Testing
User signup and Slack notification service integration
Role-specific notifications (provider/sender)
Slack webhook error handling and logging
Environment-specific notification dispatch (production only)
Checklist
closes #410