createCustomAction
abstract suspend fun createCustomAction(input: CreateCustomActionRequest): CreateCustomActionResponse
Creates a custom action that can be invoked as an alias or as a button on a notification.
Samples
import aws.sdk.kotlin.services.chatbot.model.CustomActionAttachment
import aws.sdk.kotlin.services.chatbot.model.CustomActionDefinition
fun main() {
//sampleStart
// Creates an alias that invokes a Lambda function from chat channels. You can use this alias by
// entering run invoke after which you re prompted for the function name.
val resp = chatbotClient.createCustomAction {
actionName = "my-custom-action"
definition = CustomActionDefinition {
commandText = "lambda invoke $functionName"
}
aliasName = "invoke"
}
//sampleEnd
}
import aws.sdk.kotlin.services.chatbot.model.CustomActionAttachment
import aws.sdk.kotlin.services.chatbot.model.CustomActionDefinition
fun main() {
//sampleStart
// Creates a button on all Cloudwatch notifications that lists alarms in the ALARM state.
val resp = chatbotClient.createCustomAction {
actionName = "describe-alarms"
definition = CustomActionDefinition {
commandText = "cloudwatch describe-alarms --state-value ALARM"
}
attachments = listOf<CustomActionAttachment>(
CustomActionAttachment {
notificationType = "CloudWatch"
buttonText = "List alarms"
}
)
}
//sampleEnd
}