hubot-slack-reaction-example
v1.2.2
Published
Demonstrates how to use the hubot-slack v4.2.0 Robot.react method
Downloads
4
Readme
hubot-slack-reaction-example
Source: https://github.com/mbland/hubot-slack-reaction-example
This is a chat bot built on the Hubot framework that demonstrates how
to use the Robot.react
method introduced in hubot-slack v4.2.0
and the ReactionMessage
type introduced in hubot-slack v4.1.0.
All of the example code is in scripts/handle-reaction.coffee
.
Running the bot
Clone this repo:
$ git clone https://github.com/mbland/hubot-slack-reaction-example $ cd hubot-slack-reaction-example $ npm install
You must have administrator access for your Slack domain. Alternatively, you can create your own personal slack domain for testing.
Create a new Slack bot user for your team. Name it anything you like, such as
reaction-example-bot
. Take note of the API token, which should start withxoxb-
.Invite the bot to a channel by
@
-mentioning it in the channel, e.g.@reaction-example-bot
.Run the bot:
$ HUBOT_SLACK_TOKEN=<bot-test-token> ./bin/hubot --adapter slack
you should see output like:
[Sun Oct 09 2016 12:22:12 GMT-0400 (EDT)] INFO Logged in as reaction-example-bot of mbland [Sun Oct 09 2016 12:22:12 GMT-0400 (EDT)] INFO Slack client now connected [Sun Oct 09 2016 12:22:12 GMT-0400 (EDT)] INFO Listening for reaction_added, reaction_removed events
Post a message in your Slack domain and add an emoji reaction to it.
Now you should see something like:
Copyright
This software is made available as Open Source software under the ISC License. For the text of the license, see the LICENSE file.
That said, this is example code. Feel free to do with it what you like even without retaining the copyright. However, since publishing code as public domain still seems more complicated than it needs to be, the license is there if you need legal coverage.