Skip to content

Instantly share code, notes, and snippets.

@sushant12
Created September 8, 2017 06:06
Show Gist options
  • Select an option

  • Save sushant12/188d922edb3efa07c4c04c32b3b8299b to your computer and use it in GitHub Desktop.

Select an option

Save sushant12/188d922edb3efa07c4c04c32b3b8299b to your computer and use it in GitHub Desktop.
uri = URI.parse("https://oapi.dingtalk.com/robot/send")
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
req = Net::HTTP::Post.new(uri.path.concat("?access_token=#{setting_chat.token}"))
req['Content-Type'] = 'application/json'
# req['charset'] = 'UTF-8'
req.body = {
"msgtype": "text",
"text": {
"content": "Hello world"
}
}.to_json
res = https.request(req)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment