Skip to content
v2.275.0

SlackChannelConfiguration L2 construct ​

A new Slack channel configuration.

Example ​

ts
import * as chatbot from 'aws-cdk-lib/aws-chatbot';

declare const project: codebuild.Project;

const target = new chatbot.SlackChannelConfiguration(this, 'MySlackChannel', {
  slackChannelConfigurationName: 'YOUR_CHANNEL_NAME',
  slackWorkspaceId: 'YOUR_SLACK_WORKSPACE_ID',
  slackChannelId: 'YOUR_SLACK_CHANNEL_ID',
});

const rule = project.notifyOnBuildSucceeded('NotifyOnBuildSucceeded', target);
python
import aws_cdk.aws_chatbot as chatbot

# project: codebuild.Project


target = chatbot.SlackChannelConfiguration(self, "MySlackChannel",
    slack_channel_configuration_name="YOUR_CHANNEL_NAME",
    slack_workspace_id="YOUR_SLACK_WORKSPACE_ID",
    slack_channel_id="YOUR_SLACK_CHANNEL_ID"
)

rule = project.notify_on_build_succeeded("NotifyOnBuildSucceeded", target)
java
import software.amazon.awscdk.services.chatbot.*;

Project project;


SlackChannelConfiguration target = SlackChannelConfiguration.Builder.create(this, "MySlackChannel")
        .slackChannelConfigurationName("YOUR_CHANNEL_NAME")
        .slackWorkspaceId("YOUR_SLACK_WORKSPACE_ID")
        .slackChannelId("YOUR_SLACK_CHANNEL_ID")
        .build();

INotificationRule rule = project.notifyOnBuildSucceeded("NotifyOnBuildSucceeded", target);
csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.Chatbot;

Project project;


var target = new SlackChannelConfiguration(this, "MySlackChannel", new SlackChannelConfigurationProps {
    SlackChannelConfigurationName = "YOUR_CHANNEL_NAME",
    SlackWorkspaceId = "YOUR_SLACK_WORKSPACE_ID",
    SlackChannelId = "YOUR_SLACK_CHANNEL_ID"
});

var rule = project.NotifyOnBuildSucceeded("NotifyOnBuildSucceeded", target);
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import chatbot "github.com/aws/aws-cdk-go/awscdk"

var project Project


target := chatbot.NewSlackChannelConfiguration(this, jsii.String("MySlackChannel"), &SlackChannelConfigurationProps{
	SlackChannelConfigurationName: jsii.String("YOUR_CHANNEL_NAME"),
	SlackWorkspaceId: jsii.String("YOUR_SLACK_WORKSPACE_ID"),
	SlackChannelId: jsii.String("YOUR_SLACK_CHANNEL_ID"),
})

rule := project.notifyOnBuildSucceeded(jsii.String("NotifyOnBuildSucceeded"), target)

Initializer ​

ts
new SlackChannelConfiguration(scope: Construct, id: string, props: SlackChannelConfigurationProps)
python
SlackChannelConfiguration(scope: Construct, id: str, props: SlackChannelConfigurationProps)
java
new SlackChannelConfiguration(Construct scope, String id, SlackChannelConfigurationProps props)
csharp
new SlackChannelConfiguration(Construct scope, string id, SlackChannelConfigurationProps props)
go
NewSlackChannelConfiguration(Scope Construct, Id *string, Props SlackChannelConfigurationProps)

Construct Props ​

guardrailPoliciesoptionalIManagedPolicy[]guardrail_policiesoptionaltyping.List[IManagedPolicy]guardrailPoliciesoptionalList<IManagedPolicy>GuardrailPoliciesoptionalIManagedPolicy[]GuardrailPoliciesoptional*[]IManagedPolicy#
A list of IAM managed policies that are applied as channel guardrails.

Default: The AWS managed 'AdministratorAccess' policy is applied as a default if this is not set.

loggingLeveloptionalLoggingLevellogging_leveloptionalLoggingLevelloggingLeveloptionalLoggingLevelLoggingLeveloptionalLoggingLevelLoggingLeveloptionalLoggingLevel= LoggingLevel.NONE#
Specifies the logging level for this configuration.

