Starter project for a Micronaut Slack app, written in Kotlin. This is forked from my quarantinebot project.
Includes:
- Dockerfile for building with GraalVM for blazing-fast cold start time on AWS Lambda.
- Terraform configs for deploying infrastructure.
- Netty server for running locally.
- Health check endpoint.
Create an app via https://api.slack.com/. Add it to your workspace.
Subscribe to bot events: app_mention
, message.channels
, and message.im
.
Add scopes for app_mentions:read
, im:history
, and chat:write
.
Enable Always Show My Bot as Online
.
- Do a
./gradlew build
to generate kapt annotations - Run tests as usual in IntelliJ
Included in the build is Micronaut's Netty server.
Invoke ./gradlew run
to start it on port 8080.
Make sure to set the SLACK_TOKEN
environment variable to your Slack app's token.
- Run
docker build . -t quarantinebot
- After build, run the container, then exit.
docker run -ti quarantinebot /bin/bash
- Copy the
function.zip
out of the container.docker cp $(docker ps --last 1 --quiet):/home/application/function.zip ./
- On AWS Lambda, set the runtime to "Custom runtime". Use
./bootstrap
as the handler. - Enjoy your insanely fast lambda.