Created
January 23, 2019 10:42
-
-
Save 1c7/5b7db41613da0b51a596ebbbee4e62d3 to your computer and use it in GitHub Desktop.
Slack webhook example curl->Ruby
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
class SlackIdVerifyJobJob < ApplicationJob | |
queue_as :default | |
def perform() | |
# curl -X POST -H 'Content-type: application/json' --data '{"text":"Hello, World!"}' https://hooks.slack.com/services/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 | |
# Equivalent ruby code: | |
url = "https://hooks.slack.com/services/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" | |
options = { | |
body: {"text": "Hello, World!"}.to_json, | |
headers: {"Content-Type" => "application/json"}, | |
} | |
response = HTTParty.post(url, options) | |
puts response | |
end | |
end |
Author
1c7
commented
Jan 23, 2019
Slack use curl for example
this gist turn curl example into Ruby code.
you can copy&paste into your project
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment