Satchel
Satchel

Reputation: 16724

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

I use the following to post to 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'

I get the following error:

RestClient::InternalServerError: 500 Internal Server Error

The post appears to be posting correctly when I check it on request_bin, so I am unclear how to resolve this error.

Upvotes: 1

Views: 4374

Answers (1)

osman
osman

Reputation: 2469

Try

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

Upvotes: 1

Related Questions