{"modulePath":"github.com/cruxstack/github-ops-app","version":"v1.1.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package notifiers\n\nPackage notifiers formats and sends Slack notifications.\n\n## Functions\n\n```go\nfunc Escape(s string) string\n```\nEscape makes untrusted text safe to include in Slack mrkdwn, so text such as a PR title cannot mention channels or users or add links.\n\n## Types\n\n```go\ntype Options struct {\n\tToken    string\n\tChannels SlackChannels\n\tMessages SlackMessages\n\t// APIURL overrides the Slack API URL, for tests.\n\tAPIURL string\n\t// GitHubWebURL is the web URL of GitHub links, such as\n\t// https://github.com or a GitHub Enterprise Server URL.\n\tGitHubWebURL string\n\tHTTPClient   *http.Client\n}\n```\nOptions configures a SlackNotifier.\n\n```go\ntype SlackChannels struct {\n\tDefault        string\n\tPRBypass       string\n\tOktaSync       string\n\tOrphanedUsers  string\n\tSecurityAlerts string\n}\n```\nSlackChannels holds channel IDs for different notification types. Empty values fall back to the default channel.\n\n```go\ntype SlackMessages struct {\n\t// PRBypassFooterNote is Slack mrkdwn written by the operator, so it is\n\t// sent as is.\n\tPRBypassFooterNote string\n}\n```\nSlackMessages holds optional custom text for notifications. Empty values are left out.\n\n```go\ntype SlackNotifier struct {\n\t// contains filtered or unexported fields\n}\n```\nSlackNotifier sends formatted messages to Slack channels.\n\n```go\nfunc New(opts Options) *SlackNotifier\n```\nNew creates a SlackNotifier.\n\n```go\nfunc (s *SlackNotifier) NotifyOktaSync(ctx context.Context, reports []*domain.SyncReport, githubOrg string) error\n```\nNotifyOktaSync sends a Slack notification with Okta sync results.\n\n```go\nfunc (s *SlackNotifier) NotifyOrphanedUsers(ctx context.Context, report *domain.OrphanedUsersReport) error\n```\nNotifyOrphanedUsers sends a Slack notification about organization members not in any synced teams.\n\n```go\nfunc (s *SlackNotifier) NotifyPRBypass(ctx context.Context, result *domain.PRComplianceResult, repoFullName string) error\n```\nNotifyPRBypass sends a Slack notification when a PR was merged without meeting its branch's requirements.\n\n```go\nfunc (s *SlackNotifier) NotifySecurityAlerts(ctx context.Context, report *domain.SecurityAlertsReport, githubOrg string) error\n```\nNotifySecurityAlerts sends a Slack notification summarizing stale open security alerts across the organization.\n\n```go\nfunc (s *SlackNotifier) ReplyToCommand(ctx context.Context, responseURL, text string) error\n```\nReplyToCommand answers a slash command through its response URL, which must be a Slack URL, so a forged job cannot make the app send requests elsewhere.\n\n","path":"github.com/cruxstack/github-ops-app/internal/notifiers","name":"notifiers","synopsis":"Package notifiers formats and sends Slack notifications.","isRedistributable":true}
