Slack node - send file to im

Hello there!
I have some question - how I can send file to Slack IM via n8n
With node Slack - File - Upload I can post file only in channel but not IM or MPIM
Is that possible?

Hi @11111, I think in theory you should be able to use the File → Upload operation and provide the user ID instead of the channel. Though currently this is a bit tricky because n8n would always expect an array which it tries to join.

So, let’s assume our Slack user ID is U02GU6BEXQB (you can find it in Slack under “More”) like so:
image

You can then use this ID like so to send a file via direct message:

Example Workflow
{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "resource": "file",
        "binaryData": true,
        "options": {
          "channelIds": "={{[\"U02GU6BEXQB\"]}}"
        }
      },
      "name": "Slack",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 1,
      "position": [
        680,
        300
      ],
      "credentials": {
        "slackApi": {
          "id": "14",
          "name": "Marvin"
        }
      }
    },
    {
      "parameters": {
        "url": "https://unsplash.com/photos/-ztiaoxtEYo/download?ixid=MnwxMjA3fDB8MXxhbGx8M3x8fHx8fDJ8fDE2NDA2MTU0MTI&force=true&w=640",
        "responseFormat": "file",
        "options": {}
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        460,
        300
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

And the file would arrive in Slack via IM:

1 Like

Thanks a lot!
You’re the best
Have a nice day

1 Like