Issue with interactivity event from Slack

Issue with interactivity event from Slack

Issue with interactivity event from Slack

Describe the problem/error/question

Trying to receive an interactivity webhook from Slack

What is the error message (if any)?

See below

Please share your workflow

{
“nodes”: [
{
“parameters”: {
“trigger”: [
“any_event”
],
“watchWorkspace”: true,
“options”: {}
},
“type”: “n8n-nodes-base.slackTrigger”,
“typeVersion”: 1,
“position”: [
0,
0
],
“id”: “610f4d83-85ce-456c-ad07-3b85d74a04ed”,
“name”: “Slack Trigger”,
“webhookId”: “d183c0bb-2bf3-49f5-a9a5-2ac4d7549415”,
“credentials”: {
“slackApi”: {
“id”: “atrwGkx7oI8OI098”,
“name”: “Slack account”
}
}
}
],
“connections”: {},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “5b23abe618f773219dc999b8444a1f44e0b4cd589dedb6d7a9561276d40ae76f”
}
}

Share the output returned by the last node

{
“errorMessage”: “Cannot read properties of undefined (reading ‘type’)”,
“errorDetails”: {},
“n8nDetails”: {
“n8nVersion”: “1.107.4 (Cloud)”,
“binaryDataMode”: “filesystem”,
“stackTrace”: [
“TypeError: Cannot read properties of undefined (reading ‘type’)”,
" at WebhookContext.webhook (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Slack/SlackTrigger.node.ts:344:36)“,
" at WebhookService.runWebhook (/usr/local/lib/node_modules/n8n/src/webhooks/webhook.service.ts:357:8)”,
" at Object.executeWebhook (/usr/local/lib/node_modules/n8n/src/webhooks/webhook-helpers.ts:467:24)"
]
}
}

Information on your n8n setup

  • n8n version: 1.107.4

  • Database (default: SQLite): not sure (haven’t changed the default)

  • n8n EXECUTIONS_PROCESS setting (default: own, main): not sure (haven’t changed the default)

  • Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud

  • Operating system: NA

Hey @joaquincoitino so you’re having trouble with receiving an interactivity webhook from Slack? Let’s take a closer look.

The error message “Cannot read properties of undefined reading ‘type’ may mean that the Slack trigger node is expecting a ‘type’ property in the incoming data, but it’s not finding it. Have you checked the Slack API docs to see if the ‘type’ property is supposed to be sent in the webhook data?

Also, can you double check your node configuration to make sure everything is set up correctly? Maybe there’s a small tweak that needs to be made.

1 Like

Hello @Brighto, thanks.

Node config is this:
{
“nodes”: [
{
“parameters”: {
“trigger”: [
“any_event”
],
“watchWorkspace”: true,
“options”: {}
},
“type”: “n8n-nodes-base.slackTrigger”,
“typeVersion”: 1,
“position”: [
0,
0
],
“id”: “610f4d83-85ce-456c-ad07-3b85d74a04ed”,
“name”: “Slack Trigger”,
“webhookId”: “d183c0bb-2bf3-49f5-a9a5-2ac4d7549415”,
“credentials”: {
“slackApi”: {
“id”: “atrwGkx7oI8OI098”,
“name”: “Slack account”
}
}
}
],
“connections”: {},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “5b23abe618f773219dc999b8444a1f44e0b4cd589dedb6d7a9561276d40ae76f”
}
}

Seems like there is a property “type” in the incoming data according to Slack Handling user interaction in your Slack apps | Slack

From what I see @joaquincoitino your Slack Trigger node is set up to trigger on “any_event”, which is a good start. But when you’re working with interactivity webhooks, Slack usually sends specific types of events, like “block_actions” or “interactive_message”.

you need to tweak the node configuration to listen for those specific event types? Or you add a Switch node after the Slack Trigger node to handle different event types.

1 Like

Thanks @Brighto but I only have that node on the workflow and it fails already. Also, it should not fail even if I am using “any_event”. The problem seems to be with the node, or am I missing anything?

1 Like

Hello, any thoughts on this? Thanks!

Sorry for the late reply bud, I haven’t been active

@joaquincoitino has the error been solved?

I am getting the same error with very similar circumstances on 1.110.1 self hosted. The standard webhook works (albeit without auth hence me trying to improve it). This one returns 500 to slack when responding to a block action, and the slack hook node shows the same error mentioned above. Note I’m not actually using events per se, rather block actions with responsive buttons etc.

Hey @horty Did you follow the Slack-Credential guide

1 Like

Yes, with the one difference being I’m using interactivity not events, to receive block actions

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.