This property affects the log entries pushed to Amazon CloudWatch Logs.

logRetentionoptionalRetentionDayslog_retentionoptionalRetentionDayslogRetentionoptionalRetentionDaysLogRetentionoptionalRetentionDaysLogRetentionoptionalRetentionDays= logs.RetentionDays.INFINITE#
The number of days log events are kept in CloudWatch Logs.

When updating this property, unsetting it doesn't remove the log retention policy. To remove the retention policy, set the value to INFINITE.

logRetentionRetryOptionsoptionalLogRetentionRetryOptionslog_retention_retry_optionsoptionalLogRetentionRetryOptionslogRetentionRetryOptionsoptionalLogRetentionRetryOptionsLogRetentionRetryOptionsoptionalLogRetentionRetryOptionsLogRetentionRetryOptionsoptionalLogRetentionRetryOptions#
When log retention is specified, a custom resource attempts to create the CloudWatch log group.

Default: Default AWS SDK retry options.

These options control the retry policy when interacting with CloudWatch APIs.

logRetentionRoleoptionalIRolelog_retention_roleoptionalIRolelogRetentionRoleoptionalIRoleLogRetentionRoleoptionalIRoleLogRetentionRoleoptionalIRole#
The IAM role for the Lambda function associated with the custom resource that sets the retention policy.

Default: A new role is created.

notificationTopicsoptionalITopic[]notification_topicsoptionaltyping.List[ITopic]notificationTopicsoptionalList<ITopic>NotificationTopicsoptionalITopic[]NotificationTopicsoptional*[]ITopic= None#
The SNS topics that deliver notifications to AWS Chatbot.
roleoptionalIRoleroleoptionalIRoleroleoptionalIRoleRoleoptionalIRoleRoleoptionalIRole#
The permission role of Slack channel configuration.

Default: A role will be created.

slackChannelConfigurationNamestringslack_channel_configuration_namestrslackChannelConfigurationNameStringSlackChannelConfigurationNamestringSlackChannelConfigurationName*stringrequired#
The name of Slack channel configuration.
slackChannelIdstringslack_channel_idstrslackChannelIdStringSlackChannelIdstringSlackChannelId*stringrequired#
The ID of the Slack channel.

To get the ID, open Slack, right click on the channel name in the left pane, then choose Copy Link. The channel ID is the 9-character string at the end of the URL. For example, ABCBBLZZZ.

slackWorkspaceIdstringslack_workspace_idstrslackWorkspaceIdStringSlackWorkspaceIdstringSlackWorkspaceId*stringrequired#
The ID of the Slack workspace authorized with AWS Chatbot.
notes

To get the workspace ID, you must perform the initial authorization flow with Slack in the AWS Chatbot console. Then you can copy and paste the workspace ID from the console. For more details, see steps 1-4 in Setting Up AWS Chatbot with Slack in the AWS Chatbot User Guide.

userRoleRequiredoptionalbooleanuser_role_requiredoptionalbooluserRoleRequiredoptionalBooleanUserRoleRequiredoptionalboolUserRoleRequiredoptional*bool= false#
Enables use of a user role requirement in your chat configuration.

Properties ​

The environment this resource belongs to.
notes

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.

grantPrincipalIPrincipalgrant_principalIPrincipalgrantPrincipalIPrincipalGrantPrincipalIPrincipalGrantPrincipalIPrincipal#
The principal to grant permissions to.
nodeNodenodeNodenodeNodeNodeNodeNodeNode#
The tree node.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringstatic#
Uniquely identifies this class.
rolemay be undefinedIRolerolemay be undefinedIRolerolemay be undefinedIRoleRolemay be undefinedIRoleRolemay be undefinedIRole#
The permission role of Slack channel configuration.
slackChannelConfigurationArnstringslack_channel_configuration_arnstrslackChannelConfigurationArnStringSlackChannelConfigurationArnstringSlackChannelConfigurationArn*string#
The ARN of the Slack channel configuration In the form of arn:aws:chatbot:{region}:{account}:chat-configuration/slack-channel/{slackChannelName}.
slackChannelConfigurationNamestringslack_channel_configuration_namestrslackChannelConfigurationNameStringSlackChannelConfigurationNamestringSlackChannelConfigurationName*string#
The name of Slack channel configuration.
slackChannelConfigurationRefSlackChannelConfigurationReferenceslack_channel_configuration_refSlackChannelConfigurationReferenceslackChannelConfigurationRefSlackChannelConfigurationReferenceSlackChannelConfigurationRefSlackChannelConfigurationReferenceSlackChannelConfigurationRefSlackChannelConfigurationReference#
A reference to a SlackChannelConfiguration resource.
stackStackstackStackstackStackStackStackStackStack#
The stack in which this resource is defined.

