cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Using POST with Send request via HTTP doesn't work well

Mieko
Deputy Chef I
Deputy Chef I

Hi, teams. I want to use [Send request via HTTP]App to send messages to the Slack incoming webhook.Since icon_emoji and username are required, I am using HTTP request instead of Slack Post APP.I have completed setting up an incoming webhook in Slack and completed setting up Connection in Workato.

When I run it, I can send text to Slack, but for some reason the recipe causes an error. It says it's a JSON error, but I have no idea. Does anyone know the cause?

{
"request_name": "Send request",
"request": {
"method": "POST",
"content_type": "application/json",
"url": "https://hooks.slack.com/services/XXXXXXXX/XXXXXXXXXXX/AAAAAAAAAAAAAAAAAAA",
"body": "{\"text\": \"Test for sending to Slack \", \"username\": \"Grey Kitty\", \"icon_emoji\": \":sendai:\"}"
},
"response": {
"output_type": "json",
"expected_encoding": "UTF-8",
"ignore_http_errors": "false"
}
}

 Error

unexpected token at 'ok'

 Debug

NETWORK TRACE
POST
200 https://hooks.slack.com/services/XXXXXXXX/XXXXXXXXXXX/AAAAAAAAAAAAAAAAAAA

 

1 ACCEPTED SOLUTION

Mieko
Deputy Chef I
Deputy Chef I

The issue has been resolved.

The problem was due to setting the Response Content Type to JSON in the APP Response section.

Changing it to TEXT resulted in successful completion.

View solution in original post

2 REPLIES 2

Mieko
Deputy Chef I
Deputy Chef I

The issue has been resolved.

The problem was due to setting the Response Content Type to JSON in the APP Response section.

Changing it to TEXT resulted in successful completion.

Hey @Mieko, thanks for sharing your solution! I'm sure it will be super helpful for anyone else in the community that runs into a similar issue. ๐Ÿ˜Š