import type * as codepipeline from "aws-cdk-lib/aws-codepipeline"; import type * as s3 from "aws-cdk-lib/aws-s3"; import type * as secretsmanager from "aws-cdk-lib/aws-secretsmanager"; import * as constructs from "constructs"; export interface SlackNotificationProps { /** * CodePipeline to monitor. */ pipeline: codepipeline.IPipeline; /** * Artifacts bucket used by pipeline */ artifactsBucket: s3.IBucket; /** * A plaintext secret containing the URL of a Slack incoming webhook. * The webhook should be created through a Slack app, and only allows posting to one specific Slack channel. * See Slack's official documentation (e.g., https://api.slack.com/messaging/webhooks) for more details. * * NOTE: Incoming webhooks created through legacy custom integrations in Slack are not supported. */ slackWebhookUrlSecret: secretsmanager.ISecret; /** * An optional friendly name that will be used in the Slack notifications instead of the AWS account ID */ accountFriendlyName?: string; /** * Control the amount and types of notifications being sent to Slack. * "WARN" is the least verbose, while "DEBUG" is the most verbose. * * "WARN" - Includes notifications related to the failure of a pipeline execution. * "INFO" - Adds notifications for the success of a pipeline execution. * "DEBUG" - Adds notifications for the start and superseding of a pipeline execution. * * @default "WARN" */ notificationLevel?: "WARN" | "INFO" | "DEBUG"; /** * The key of the object (e.g., `my-prefix/my-file.json`) that triggers the S3 Source Action associated with the pipeline. * By configuring this parameter you can specify which objects the Lambda function that sends messages to Slack can access in the artifacts bucket. * * @default - the Lambda function can read all objects in the artifacts bucket. */ triggerObjectKey?: string; /** * Slack mentions to include in failure notifications (only on new failures, not repeated ones). * Use special mentions (@here, @channel, @everyone) or user/group IDs (e.g., 'U1234567890', 'S9876543210'). * @default - none */ mentions?: string[]; } /** * Monitor a CodePipeline and send message to Slack on failure * and some succeeded events. */ export declare class SlackNotification extends constructs.Construct { constructor(scope: constructs.Construct, id: string, props: SlackNotificationProps); } /** * Slack mention formatter with validation per Slack API format: * https://docs.slack.dev/messaging/formatting-message-text/ * * Supported mention types: * - Special mentions: @here, @channel, @everyone * - User IDs: U or W prefix + alphanumeric (e.g., U024BE7LH, W024BE7LH) * - User group IDs: S prefix + alphanumeric (e.g., SAZ94GDB8) * * Usage: * SlackMention.format(['@here', 'U024BE7LH', 'SAZ94GDB8']) */ export declare class SlackMention { private static readonly SPECIAL_MENTIONS; private static readonly USER_PATTERN; private static readonly USER_GROUP_PATTERN; /** * Format an array of mentions into a single Slack-formatted string. * @param mentions Array of mention strings */ static format(mentions: string[]): string; /** * Format a mention string for Slack API message format. * Validates format and converts to proper Slack markup: * '@here' -> '' * 'U1234567890' -> '<@U1234567890>' * 'S1234567890' -> '' * * @param mention Mention string (e.g., '@here', 'U1234567890', 'S1234567890') * @throws if mention format is invalid */ static formatMention(mention: string): string; private static formatSpecialMention; private static formatUser; private static formatUserGroup; }