Node.js wrapper for HipChat's v2 Send Room Notification API
hipchat-room-notification-api makes sending notifications to HipChat rooms easy.
First thing first, let's make sure you have the necessary pre-requisites.
npm install hipchat-room-notification-api
Creates an instance of HipChatRoomNotification
Type: string
The domain the HipChat server is running on. Ex: https://www.example.com
Type: string
The room id of the HipChat room the notification should be posted to.
Type: string
The auth token for the HipChat room the notification should be posted to.
Sets the from name of the message
Type: string
A label to be shown in addition to the sender's name
Set message format to 'text' instead of 'html'.
Sets color of the message
Type: string
Valid values include: yellow, green, red, purple, gray, and random.
Message notifies members of the room.
Sets message of notfication
Type: string
The message body
Converts notification to card instead of a basic message.
Type: string
An id that will help HipChat recognise the same card when it is sent multiple times.
Type: string
Type of the card. Valid values are file, image, application, link, and media.
Type: string
The title of the card.
Adds thumbnail to card.
Type: string
The thumbnail url.
Adds thumbnail with retina support to card.
Type: string
The thumbnail url.
Type: string
The thumbnail url in retina.
Type: string
The original width of the image.
Type: string
The original height of the image.
Adds activity to card.
Type: string
Html for the activity to show in one line a summary of the action that happened.
Add activity with icon to card.
Type: string
Html for the activity to show in one line a summary of the action that happened.
Type: string
The url where the icon is.
Adds activity with icon that has retina support to card.
Type: string
Html for the activity to show in one line a summary of the action that happened.
Type: string
The url where the icon is.
Type: string
The url for the icon in retina.
Sets card to compact format.
Sets card to medium format.
Sets card url
Type: string
URL that should open when the card is clicked.
Sets card description.
Type: string
The description in the specific format.
Type: string
Description format. Valid values include: html and text.
Adds an attribute to a card.
Type: string
Label for the attribute of the card.
Type: string
Value of the attribute of the card.
Type: string
AUI Integrations for now supporting only lozenges. Valid values: lozenge-success, lozenge-error, lozenge-current, lozenge-complete, lozenge-moved, and lozenge
Adds an attribute to a card.
Type: string
Label for the attribute of the card.
Type: string
Value of the attribute of the card.
Type: string
AUI Integrations for now supporting only lozenges. Valid values: lozenge-success, lozenge-error, lozenge-current, lozenge-complete, lozenge-moved, and lozenge
Type: string
Url to be opened when a user clicks on the label
Adds an attribute to a card.
Type: string
Label for the attribute of the card.
Type: string
Value of the attribute of the card.
Type: string
AUI Integrations for now supporting only lozenges. Valid values: lozenge-success, lozenge-error, lozenge-current, lozenge-complete, lozenge-moved, and lozenge
Type: string
The url where the icon is
Adds an attribute to a card.
Type: string
Label for the attribute of the card.
Type: string
Value of the attribute of the card.
Type: string
AUI Integrations for now supporting only lozenges. Valid values: lozenge-success, lozenge-error, lozenge-current, lozenge-complete, lozenge-moved, and lozenge
Type: string
The url where the icon is
Type: string
Url to be opened when a user clicks on the label
Add icon to card.
Type: string
The url where the icon is.
Add icon to card.
Type: string
The url where the icon is.
Type: string
The url for the icon in retina.
Sets the default options applied to all future requests.
Type: object
Default request options, see the popular request library for options.
Clears any previously set default options.
POST a message to the HipChat room API
Returns a Promise. If it succeeds, a string will be returned with a value of successfully posted to hipchat
. If it fails, an array of errors is returned.
const hipChatRoomNotification = new HipChatRoomNotification('https://www.example.com', '1', 'abcd1234');
hipChatRoomNotification.setFrom('From');
hipChatRoomNotification.setColor('green');
hipChatRoomNotification.shouldNotify();
hipChatRoomNotification.setMessage('My message.');
hipChatRoomNotification.send()
.then((result) => {
}).catch((error) => {
});
const notification = new HipChatRoomNotification('https://www.example.com', '1', 'abcd1234');
notification.setFrom('From');
notification.setColor('green');
notification.shouldNotify();
notification.setMessage('My message.');
notification.addCard('1', 'file', 'Title');
notification.send()
.then((result) => {
}).catch((error) => {
});
const notification = new HipChatRoomNotification('https://www.example.com', '1', 'abcd1234');
notification.setFrom('From');
notification.setColor('green');
notification.shouldNotify();
notification.setMessage('My message.');
notification.addCard('1', 'file', 'Title');
notification.addCardAttribute('Size', '128kb', 'lozenge-success');
notification.addCardAttribute('Date', '12/27/2017', 'lozenge-success');
notification.send()
.then((result) => {
}).catch((error) => {
});
Please see CONTRIBUTING.md.
Please see CHANGELOG.md.
Copyright (c) 2017-2020 Thomas Lindner. Licensed under the MIT license.