Coder Social home page Coder Social logo

tobeychris / hipchat-room-message-apiv2 Goto Github PK

View Code? Open in Web Editor NEW
20.0 6.0 17.0 14 KB

This is a simple perl script that will use Hipchat's API v2 to message a room after passing in the room name, authentication token and a message. Also includes features for selecting the colour, notifying the room, passing in an html message, using a proxy and using API v1 should you so choose.

License: GNU General Public License v2.0

Perl 100.00%

hipchat-room-message-apiv2's Introduction

hipchat-room-message-APIv2

This is a simple perl script that will use Hipchat's API v2 to message a room after passing in the room name, authentication token and a message. Also includes features for selecting the colour, notifying the room, passing in an html message, using a proxy and using API v1 should you so choose.

This script was developed in a CentOS 6.4 environment and has not been tested anywhere else.

Sample Script Output

This script will send a notification to hipchat.

Usage:
    -room      Hipchat room name or ID.                      Example: '-room "test"'
    -token     Hipchat Authentication token.                 Example: '-token "abc"'
    -message   Message to be sent to room.                   Example: '-message "Hello World!"'
    -type      (Optional) Hipchat message type (text|html).  Example: '-type "text"'                   (default: text)
    -API       (Optional) Hipchat API Version. (v1|v2).      Example: '-type "v2"'                     (default: v2)
    -notify    (Optional) Message will trigger notification. Example: '-notify "true"'                 (default: false)
    -colour    (Optional) Message colour (y|r|g|p|g|random)  Example: '-colour "green"'                (default: yellow)
    -from      (Optional) Name message is to be sent from.   Example: '-from "Test"'                   (only used with APIv1)
    -proxy     (Optional) Network proxy to use.              Example: '-proxy "http://127.0.0.1:3128"'
    -host      (Optional) Hipchat server to use.             Example: '-host "https://hipchat.company.net"'

Basic Example:
    hipchat.pl -room "test" -token "abc" -message "Hello World!"

Full Example:
    hipchat.pl -room "test" -token "abc" -message "Hello World!" -type text -api v2 -notify true -colour green -proxy http://127.0.0.1:3128

Environment Configuration

In addition to the command line parameters, you can also set configuration values in your environment:

$ export HIPCHAT_TOKEN=abc
$ export HIPCHAT_ROOM=Jenkins
$ export HIPCHAT_PROXY=http://127.0.0.1:3128

Sample Successful Call

$ hipchat.pl -message 'Hello World!' -colour green
Hipchat notification posted successfully.

Sample Unsuccessful Call (bad token)

$ hipchat.pl -token abd -message 'Hello World!' -colour green
Hipchat notification failed!
401 Unauthorized

hipchat-room-message-apiv2's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hipchat-room-message-apiv2's Issues

Desktop Notifications

Hi

When I try to send a message without notifying the room I still get popups in the Windows client. An example call is below

./hipchat.pl -room "Cluster" -token "TOK" -message "Server Online" -type text -api v2 -notify false -colour green

Am I using the disable function correctly?

Contributing to your project?

Hey,

I am using your project for Hipchat notifs and it works great! I do miss the card support though and I have added this in my local repo. I tried to push this for you to review in a Pull Request but I get permission denied.
Can you please add permissions for me to push my branch?

Cheers,
// Svante

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.