{"id":18742457,"url":"https://github.com/hipchat/hipchat-rb","last_synced_at":"2025-05-15T10:06:20.612Z","repository":{"id":1142373,"uuid":"1023299","full_name":"hipchat/hipchat-rb","owner":"hipchat","description":"HipChat HTTP API Wrapper in Ruby with Capistrano hooks","archived":false,"fork":false,"pushed_at":"2018-03-23T11:06:36.000Z","size":397,"stargazers_count":336,"open_issues_count":12,"forks_count":170,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-04-14T16:56:46.240Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.hipchat.com/docs/apiv2","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hipchat.png","metadata":{"files":{"readme":"README.textile","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-10-25T19:20:10.000Z","updated_at":"2024-08-08T15:19:01.000Z","dependencies_parsed_at":"2022-08-16T12:15:16.644Z","dependency_job_id":null,"html_url":"https://github.com/hipchat/hipchat-rb","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hipchat%2Fhipchat-rb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hipchat%2Fhipchat-rb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hipchat%2Fhipchat-rb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hipchat%2Fhipchat-rb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hipchat","download_url":"https://codeload.github.com/hipchat/hipchat-rb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254319718,"owners_count":22051072,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T16:07:53.971Z","updated_at":"2025-05-15T10:06:20.331Z","avatar_url":"https://github.com/hipchat.png","language":"Ruby","readme":"h1. HipChat Wrapper\n\nA very basic wrapper for the HipChat HTTP API.\n\nh2. CI Status\n\n\"!https://travis-ci.org/hipchat/hipchat-rb.svg!\":https://travis-ci.org/hipchat/hipchat-rb\n!https://coveralls.io/repos/hipchat/hipchat-rb/badge.svg(Coverage Status)!:https://coveralls.io/r/hipchat/hipchat-rb\n\nh2. Requirements\n* Ruby 2.0.0 or higher\n* HipChat Account, sign up \"here!\":https://hipchat.com/\n\nh2. Installation\n\nh3. Gemfile\n\nbc. gem 'hipchat'\n\nh3. Install\n\nbc. gem install hipchat\n\nh1. Usage\n\nh2. \"API v1\":https://www.hipchat.com/docs/api\n\nbc.. client = HipChat::Client.new(api_token, :api_version =\u003e 'v1')\n# Set http proxy\nclient = HipChat::Client.new(api_token, :api_version =\u003e 'v1', :http_proxy =\u003e 'http://proxy_host:proxy_port')\n\n# 'username' is the name for which the message will be presented as from\nclient['my room'].send('username', 'I talk')\n\n# Send notifications to users (default false)\nclient['my room'].send('username', 'I quit!', :notify =\u003e true)\n\n# Color it red. or \"yellow\", \"green\", \"purple\", \"random\" (default \"yellow\")\nclient['my room'].send('username', 'Build failed!', :color =\u003e 'red')\n\n# Have your message rendered as text in HipChat (see https://www.hipchat.com/docs/api/method/rooms/message)\nclient['my room'].send('username', '@coworker Build faild!', :message_format =\u003e 'text')\n\n# Update the topic of a room in HipChat (see https://www.hipchat.com/docs/api/method/rooms/topic)\nclient['my room'].topic('Free Ice Cream in the kitchen')\n\n# Change the from field for a topic update (default \"API\")\nclient['my room'].topic('Weekely sales: $10,000', :from =\u003e 'Sales Team')\n\n# Get history from a room\nclient['my room'].history()\n\n# Get history for a date in time with a particular timezone (default is latest 75 messages, timezone default is 'UTC')\nclient['my room'].history(:date =\u003e '2010-11-19', :timezone =\u003e 'PST')\n\n# Create a new room, V1 requires owner_user_id (see https://www.hipchat.com/docs/api/method/rooms/create)\nclient.create_room(\"Name\", :owner_user_id =\u003e 'user_id')\n\nh2. \"API v2\":https://www.hipchat.com/docs/apiv2\n\nbc.. client = HipChat::Client.new(api_token)\n# Set http proxy\nclient = HipChat::Client.new(api_token, :http_proxy =\u003e 'http://proxy_host:proxy_port')\n\n# 'username' is the name for which the message will be presented as from\nclient['my room'].send('username', 'I talk')\n\n# Send notifications to users (default false)\nclient['my room'].send('username', 'I quit!', :notify =\u003e true)\n\n# Color it red. or \"yellow\", \"green\", \"purple\", \"random\" (default \"yellow\")\nclient['my room'].send('username', 'Build failed!', :color =\u003e 'red')\n\n# Have your message rendered as text in HipChat (see https://www.hipchat.com/docs/apiv2/method/send_room_notification)\nclient['my room'].send('username', '@coworker Build faild!', :message_format =\u003e 'text')\n\n# Update the topic of a room in HipChat (see https://www.hipchat.com/docs/apiv2/method/set_topic)\nclient['my room'].topic('Free Ice Cream in the kitchen')\n\n# Change the from field for a topic update (default \"API\")\nclient['my room'].topic('Weekely sales: $10,000', :from =\u003e 'Sales Team')\n\n# Get history from a room\nclient['my room'].history()\n\n# Get history for a date in time with a particular timezone (default is latest 75 messages, timezone default is 'UTC')\nclient['my room'].history(:date =\u003e '2010-11-19', :timezone =\u003e 'PST')\n\n# Get statistics from a room\nclient['my room'].statistics()\n\n# Create a new room (see https://www.hipchat.com/docs/apiv2/method/create_room)\nclient.create_room(\"Name\", options = {})\n\n# Get room data (see https://www.hipchat.com/docs/apiv2/method/get_room)\nclient['my room'].get_room\n\n# Update room data (see https://www.hipchat.com/docs/apiv2/method/update_room)\nIt's recommended to call client['my room'].get_room then pass in modified hash attributes to #update_room\nclient['my room'].update_room(options = {})\n\n# Delete room (see https://www.hipchat.com/docs/apiv2/method/delete_room)\nclient['my room'].delete_room\n\n# Invite user to room (see https://www.hipchat.com/docs/apiv2/method/invite_user)\nclient['my room'].invite(\"USER_ID_OR_NAME\", options = {})\n\n# Sends a user a private message. Valid value for user are user id or email address\nclient.user('foo@bar.org').send('I can send private messages')\n\n# Update a user status.  Available options for show are 'away', 'chat', 'dnd', 'xa'\nclient.user('foo@bar.org').status('this is my status',\n        :name=\u003e'Foo Bar',\n        :status=\u003e'Doing very important stuff',\n        :show=\u003e'xa',\n        :mention_name=\u003e'foo',\n        :email=\u003e'foo@barr.org')\n\n\nh2. Custom Server URL\n\nbc.. client = HipChat::Client.new(api_token, :server_url =\u003e 'https://domain.com')\n# 'username' is the name for which the message will be presented as from\nclient['my room'].send('username', 'I talk')\n\n# Send notifications to users (default false)\nclient['my room'].send('username', 'I quit!', :notify =\u003e true)\n\n# Color it red. or \"yellow\", \"green\", \"purple\", \"random\" (default \"yellow\")\nclient['my room'].send('username', 'Build failed!', :color =\u003e 'red')\n\n# Have your message rendered as text in HipChat (see https://www.hipchat.com/docs/apiv2/method/send_room_notification)\nclient['my room'].send('username', '@coworker Build faild!', :message_format =\u003e 'text')\n\n# Update the topic of a room in HipChat (see https://www.hipchat.com/docs/apiv2/method/set_topic)\nclient['my room'].topic('Free Ice Cream in the kitchen')\n\n# Change the from field for a topic update (default \"API\")\nclient['my room'].topic('Weekely sales: $10,000', :from =\u003e 'Sales Team')\n\n# Get history from a room\nclient['my room'].history()\n\n# Get history for a date in time with a particular timezone (default is latest 75 messages, timezone default is 'UTC')\nclient['my room'].history(:date =\u003e '2010-11-19', :timezone =\u003e 'PST')\n\n# Create a new room (see https://www.hipchat.com/docs/apiv2/method/create_room)\nclient.create_room(\"Name\", options = {})\n\n# Get room data (see https://www.hipchat.com/docs/apiv2/method/get_room)\nclient['my room'].get_room\n\n# Update room data (see https://www.hipchat.com/docs/apiv2/method/update_room)\nIt's easiest to call client['my room'].get_room, parse the json and then pass in modified hash attributes\nclient['my room'].update_room(options = {})\n\n# Invite user to room (see https://www.hipchat.com/docs/apiv2/method/invite_user)\nclient['my room'].invite(\"USER_ID_OR_NAME\", options = {})\n\n# Sends a user a private message. Valid value for user are user id or email address\nclient.user('foo@bar.org').send('I can send private messages')\n\nh2. Capistrano\n\nCapfile\n\nbc. require 'hipchat/capistrano'\n\ndeploy.rb\n\nbc.. # Required\nset :hipchat_token, \"\u003cyour token\u003e\"\nset :hipchat_room_name, \"Your room\" # If you pass an array such as [\"room_a\", \"room_b\"] you can send announcements to multiple rooms.\n# Optional\nset :hipchat_enabled, true # set to false to prevent any messages from being sent\nset :hipchat_announce, false # notify users\nset :hipchat_color, 'yellow' #normal message color\nset :hipchat_success_color, 'green' #finished deployment message color\nset :hipchat_failed_color, 'red' #cancelled deployment message color\nset :hipchat_message_format, 'html' # Sets the deployment message format, see https://www.hipchat.com/docs/api/method/rooms/message\nset :hipchat_options, {\n  :api_version  =\u003e \"v2\" # Set \"v2\" to send messages with API v2\n}\n\nh3. Who did it?\n\nTo determine the user that is currently running the deploy, the capistrano tasks will look for the following:\n\n# The $HIPCHAT_USER environment variable\n# The hipchat_human capistrano var.\n# The git user.name var.\n# The $USER environment variable.\n\nh3. Commit log notification (only for Capistrano 2)\n\nSend commit log with deploy notification. We currently support git and svn.\n\nbc.. set :hipchat_commit_log, true\n# Optional\nset :hipchat_commit_log_format, \":time :user\\n:message\\n\"\nset :hipchat_commit_log_time_format, \"%Y/%m/%d %H:%M:%S\"\nset :hipchat_commit_log_message_format, \"^PROJECT-\\d+\" # extracts ticket number from message\n\nh2. Rails 3 Rake Task\n\nSend a message using a rake task:\n\nbc. rake hipchat:send[\"hello world\"]\n\nor\n\nbc. rake hipchat:send MESSAGE=\"hello world\"\n\nOptions like the room, API token, user name and notification flag can be set in YAML.\n\nRAILS_ROOT/config/hipchat.yml:\n\nbc.. token: \"\u003cyour token\u003e\"\nroom: [\"Room name(s) or id(s)\"] # this is an array\nuser: \"Your name\" # Default to `whoami`\nnotify: true # Defaults to false\napi_version: \"v2\" # optional, defaults to v2\ncolor: \"yellow\"\n\nh2. Engine Yard\n\nUse a \"deploy hook\":http://bit.ly/qnbIkP to send messages from Engine Yard's Cloud platform.\n\nRAILS_ROOT/deploy/after_restart.rb:\n\nbc.. on_app_master do\n  message  = \"Deploying revision #{config.active_revision} to #{config.environment_name}\"\n  message += \" (with migrations)\" if config.migrate?\n  message += \".\"\n\n  # Send a message via rake task assuming a hipchat.yml in your config like above\n  run \"cd #{config.release_path} \u0026\u0026 bundle exec rake hipchat:send MESSAGE='#{message}'\"\nend\n\nh2. Chef Handler\n\n*APIv1 ONLY, use APIv1 Key*\nNOTE: APIv2 required for HipChat Server \u0026 HipChat Data Center\n\nReport on Chef runs.\n\nh3. Within a Recipe:\n\nbc.. include_recipe 'chef_handler'\n\ngem_package 'hipchat'\n\nchef_handler 'HipChat::NotifyRoom' do\n  action :enable\n  arguments ['API_KEY', 'HIPCHAT_ROOM']\n  source File.join(Gem.all_load_paths.grep(/hipchat/).first,\n                   'hipchat', 'chef.rb')\nend\n\nh3. With client.rb:\n\nbc..    require 'hipchat/chef'\n   hipchat_handler = HipChat::NotifyRoom.new(\"API_KEY\", \"HIPCHAT_ROOM\")\n   exception_handlers \u003c\u003c hipchat_handler\n\nh3. With HipChat Data Center and HipChat Server\n\nAdd an \"options\" hash to set your URL:\n* arguments ['API_KEY', 'HIPCHAT_ROOM', options={hipchat_options: {server_url: \"https://hipchat.example.com\"}}]\n* hipchat_handler = HipChat::NotifyRoom.new(\"API_KEY\", \"HIPCHAT_ROOM\", options={hipchat_options: {server_url: \"https://hipchat.example.com\"}})\n\nh2. Copyright\n\nCopyright (c) 2017 Atlassian. See LICENSE for details.\n","funding_links":[],"categories":["Third-party APIs"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhipchat%2Fhipchat-rb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhipchat%2Fhipchat-rb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhipchat%2Fhipchat-rb/lists"}