-
-
Save vedant1811/68018643a380fe9e9e58d822904c611f to your computer and use it in GitHub Desktop.
This file contains 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
require 'net/http' | |
uri = URI.parse 'https://hooks.slack.com/services/...' | |
# Create the HTTP objects | |
http = Net::HTTP.new(uri.host, uri.port) | |
request = Net::HTTP::Post.new(uri.request_uri) | |
request.body = '{"text": "This is a line of text in a channel.\nAnd this is another line of text."}' | |
# Send the request | |
response = http.request(request) | |
puts "slack response #{response.body}" |
This file contains 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
slack response <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> | |
<TITLE>ERROR: The request could not be satisfied</TITLE> | |
</HEAD><BODY> | |
<H1>ERROR</H1> | |
<H2>The request could not be satisfied.</H2> | |
<HR noshade size="1px"> | |
Bad request. | |
<BR clear="all"> | |
<HR noshade size="1px"> | |
<PRE> | |
Generated by cloudfront (CloudFront) | |
Request ID: xJyUEpQt9DLs-G_5tmey_0t4sMrCY-GnNO8QL9DKsMP6giMDdmvw7g== | |
</PRE> | |
<ADDRESS> | |
</ADDRESS> | |
</BODY></HTML> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment