Skip to content
GitHubXDiscordRSS

CustomAction

Learn how to create, update, and manage AWS Chatbot CustomActions using Alchemy Cloud Control.

The CustomAction resource lets you manage AWS Chatbot CustomActions for integrating AWS services with chat platforms like Slack and Amazon Chime.

Create a basic CustomAction with required properties and one optional alias name:

import AWS from "alchemy/aws/control";
const basicCustomAction = await AWS.Chatbot.CustomAction("basicCustomAction", {
ActionName: "NotifyOnError",
AliasName: "ErrorNotifier",
Definition: {
// Define the action behavior here
Type: "InvokeLambdaFunction",
FunctionArn: "arn:aws:lambda:us-west-2:123456789012:function:NotifyFunction"
}
});

Configure a CustomAction with attachments and tags for better management:

const advancedCustomAction = await AWS.Chatbot.CustomAction("advancedCustomAction", {
ActionName: "DeployToProduction",
Definition: {
Type: "InvokeLambdaFunction",
FunctionArn: "arn:aws:lambda:us-west-2:123456789012:function:DeployFunction"
},
Attachments: [
{
Key: "DeploymentInfo",
Value: "ProductionDeployment"
}
],
Tags: [
{
Key: "Environment",
Value: "Production"
},
{
Key: "Team",
Value: "DevOps"
}
]
});

Create a CustomAction that adopts an existing resource if it already exists:

const adoptCustomAction = await AWS.Chatbot.CustomAction("adoptCustomAction", {
ActionName: "BackupDatabase",
Definition: {
Type: "InvokeLambdaFunction",
FunctionArn: "arn:aws:lambda:us-west-2:123456789012:function:BackupFunction"
},
adopt: true // Adopt existing resource if it exists
});