通过Ruby rest_client

时间:2015-06-06 05:03:05

标签: ruby rest-client slack-api

我使用以下内容发布到Slack's incoming Webhook

slack_incoming_webhook = 'URL....."
payload={
        "text"=> bot_response[:bot_response],
         "channel"=>"@mememem"
    }

jsonresponse = RestClient.post slack_incoming_webhook, payload, :content_type => 'application/json'

我收到以下错误:

  

RestClient :: InternalServerError:500内部服务器错误

当我在request_bin上检查时,帖子似乎正确发布,所以我不清楚如何解决此错误。

1 个答案:

答案 0 :(得分:1)

尝试

require 'json'
payload={   
        "text"=> bot_response[:bot_response],
         "channel"=>"@mememem"
    }.to_json