Slackbot
How to run
-
Enable hm-slack first, then enable this plugin as well.
(HM-Slack contains utilities, such as escaping functions.)
-
Head over to your Slack integrations page, and create a new bot user.
This will give you an API token, which you'll need in a second.
-
For full features, you'll also need an Incoming Webhook integration, so set one of those up too.
-
Configure hm-slackbot in your
wp-config.php
:
// Used for sending arbitrary messages from WP in hm-slack
define( 'HM_SLACK_INCOMING_URL', 'https://hooks.slack.com/services/your/incoming' );
// Slack bot token
define( 'HM_SLACK_BOT_TOKEN', 'my-bot-token' );
// GitHub integration token for issues
define( 'HM_SLACK_GITHUB_TOKEN', 'myexampletokenfromgithub' );
// Set up the bot's name
define( 'HM_SLACK_BOT_NAME', 'rmbot' );
define( 'HM_SLACK_BOT_ID', 'U03M7H4V5' );
// Set up bot admin (user ID)
define( 'HM_SLACK_BOT_ADMIN_ID', 'U03BWLTDD' );
- Run the bot
$ wp hm-slackbot run
Running Permanently
If you want to keep Slackbot running all the time, it's best to run it as a daemon. This will keep it running in the background.
To do this, simply add bin/start.sh
to your system's cron, with an interval of
every minute (*
in the minute column). This will check every minute that the
bot is still running.