Sending Messages to a Microsoft Teams Channel from a Workflow as a Bot

Hi everyone!

I’m building a workflow that uses Microsoft Teams to communicate with users. A user triggers the workflow by sending a message to a Teams channel, and the workflow then sends back the results.

The issue is that messages sent by the workflow appear as if they were sent by me, since I used my personal account to set up the credentials.

Is there a way to configure the Microsoft Teams node to send messages as a bot instead? I’ve seen that I could create a separate account for the bot and use it for credentials, but that isn’t an acceptable solution in this case.

Information on your n8n setup:

  • n8n version: 2.2.3

  • Database (default: SQLite): supabase

1 Like

Try using the Auth of someone with senior

Authorization access .. Hopefully that works

Hi @Travis_Leebok,

Since the Teams auth used in n8n is based on oauth, you’ll need to get your IT department to create a “Bot” user on teams and then give you the login credentials. You can then login as that Bot user on your n8n instance to make messages sent from the bot account and not yours. Unfortunately there is no way to spoof another user using oauth

To be more specific, they’ll need to create an app-registration. If they make an account rather than an app-registration, it’ll use a license and be subject to password policies.

The app-registration also needs the correct access permissions. I’ve only dealt with Sharepoint access which required some things steps via Azure CLI so I don’t know how it works for sending/receiving messages.

@Wouter_Nigrini Thanks for your reply. With Slack nodes, I was able to set the message author name and avatar, so I thought it would be possible with Teams nodes as well.

@Galactic_pawns Thanks! Of course, I have an app registered and the permissions set. The only issue is that the message is sent as the user whose credentials were used to connect n8n with the app, rather than as a bot.

Sounds like authentication uses the implicit flow rather than client credentials. Implicit is used when an app authenticates and is transparant rather and thus showing the user’s details for things.

Client credentials uses the app-reg + secret/certificate to get a token and act as it’s own session (no user details passed through to the receipient).