Skip to content

Instantly share code, notes, and snippets.

@markets
Last active December 19, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markets/5966725 to your computer and use it in GitHub Desktop.
Save markets/5966725 to your computer and use it in GitHub Desktop.
Ruby methods to publish content into some chat systems. No API clients or gems required, just curl.
# Publish messages to Hipchat https://www.hipchat.com
def publish_to_hipchat(room_id, msg, from, format, color, auth_token)
`curl -X POST -d "room_id=#{room_id}&message=#{msg}&from=#{from}&message_format=#{format}&color=#{color}" \
"https://api.hipchat.com/v1/rooms/message?auth_token=#{auth_token}"`
end
# Publish messages to Talker http://talkerapp.com
def publish_to_talker(room_id, msg, auth_token)
`curl -H 'Accept: application/json' -H 'Content-Type: application/json' \
-H 'X-Talker-Token: "#{auth_token}"' \
-d '{"message":"#{msg}"}' \
"https://talkerapp.com/rooms/#{room_id}/messages.json"`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment