An example Slack Bot application built with Vapor in Swift.
Youโll probably want to start w/ the slack documentation: https://api.slack.com/bot-users.
You can come say hello to this bot running on heroku in our slack as myrtle: http://slack.qutheory.io/
Heroku wonโt automatically scale dynos for your bot. After the build is complete, youโll need to start the process.
Xcode | Swift Version |
---|---|
8 | DEVELOPMENT-SNAPSHOT-2016-06-20-a |
Setup Xcode by running swift package generate-xcodeproj
Once you have setup your bot-token, create a folder named Config
and place a file bot-config.json
in it. The green check marks are because I sync w/ Dropbox, they can be ignored.
Your bot-config.json
file should look like this (replace your token)
{
"token": "<#your token here#>"
}
Once the environment is configured, as above, your bot should run in Xcode. Direct message your bot in slack w/ a hello
prefix and there will be a hello response.
If youโd prefer to build to Heroku manually
Add your secret token (or through Heroku WebSite):
heroku config:set BOT_TOKEN=<#your-token-here#>
heroku buildpacks:set https://github.com/kylef/heroku-buildpack-swift
Already included in project, should be worker
type.
Commit uncommmitted changes if necessary, then push to Heroku
git push heroku master
Scale up a worker with:
heroku ps:scale worker=1
Created by Logan Wright