Closed mcritchlow closed 4 years ago
This is fairly do-able(see sample script below):
I think formatting is going to be the only real pain here.
require 'net/http'
require 'uri'
require 'json'
def notify_slack(webhook_url, text)
payload = {
:text => text,
}.to_json
uri = URI.parse(webhook_url)
header = {'Content-Type': 'application/json'}
# Create the HTTP objects
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
request = Net::HTTP::Post.new(uri.request_uri, header)
request.body = payload
# Send the request
response = https.request(request)
end
# takes emojis, links, etc.
notify_slack('<hook-url>', 'Hello, from Ruby :smile: <https://"prod server"/recognitions/1234|A link to a Recognition>')
Descriptive summary
Internal Communications would like to have High Five recognitions posted to the
#general
channel in Slack. Create a webhook which is triggered when a Recognition is successfully created.Desired look from Kacy (thanks to @jessicahilt):
Questions to address:
Rationale
More High Five! visibility :hand: