Skip to content

AWS.Chatbot reference

Source: src/AWS/Chatbot/Association.ts

An AWS Chatbot (Amazon Q Developer in chat applications) association that links a resource — a CustomAction — to a Slack or Microsoft Teams channel configuration so the action is available in that channel.

import * as Chatbot from "alchemy/AWS/Chatbot";
const action = yield* Chatbot.CustomAction("DescribeAlarm", {
commandText: "aws cloudwatch describe-alarms --alarm-names $AlarmName",
});
const config = yield* Chatbot.SlackChannelConfiguration("Alerts", {
slackTeamId: "T012ABCDEFG",
slackChannelId: "C012AB3CD",
iamRoleArn: role.roleArn,
});
const association = yield* Chatbot.Association("AlarmAction", {
chatConfiguration: config.chatConfigurationArn,
resource: action.customActionArn,
});

Source: src/AWS/Chatbot/CustomAction.ts

An AWS Chatbot (Amazon Q Developer in chat applications) custom action — a reusable CLI command that chat users invoke by alias or as a button on notifications.

Custom actions exist at the account level and do not require a chat workspace to be onboarded, though they only become usable once a Slack or Microsoft Teams channel configuration exists.

List Lambda functions from chat

import * as Chatbot from "alchemy/AWS/Chatbot";
const action = yield* Chatbot.CustomAction("ListFunctions", {
commandText: "aws lambda list-functions",
aliasName: "list-functions",
});

Button on CloudWatch alarm notifications

const action = yield* Chatbot.CustomAction("DescribeAlarm", {
commandText: "aws cloudwatch describe-alarms --alarm-names $AlarmName",
attachments: [
{
notificationType: "CloudWatch",
buttonText: "Describe alarm",
criteria: [
{ operator: "HAS_VALUE", variableName: "AlarmName" },
],
},
],
});

Source: src/AWS/Chatbot/DeleteMicrosoftTeamsConfiguredTeam.ts

Runtime binding for chatbot:DeleteMicrosoftTeamsConfiguredTeam.

Removes an onboarded Microsoft Teams team from AWS Chatbot — the drastic end of offboarding automation. Existing channel configurations for the team stop working until it is re-onboarded via the console OAuth flow. Provide the implementation with Effect.provide(AWS.Chatbot.DeleteMicrosoftTeamsConfiguredTeamHttp).

DeleteMicrosoftTeamsConfiguredTeam: Microsoft Teams Identity Management

Section titled “DeleteMicrosoftTeamsConfiguredTeam: Microsoft Teams Identity Management”
const deleteMicrosoftTeamsConfiguredTeam =
yield* AWS.Chatbot.DeleteMicrosoftTeamsConfiguredTeam();
yield* deleteMicrosoftTeamsConfiguredTeam({
TeamId: "0a1b2c3d-4e5f-1a2b-3c4d-0a1b2c3d4e5f",
});

Source: src/AWS/Chatbot/DeleteMicrosoftTeamsUserIdentity.ts

Runtime binding for chatbot:DeleteMicrosoftTeamsUserIdentity.

Unlinks a Microsoft Teams user identity from its AWS user identity — the write half of identity offboarding automation. Provide the implementation with Effect.provide(AWS.Chatbot.DeleteMicrosoftTeamsUserIdentityHttp).

DeleteMicrosoftTeamsUserIdentity: Microsoft Teams Identity Management

Section titled “DeleteMicrosoftTeamsUserIdentity: Microsoft Teams Identity Management”
const deleteMicrosoftTeamsUserIdentity =
yield* AWS.Chatbot.DeleteMicrosoftTeamsUserIdentity();
yield* deleteMicrosoftTeamsUserIdentity({
ChatConfigurationArn: configurationArn,
UserId: "0a1b2c3d-4e5f-1a2b-3c4d-0a1b2c3d4e5f",
});

Source: src/AWS/Chatbot/DeleteSlackUserIdentity.ts

Runtime binding for chatbot:DeleteSlackUserIdentity.

Unlinks a Slack user identity from its AWS user identity — the write half of identity offboarding automation (e.g. revoke a departing employee’s chat identity from a Lambda triggered by your HR system). Provide the implementation with Effect.provide(AWS.Chatbot.DeleteSlackUserIdentityHttp).

DeleteSlackUserIdentity: Slack Identity Management

Section titled “DeleteSlackUserIdentity: Slack Identity Management”
const deleteSlackUserIdentity =
yield* AWS.Chatbot.DeleteSlackUserIdentity();
yield* deleteSlackUserIdentity({
ChatConfigurationArn: configurationArn,
SlackTeamId: "T012ABCDEFG",
SlackUserId: "U012AB3CD",
});

Source: src/AWS/Chatbot/DeleteSlackWorkspaceAuthorization.ts

Runtime binding for chatbot:DeleteSlackWorkspaceAuthorization.

Revokes AWS Chatbot’s authorization for an entire Slack workspace — the drastic end of offboarding automation. Existing channel configurations for the workspace stop working until it is re-authorized via the console OAuth flow. Provide the implementation with Effect.provide(AWS.Chatbot.DeleteSlackWorkspaceAuthorizationHttp).

DeleteSlackWorkspaceAuthorization: Slack Identity Management

Section titled “DeleteSlackWorkspaceAuthorization: Slack Identity Management”
const deleteSlackWorkspaceAuthorization =
yield* AWS.Chatbot.DeleteSlackWorkspaceAuthorization();
yield* deleteSlackWorkspaceAuthorization({ SlackTeamId: "T012ABCDEFG" });

Source: src/AWS/Chatbot/DescribeSlackUserIdentities.ts

Runtime binding for chatbot:DescribeSlackUserIdentities.

