SlackChannelConfiguration
Source:
src/AWS/Chatbot/SlackChannelConfiguration.ts
An AWS Chatbot (Amazon Q Developer in chat applications) Slack channel configuration that delivers SNS notifications to a Slack channel and lets channel members run read-only or scoped AWS commands.
The Slack workspace must be onboarded to AWS Chatbot beforehand via the console OAuth flow (Chatbot console -> Configure new client -> Slack) — workspace authorization cannot be automated.
Creating Slack Channel Configurations
Section titled “Creating Slack Channel Configurations”import * as Chatbot from "alchemy/AWS/Chatbot";import { Role } from "alchemy/AWS/IAM/Role";import * as SNS from "alchemy/AWS/SNS";
const topic = yield* SNS.Topic("Alerts", {});const role = yield* Role("ChatbotRole", { assumeRolePolicyDocument: { Version: "2012-10-17", Statement: [ { Effect: "Allow", Principal: { Service: "chatbot.amazonaws.com" }, Action: ["sts:AssumeRole"], }, ], }, managedPolicyArns: ["arn:aws:iam::aws:policy/ReadOnlyAccess"],});
const config = yield* Chatbot.SlackChannelConfiguration("Alerts", { slackTeamId: "T012ABCDEFG", slackChannelId: "C012AB3CD", iamRoleArn: role.roleArn, snsTopicArns: [topic.topicArn], loggingLevel: "ERROR",});