Skip to content

Instantly share code, notes, and snippets.

@markets markets/chat_publisher.rb
Last active Dec 19, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.