s

気軽に Hipchat に通知する方法

デプロイ自動化とServerspec

例えばHipChatの場合は以下のようなスクリプトを準備しておくと良い.シェルスクリプトなので何にでも組み込める.

notify() {
  local USER=$1
  local MESSAGE=$2
    
  JSON="{
    \"message_format\": \"text\",
    \"message\": \"@${USER} ${MESSAGE}\",
    \"notify\": true
  }"
    
  curl -X POST \
      -H "Content-Type: application/json" \
      -d "${JSON}" \
      https://api.hipchat.com/v2/room/...
}

以下のように使う.

$ notify Taichi "Service out is done!"