I am using the node Human in loop for slack with 2 button approve and disapprove. when anyone click on any button it redirect to new tab, But I want to stay in slack.
When using Human in the Loop in Slack with buttons (e.g., Approve / Disapprove), Slack sometimes opens a new browser tab when users click a button.
This happens when the button is configured with a url
, which causes Slack to redirect.
Solution
To achieve this, you need to use Slack Block Kit buttons and configure Slack Interactivity to post back to an n8n Webhook
.
Step 1: Enable Interactivity in Slack
- Go to your Slack App at: Slack API: Applications | Slack
- Under Features → Interactivity & Shortcuts, enable Interactivity.
- Set the Request URL to point to a Webhook in n8n (see next step).
Step 2: Create a Webhook in n8n
- In your n8n workflow, add a
Webhook
node. - Configure it with:
- HTTP Method: POST
- Path: e.g.,
/slack-interaction
- Make sure the webhook is accessible publicly (use
n8n.cloud
or a tunnel in local dev). - Copy the full webhook URL and paste it in the Slack Interactivity settings (Step 1).
Step 3: Send Slack Message with Buttons (NO URLs!)
Use the Slack → Send Message
node and set the blocks
field (JSON mode):
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Do you approve this request?"
}
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "Approve"
},
"style": "primary",
"value": "approve_action",
"action_id": "approve_button"
},
{
"type": "button",
"text": {
"type": "plain_text",
"text": "Disapprove"
},
"style": "danger",
"value": "disapprove_action",
"action_id": "disapprove_button"
}
]
}
]
}
Important:
Do not use the url
property inside the button — this causes Slack to open a new tab.
Use action_id
and value
instead.
Step 4: Handle Button Response in Webhook
When a user clicks a button, Slack will send a payload
to your webhook. Example:
{
"payload": {
"actions": [
{
"action_id": "approve_button",
"value": "approve_action"
}
],
"user": {
"id": "U123456"
},
...
}
}
Final Tips
- Avoid using
url
on buttons if you want to stay in Slack. - Use
action_id
+value
and connect Slack’s Interactivity feature to ann8n Webhook
. - This allows approval flows to stay entirely within Slack without redirecting the user.
1 Like
Thanks! I will try this.
Responding here so this thread will not close