Code Monkey home page Code Monkey logo

hipchat-addon's Introduction

HipChat Bot Addon

HipChat room addon using api v2 webhooks in Ruby / Sinatra + Grape

Screenshot

Getting Started

You need to be the room owner of the hipchat room.

Setup

Local Setup

Install MongoDB

Run mongod

mongod --config /usr/local/etc/mongod.conf

Install ngrok

Install Bundle

bundle install

Then run ngrok on your server port (default: 9292)

ngrok 9292

Hint your can point your browser to point your browser to http://localhost:4040 to have a better understanding of what are the HEADERS / params passed.

Edit the configuration in app.rb:

configure do
    ENV['HIPCHAT_SCOPES'] = "send_notification admin_room"
    if ENV['RACK_ENV'] != 'production'

        #Development settings : ngrok tunnel url + mongodb db
        ENV['BASE_URI'] = 'YOUR NGROK TUNNEL URL'
        ENV['MONGOHQ_URL'] = 'mongodb://127.0.0.1:27017/test' #Local Mongo Database
    end
    MongoMapper.setup({
        ENV['RACK_ENV'] => { 'uri' => ENV['MONGOHQ_URL']}
    }, ENV['RACK_ENV'])
end

Run your server

rackup -E "development"

Access to the root url (/) of your application and click the Install link.

Chat with HotBot !

Heroku Setup

Assuming you have the Heroku Toolbelt installed

heroku apps:create <add-on-name>
heroku config:set RACK_ENV=production
heroku config:set BASE_URI=http://<add-on-name>.herokuapp.com
heroku addons:add mongohq
git add .
git commit -m "Heroku init"
git remote add heroku [email protected]:<add-on-name>.git
git push heroku master

Access to the root url (/) of your application and click the Install link.

Never sleeping Heroku app

Your heroku free app will idle after 1hour, which can kinda be bad Use Kaffeine to register your website and prevent idling

Documentation

Debugging: Pry Gem

Simply add

binding.pry

Anywhere and access your console to inspect what's going on

Testing your calls with curl HipChat Auth Api:

Generate your user token on the website https://www.hipchat.com/account/api:

Get your room API Id https://hipchat.com/rooms then click on the room name

curl -X POST https://api.hipchat.com/v2/room/<YOUR-ROOM-ID>/notification?auth_token=<YOUR-TOKEN> -d '{"message": "TEST"}' -H "Content-Type: application/json

HipChat WebHooks HipChat Atlassian NodeJS implementation

Features

Currently supports:

  • !quote to display a movie quote game Answers should be made with =<yourAnswer>

  • Answers to its name with CleverBot api Hi HotBot !

  • #word outputs gif about tagged as word #cat

Feel free to contact me if anything is going wrong.

hipchat-addon's People

Contributors

elyx0 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

romainberger

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.