Skip to content

Slack

Leverages Slack’s native JVM client and Kotlin DSL to make Slack interaction easy.

Also offers channel mapping functionality so you can refer to channels by name instead of ID.

Install kairo-slack-feature. You don’t need to install the Slack client separately — it’s included by default.

build.gradle.kts
dependencies {
implementation("software.airborne.kairo:kairo-slack-feature")
}

First, add the Feature to your Server.

val features = listOf(
SlackFeature(config.slack),
)

We recommend using kairo-config to configure the Feature.

slack {
token = ${SLACK_TOKEN}
channels {
"general" = "C00SPPX83RS"
}
}

Now send a Slack message!

slack.chatPostMessage { builder ->
builder.channel(slack.channels.getValue("general"))
builder.blocks {
section {
plainText("Hello, World!")
}
}
}