Sending Binary Data (Image) in slack post

Hello All,

Am trying to send binary data by hitting an AWS Cloudwatch API and the response data in binary format (Image) needs to send it to the slack post. But it’s not working.

could anyone please help with this?

Hi @Sajid_Md, could you share a workflow using which your problem can be reproduced (ideally with only the relevant nodes) and also confirm the data structure you are getting back from AWS Cloudwatch?

Hi @MutedJam

This is my workflow. This is the binary data want to send it to slack.

Hey @Sajid_Md, thanks for sharing this example! Seeing your file is coming straight from a HTTP Request node, this should be simple enough.

If instead of using the Message/Post operation of your Slack node you switch to File/Upload you should be good. Just make sure to pick a valid channel:

Node settings:

Slack message:
image

Example Workflow:

Thank you @MutedJam

Am trying the same thing now but am facing issue while selecting the channel.

is this issue related to the token side or server-side?

Error:

Issues:
  - There was a problem loading the parameter options from server: "The service is receiving too many requests from you! Perhaps take a break?"


t

Hey @Sajid_Md,

That looks like Slack is telling you that you are sending too many requests.

Could be worth waiting a bit and trying again or double checking your scopes to make sure you have the correct scope to list channels.

Alternatively, you could try specifying the channel manually like so:

n8n will still complain, but you should be able to execute the node regardless.

Hi @Jon

if i give manually its giving me this error channel name not accepting.

Hi @Sajid_Md, can you try using the expression from my example like so?

image

Slack expects an array here and n8n wouldn’t create that automatically based on a plain text input. However, once you use an expression like {{ ["#general"] }} you should be good. The preview would then look like so:

image

Hi @MutedJam ,

that’s awesome. finally worked thanks for your support.

1 Like

Awesome, glad to hear! Thanks so much for confirming :slight_smile:

Hi @MutedJam

One quick question, in the slack node for sending the binary image to dynamic slack channels, I tried replaceable parameters in Channels selection. but the expression is showing invalid. could you please help me here to format it the right way?

This is the static value —> {{ ["#test_channel"] }}

When am trying to replace test_channel from other node value → {{ ["#{{$node[“Channel_Node”].json[“slack_name”]}}"] }} → Getting this error - [invalid (Expression is not valid: Unexpected string)]"] }}

Hey @Sajid_Md, that’d be because there are two many “double curly braces” ({{ and }}). Everything beween the first occurrence of each of these braces would be interpreted by the expressions engine.

Once you remove the additional braces and make sure you concatenate the string properly, your expression should work. So for example {{ [ "#" + $node["Channel_Node"].json["slack_name"] ] }}

Hope this helps! Give me a shout if you have any questions on this :slight_smile:

Awesome @MutedJam it working perfectly.

Thanks for the help.

1 Like

Hello @MutedJam ,

one more query, what will the replaceable expression if i want to send the same image to multiple channel. i tried below but not working. could you please help here.

This is what my requirement → [Array: ["#testing_1","#testing_2"]]

If i use this expression for single channel working fine → {{ [ “#” + $node[“Fetching_Slack_Details”].json[“slack_name”] ]}}
but if i try to add for multiple channel getting error.
{{ [ “#” + $node[“Fetching_Slack_Details”].json[“slack_channel_1”],[ “#” + $node[“Fetching_Slack_Details”].json[“slack_name_2”] ]}}

error → [invalid (Expression is not valid: Unexpected token ‘}’)]

could you please help me here with right expression.

Thanks :blush:

You should remove your variables while you test the expression. You have a syntax error in your array declaration that is causing the malformed array after the comma.

1 Like