How do I close a Slack Modal Windows using Postman

Hi all.

I created an application using Postman and Slack, but I’m having some trouble to close a modal window in Slack. How do I send a HTTP 200 (OK) to Slack using Postman?

I tried sending a response to slack using the code below but Slack did not close the modal window.

// #### Responding to SLACK MODAL WINDOW HTTP 200 OK !! ###############
const echoPostRequest = {
url: return_url,
code: 200,
status: ‘ok’,
status_code: 200,
statusCode: 200,
method: ‘POST’,
header: {
‘content-type’ : ‘application/json’
},
body: {
mode: ‘raw’,
raw: JSON.stringify({})
}
};
pm.sendRequest(echoPostRequest, function (err, res) {
console.log(err ? err : res.json());
});

Should I use the Postman’s user interface to send my response to Slack? How you I fill in the HTTP 200? In the headers or Parameters tabs?

Can any one help with both solution? Using pm.send request and using Postman interface?

Thank you!

Hi @marcelorohrs!

You may want to try sending this request using the interface first, so that you can see response information and suss out any possible errors.

Hi @john-paul !

Thank you for the return… But how do I send a HTTP 200 using the Postman interface? Where do I “put” the 200 or the OK status?

Hmm, 200 is a response code — the API you’re working with (in this case, Slack) will send it back to indicate your request was successful.

Can you point me to the request you need to send (i.e. Slack’s documentation for it)? I can show you how to set up this request in Postman.

This what in Slack documentation:

Close the current view

If your app responds to a view_submission event with a basic acknowledgment response— an HTTP 200 response — this will immediately close the submitted view, and remove it from the view stack.

But, how do I send a simple HTTP 200 using the Postman Interface (or if it’s easier, through the pm.sendRequest function).

Thanks.

Hmm, I don’t think this can be done in Postman — Postman isn’t setup to respond as a server would.

What does the Slack app you’re building do, and how is it setup? How does Postman fit into what you’re trying to do?

Hi @john-paul,

I’m using Postman’s webhooks to receive SLACK’s HTTP requests, after receiving a SLACK request, I process in Postman collection and and than, Postman sends HTTP requests to SLACK. The return to SLACK can be a simple message, or a “command” to open/close/update a modal window). It has worked perfectly, until now… Just because I don’t know how to setup Postman HTTP request as a HTTP 200 (OK Response) to Slack.

Any ideas?

Thanks!

Hi, Is there any workaround? I am also stuck in the same issue. Not able to close slack modal through postman