Last active
December 19, 2015 14:09
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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