Lists the Slack user identities linked to AWS user identities, optionally filtered to one channel configuration — the read half of identity offboarding automation. Provide the implementation with Effect.provide(AWS.Chatbot.DescribeSlackUserIdentitiesHttp).

DescribeSlackUserIdentities: Slack Identity Management

Section titled “DescribeSlackUserIdentities: Slack Identity Management”
const describeSlackUserIdentities =
yield* AWS.Chatbot.DescribeSlackUserIdentities();
const result = yield* describeSlackUserIdentities();
const users = (result.SlackUserIdentities ?? []).map((u) => u.SlackUserId);

Source: src/AWS/Chatbot/DescribeSlackWorkspaces.ts

Runtime binding for chatbot:DescribeSlackWorkspaces.

Lists the Slack workspaces authorized with AWS Chatbot in the account — useful for identity/workspace audit automation. Provide the implementation with Effect.provide(AWS.Chatbot.DescribeSlackWorkspacesHttp).

DescribeSlackWorkspaces: Slack Identity Management

Section titled “DescribeSlackWorkspaces: Slack Identity Management”
const describeSlackWorkspaces =
yield* AWS.Chatbot.DescribeSlackWorkspaces();
const result = yield* describeSlackWorkspaces();
const teamIds = (result.SlackWorkspaces ?? []).map((w) => w.SlackTeamId);

Source: src/AWS/Chatbot/GetAccountPreferences.ts

Runtime binding for chatbot:GetAccountPreferences.

Returns the account-level AWS Chatbot preferences (whether user-level authorization is required and whether training-data collection is enabled). Provide the implementation with Effect.provide(AWS.Chatbot.GetAccountPreferencesHttp).

GetAccountPreferences: Account Preferences

Section titled “GetAccountPreferences: Account Preferences”
const getAccountPreferences = yield* AWS.Chatbot.GetAccountPreferences();
const result = yield* getAccountPreferences();
const trainingData = result.AccountPreferences?.TrainingDataCollectionEnabled;

Source: src/AWS/Chatbot/ListMicrosoftTeamsConfiguredTeams.ts

Runtime binding for chatbot:ListMicrosoftTeamsConfiguredTeams.

Lists the Microsoft Teams teams onboarded to AWS Chatbot in the account — useful for identity/team audit automation. Provide the implementation with Effect.provide(AWS.Chatbot.ListMicrosoftTeamsConfiguredTeamsHttp).

ListMicrosoftTeamsConfiguredTeams: Microsoft Teams Identity Management

Section titled “ListMicrosoftTeamsConfiguredTeams: Microsoft Teams Identity Management”
const listMicrosoftTeamsConfiguredTeams =
yield* AWS.Chatbot.ListMicrosoftTeamsConfiguredTeams();
const result = yield* listMicrosoftTeamsConfiguredTeams();
const teamIds = (result.ConfiguredTeams ?? []).map((t) => t.TeamId);

Source: src/AWS/Chatbot/ListMicrosoftTeamsUserIdentities.ts

Runtime binding for chatbot:ListMicrosoftTeamsUserIdentities.

Lists the Microsoft Teams user identities linked to AWS user identities, optionally filtered to one channel configuration — the read half of identity offboarding automation. Provide the implementation with Effect.provide(AWS.Chatbot.ListMicrosoftTeamsUserIdentitiesHttp).

ListMicrosoftTeamsUserIdentities: Microsoft Teams Identity Management

Section titled “ListMicrosoftTeamsUserIdentities: Microsoft Teams Identity Management”
const listMicrosoftTeamsUserIdentities =
yield* AWS.Chatbot.ListMicrosoftTeamsUserIdentities();
const result = yield* listMicrosoftTeamsUserIdentities();
const users = (result.TeamsUserIdentities ?? []).map((u) => u.UserId);

Source: src/AWS/Chatbot/MicrosoftTeamsChannelConfiguration.ts

An AWS Chatbot (Amazon Q Developer in chat applications) Microsoft Teams channel configuration that delivers SNS notifications to a Teams channel and lets channel members run read-only or scoped AWS commands.

The Microsoft Teams team must be onboarded to AWS Chatbot beforehand via the console OAuth flow (Chatbot console -> Configure new client -> Microsoft Teams) — team authorization cannot be automated.

MicrosoftTeamsChannelConfiguration: Creating Microsoft Teams Channel Configurations

Section titled “MicrosoftTeamsChannelConfiguration: Creating Microsoft Teams 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.MicrosoftTeamsChannelConfiguration("Alerts", {
teamId: "0a1b2c3d-4e5f-1a2b-3c4d-0a1b2c3d4e5f",
tenantId: "1a2b3c4d-5e6f-1a2b-3c4d-1a2b3c4d5e6f",
teamsChannelId: "19%3ab6ef35dc342d56ba5654e6fc6d25a071%40thread.tacv2",
iamRoleArn: role.roleArn,
snsTopicArns: [topic.topicArn],
});

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.

SlackChannelConfiguration: Creating Slack Channel Configurations

Section titled “SlackChannelConfiguration: 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",
});

Source: src/AWS/Chatbot/UpdateAccountPreferences.ts

Runtime binding for chatbot:UpdateAccountPreferences.

Updates the account-level AWS Chatbot preferences (user-level authorization requirement, training-data collection). Provide the implementation with Effect.provide(AWS.Chatbot.UpdateAccountPreferencesHttp).

UpdateAccountPreferences: Account Preferences

Section titled “UpdateAccountPreferences: Account Preferences”
const updateAccountPreferences =
yield* AWS.Chatbot.UpdateAccountPreferences();
yield* updateAccountPreferences({ UserAuthorizationRequired: true });