Methods ​

addNotificationTopic(notificationTopic: ITopic): voiddef add_notification_topic(self, notification_topic: ITopic) -> Nonepublic void addNotificationTopic(ITopic notificationTopic)public void AddNotificationTopic(ITopic notificationTopic)func AddNotificationTopic(NotificationTopic ITopic)#
Adds a SNS topic that deliver notifications to AWS Chatbot.
addToRolePolicy(statement: PolicyStatement): voiddef add_to_role_policy(self, statement: PolicyStatement) -> Nonepublic void addToRolePolicy(PolicyStatement statement)public void AddToRolePolicy(PolicyStatement statement)func AddToRolePolicy(Statement PolicyStatement)#
Adds extra permission to iam-role of Slack channel configuration.
applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#
Override the cross-stack reference strength for this resource.
notes · 1 parameter

When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.

Parameters

  • strengthstrengthstrengthstrengthStrength — - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#
Apply the given removal policy to this resource.
notes

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

bindAsNotificationRuleTarget(_scope: Construct): NotificationRuleTargetConfigdef bind_as_notification_rule_target(self, _scope: Construct) -> NotificationRuleTargetConfigpublic NotificationRuleTargetConfig bindAsNotificationRuleTarget(Construct _scope)public NotificationRuleTargetConfig BindAsNotificationRuleTarget(Construct _scope)func BindAsNotificationRuleTarget(_scope Construct) NotificationRuleTargetConfig#
Returns a target configuration for notification rule.
fromSlackChannelConfigurationArn(scope: Construct, id: string, slackChannelConfigurationArn: string): ISlackChannelConfiguration@staticmethod def from_slack_channel_configuration_arn(scope: Construct, id: str, slack_channel_configuration_arn: str) -> ISlackChannelConfigurationpublic static ISlackChannelConfiguration fromSlackChannelConfigurationArn(Construct scope, String id, String slackChannelConfigurationArn)public static ISlackChannelConfiguration FromSlackChannelConfigurationArn(Construct scope, string id, string slackChannelConfigurationArn)func FromSlackChannelConfigurationArn(Scope Construct, Id *string, SlackChannelConfigurationArn *string) ISlackChannelConfigurationstatic#
Import an existing Slack channel configuration provided an ARN.
3 parameters · returns

Parameters

  • scopescopescopescopeScope — The parent creating construct.
  • ididididId — The construct's name.
  • slackChannelConfigurationArnslack_channel_configuration_arnslackChannelConfigurationArnslackChannelConfigurationArnSlackChannelConfigurationArn — configuration ARN (i.e. arn:aws:chatbot::123456789012:chat-configuration/slack-channel/my-slack).

Returns: a reference to the existing Slack channel configuration

isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#
Returns true if the construct was created by CDK, and false otherwise.
isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#
Check whether the given construct is a Resource.
metric(metricName: string, props?: MetricOptions): Metricdef metric(self, metric_name: str, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metric(String metricName, MetricOptions props)public Metric Metric(string metricName, MetricOptions? props = null)func Metric(MetricName *string, Props MetricOptions) Metric#
Return the given named metric for this SlackChannelConfiguration.
metricAll(metricName: string, props?: MetricOptions): Metric@staticmethod def metric_all(metric_name: str, props: typing.Optional[MetricOptions] = None) -> Metricpublic static Metric metricAll(String metricName, MetricOptions props)public static Metric MetricAll(string metricName, MetricOptions? props = null)func MetricAll(MetricName *string, Props MetricOptions) Metricstatic#
Return the given named metric for All SlackChannelConfigurations.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.