| bot | java | boilerplate | slack | maven |
You can find here a not very smart bot for Slack, written in Java. Just send a friendly message to it and it will use it's all graceful mind and computing power to reply you "Hello, $username".
This is also an simple and clean boilerplate to create bots for Slack from a scratch, so just fork this repo and start your development.
It built upon Slack's RTM API and methods API using AHC library as HTTP and WebSockets client with GSON as JSON-coding tool.
You will need JDK 8 and Maven 3 installed to build this application. The process is simple as:
- Clone this repo and
cd
into. - Create new Slack bot.
- Create your environment config with
make env
(orsh env.sh
) and write into a new.env
file your bot's token and user id (Press "Copy member ID" button in chat with bot to get it). - Build application with
make build
(ormvn package
). - Run application with
make run
(orjava -jar target/slackbot-0.1.0.jar
)
That's it! Now you can write handy messages to your bot. Check the RTM API and methods API to continue development.
To deploy on Heroku enter theese commands (suggesting that Herocu CLI is installed):
heroku create your-dyno-name # enter your desired name here
heroku config:set BOT_TOKEN=XXXX-XXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXX BOT_USER=XXXXXXXXX
heroku git:clone -a your-dyno-name