Giter Site home page Giter Site logo

send-hipchat-message's Introduction

Send HipChat Messages via Ruby Script

Use this repository if you wish to send HipChat messages to any given room via a Ruby script through Hubot.

Description

This is used to send "Get Up!" notifications every 15 minutes. We use this to remind us to stand up, stretch out, and maybe walk around, every 15 minutes throughout the work day.

Usage

This uses Ruby Gems, along with Bundler for dependency management. See the websites for isntallation instructions.

Remember to run bundle install.

You must create your own .env file and store it in the root of this repository in order for the script(s) to work as expected. The script(s) use dotenv to load the environment variables. The .env file is not, and should not be in source control.

The format for the .env file should be as follows:

HUBOT_BADGER_KEY=<your key>
HUBOT_REMIND_URL=<your hubot remind endpoint>

For more on the HUBOT_REMIND_URL, see this repository.

Use the script send_message_to_room.rb to send a message to any room. This script requires 2 command line arugments:

  • 1st argument is the room XXMP JID (which can be found on the HipChat web client; see image below)
  • 2nd argument is the message text

Example:

ruby send_message_to_room.rb [email protected] "Get up and stretch."

We use crontab to schedule reminders to send the get up notification. We made a script to call the Ruby script to send the message. We didn't commit this, because it contains sensitive information, such as the room XMPP JID.

GOTCHYA: Since this Ruby script has dependencies, they need to be installed in the environment in which cron runs. To do this, use the command rvm cron setup to setup the rvm environment inside the cron environment.

The crontab instruction is this:

15,30,45,59 15-16,18-21 * * 1-5 sh /path/to/repo/send_get_up_message.sh 

This calls send_get_up_message.sh on the 15, 30, 45, and 59 minute mark of every hour from 15:00-21:00 (UTC time), excluding from 17:00-18:00 (lunch), Monday-Friday. For more information about cronjobs, check out this.

send-hipchat-message's People

Contributors

jrmsklar avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

jrmsklar

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.