Slack channel is not taking slack user id from an expression

Describe the issue/error/question

I would like to send a slack message directly to user using the slack ID with bot token. I’m using a HTTP request node to get the slack Id using - users.lookupByEmail method | Slack

On the slack node, I’m using an expression to retrieve the slack ID from the HTTP node output and insert into the channel. When I execute the workflow I get -

Slack error response: {“ok”:false,“error”:“invalid_arguments”,“response_metadata”:{“messages”:["[ERROR] missing required field: channel"]}}

However, when I manually enter the slack user ID as text into the channel field without any expression, everything works

What is the error message (if any)?

Slack error response: {“ok”:false,“error”:“invalid_arguments”,“response_metadata”:{“messages”:["[ERROR] missing required field: channel"]}}

Please share the workflow

(Select the nodes and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow respectively)

Share the output returned by the last node

{

"context": {

},

"name": "NodeOperationError",

"cause": {

},

"timestamp": 1655475418886,

"message": "Slack error response: {"ok":false,"error":"invalid_arguments","response_metadata":{"messages":["[ERROR] missing required field: channel"]}}",

"node": {

"parameters": {

"authentication": "accessToken",

"resource": "message",

"operation": "post",

"channel": "={{$node["HTTP Request"].json["user"]["id"]}}",

"text": "Hello world",

"jsonParameters": false,

"otherOptions": {...}, // 1 keys

"attachments": [...], // 0 items

"blocksUi": {...} // 0 keys

},

"name": "Slack",

"type": "n8n-nodes-base.slack",

"typeVersion": 1,

"position": [

300,

180

],

"credentials": {

"slackApi": {...} // 2 keys

}

}

}

Information on your n8n setup

  • n8n version: 0.182.0
  • Database you’re using (default: SQLite):
  • Running n8n with the execution process [own(default), main]:: own
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]:: npm

Hey @ajchida, I just tested your workflow and it’s working fine for me. Fetching my own user ID from slack works as does sending a message:

image

Could you share the full JSON data returned by your HTTP Request node like so?

You can of course redact confidential values but please do not change the data structure. This allows us to get an idea of the kind of data you are referencing in the Slack node.

@MutedJam will share the workflow shortly