games_app/backend/dist/services/slackService.d.ts
2026-06-29 15:01:23 +02:00

49 lines
1.8 KiB
TypeScript

/**
* Slack incoming-webhook notifications for security and referral fraud events.
* Each channel uses its own webhook URL; SLACK_WEBHOOK_URL is a legacy fallback.
*/
export type SlackChannel = 'security' | 'referral';
export type SlackMessageBlock = {
type: 'section' | 'header';
text?: {
type: 'mrkdwn' | 'plain_text';
text: string;
};
};
export type SlackWebhookConfig = {
securityWebhookUrl?: string;
referralWebhookUrl?: string;
fallbackWebhookUrl?: string;
};
/** Resolves the webhook URL for a Slack channel (pure, testable). */
export declare function resolveSlackWebhookUrl(channel: SlackChannel, urls: SlackWebhookConfig): string;
export declare function getSlackWebhookUrl(channel: SlackChannel): string;
export declare function isSlackChannelConfigured(channel: SlackChannel): boolean;
/** True when at least one Slack channel webhook is configured. */
export declare function isSlackConfigured(): boolean;
export declare function isReferralSlackAlertType(alertType: string): boolean;
/** Posts a message to a Slack webhook. Failures are logged, not thrown. */
export declare function postSlackMessage(input: {
webhookUrl: string;
text: string;
blocks?: SlackMessageBlock[];
}): Promise<boolean>;
export declare function postSlackAlert(input: {
channel: SlackChannel;
title: string;
severity: string;
alertType: string;
details?: string;
userId?: string | null;
metadata?: Record<string, unknown>;
}): Promise<void>;
/** @deprecated Use postSlackAlert({ channel: 'security', ... }) */
export declare function postSlackSecurityAlert(input: {
title: string;
severity: string;
alertType: string;
details?: string;
userId?: string | null;
metadata?: Record<string, unknown>;
}): Promise<void>;
//# sourceMappingURL=slackService.d.ts.map