constructor()

in usecases/guest-webapp-sample/lib/blea-chatbot-stack.ts [14:34]


  constructor(scope: cdk.Construct, id: string, props: BLEAChatbotStackProps) {
    super(scope, id, props);

    // AWS Chatbot configuration for sending message
    const chatbotRole = new iam.Role(this, 'ChatbotRole', {
      assumedBy: new iam.ServicePrincipal('chatbot.amazonaws.com'),
      managedPolicies: [
        iam.ManagedPolicy.fromAwsManagedPolicyName('ReadOnlyAccess'),
        iam.ManagedPolicy.fromAwsManagedPolicyName('CloudWatchReadOnlyAccess'),
      ],
    });

    // !!! Create SlackChannel and add aws chatbot app to the room
    new cb.CfnSlackChannelConfiguration(this, 'ChatbotChannel', {
      configurationName: `${id}-${props.workspaceId}`,
      slackChannelId: props.channelId,
      iamRoleArn: chatbotRole.roleArn,
      slackWorkspaceId: props.workspaceId,
      snsTopicArns: [props.topicArn],
    });
  }