0

We are building an interactive app and published a view on our home tab which contains a button. We are using .net core web API to process Slack events. We subscribed "app_home_opened" event from our app configuration and the event is successfully received at the "request URL".

After clicking the button on the home tab we should receive an interaction payload at the "request URL" but we saw an error with error code 415 on the Slack app UI.

Please help us to find a solution.

Web API code

Slack app UI and error

2 Answers2

0

Slack UI posts data as application/x-www-form-urlencoded. So when you try to reach HttpContext.Request.Body you'll receive a 415 Unsupported Media Type Error.

Try reading data from HttpContext.Request.Form

0

Slack UI post data in post request body but server endpoints give Status code 415. Use StreamReader to read body data and your problem will be solved.

 string bodyStr = string.Empty;

        // Read data from body
        using (StreamReader reader
                  = new StreamReader(httpRequest.Body, Encoding.UTF8, true, Constants.BufferSize, true)) {
            bodyStr = reader.ReadToEnd();
        }