Slack - send message as bot

Hello,
Hope you are well.

I created an OAuth authorization for an app for a slack node. (I basically followed each step of the “Using Oauth” https://docs.n8n.io/credentials/slack/#using-oauth).

Now, the node is working but the message is sent as myself, bot with the @bot. I checked the slack documentation, it seems that I need to send an {“as_user”: false}.
I tried to send it as it is as JSON parameters, with either this format {“as_user”:false} or [{“as_user”:false}], but each time, I have this error: “Error: Attachments it is not a valid json”

It might be very stupid, but I’ve just discovered recently n8n (it’s awesome by the way, thanks for the hard work).

Thanks !

Hi @Cyril, welcome to the community.

Did you try the “Send as user” option under Other Options?

Hello,
Thanks for your answer.

Unfortunately, as you can see in the attached picture, I don’t have this option.


Bests,

Hey @Cyril!

Are you using the recent version of n8n? This feature got added a while back. So can you update your n8n and check again?

Hello, thanks for your answer.

I’ve just updated the version (the “about” on my n8n tells me I have the 0.111.0 which seems to be the last version). Unfortunately, I still have the same issue, where the “no user” option not appearing :frowning:

This is weird. If you remove the node and add the same node again? Perhaps, that solves the issue.

The option “Send As User” is only displayed if “AccessToken” gets used to authenticate (not OAuth) because it only works in combination with it, if I remember correctly.

1 Like

Really?
But then how do you send a message as a bot with OAuth authentication?

If I look at the slack documentation (https://api.slack.com/methods/chat.postMessage), it seems that the no_user flag could be used independently of the method of authentication.

Yes, it looks like they are different options. The Slack-Node does currently not implement the no_user option. What it sets if “Send as User” is defined, is the body parameter username.

But how can I send the parameter username?
Because I don’t see it in Options or Attachments. (I checked the permissions, I have

  • chat:write
  • chat:write.customize
  • chat:write.public

so I should be good to send message as another username, shouldn’t I?)

Any ideas? Please it’s really annoying for me as it is sent as myself, and thus I don’t have any notifications on slack :confused:

I tried for example to put as an attachment this: {"as_user": false, "username": "My bot"} without any successes :frowning:

Hey @Cyril!

As mentioned earlier the node currently doesn’t have that functionality with the OAuth authentication method. But you can use the Access Token authentication method to send the message as a bot.

Ok ! Done it this way, i thought it was no longer possible to add this type of token with slack, but I was wrong.