-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add to readme. fix package.json to remove fs. fix some comment typos
- Loading branch information
1 parent
f649eca
commit 32313e7
Showing
4 changed files
with
41 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,6 +91,27 @@ Bonus: Add a notification hook to Heroku so a notification is sent to a room whe | |
robot.messageRoom("[email protected]", "message"); | ||
``` | ||
|
||
## hubot-hipchat specific featues | ||
|
||
In addition to the response methods provided by the normal hubot, such as ```resp.send```, hubot-hipchat provides these hipchat specific functions: | ||
* ```resp.sendHtml``` takes any number of strings and sticks them together as one html message post. For example, you can send a hyperlink by doing this: | ||
``` | ||
robot.respond /send hyperlink/i, (resp)-> | ||
resp.sendHtml "<a href='https://hipchat.com'>hipchat site</a>" | ||
``` | ||
|
||
* ```resp.sendFile``` takes an object that contains either file data or a path to a file along with other file info and posts the file to a room with an optional message: | ||
``` | ||
robot.respond /send file/i, (resp) -> | ||
file_info = | ||
name : "the name people will see in the room" | ||
path : 'path/to/file.text' | ||
type: "text" # required | ||
msg : "optional message to post when file is uploaded" | ||
resp.sendFile file_info | ||
``` | ||
|
||
## Adapter configuration | ||
|
||
This adapter uses the following environment variables: | ||
|
@@ -135,6 +156,10 @@ Optional. Set to `debug` to enable detailed debug logging. | |
|
||
Optional. Seting to `false` will prevent the HipChat adapter from auto-reconnecting if it detects a server error or disconnection. | ||
|
||
### HUBOT\_HIPCHAT\_TOKEN | ||
|
||
Optional. Set to the value of an API token for HipChat. Generate an API token [here](https://cs10.hipchat.com/account/api) (and give it the necessary scopes to post in rooms, the easiest way is just give it access to all scopes). This needs to be set in order to use the sendFile and sendHtml methods. | ||
|
||
## Running locally | ||
|
||
To run locally on OSX or Linux you'll need to set the required environment variables and run the `bin/hubot` script. An example script to run the bot might look like: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
{Response} = require 'hubot' | ||
|
||
class HipchatResponse extends Response | ||
class HipChatResponse extends Response | ||
|
||
sendFile: (file_info) -> | ||
@robot.adapter.sendFile(@envelope, file_info) | ||
|
||
sendHtml: (strings...) -> | ||
@robot.adapter.sendHtml(@envelope, strings...) | ||
|
||
module.exports = HipchatResponse | ||
module.exports = HipChatResponse |