通过 Ruby rest_client 使用 Slack 的传入 Webhook 时出现 500 错误

Getting 500 error when using Slack's incoming Webhook via a Ruby rest_client

我使用以下 post 到 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 Internal Server Error

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

尝试

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