Initiate a Teams Chat using a service account

Describe the problem/error/question

I am trying to create a chat workflow, that will initiate a chat whenever a new ticket arrives in the queue. However, instead of using my user profile, I want to user a service account instead. The service account is fully interactive however, when I try to switch the credentials on a generic Microsoft OAuth2 API

Edit: after further review I found that the app registration did not have the requisite delegated permission called user.read.all, there is a node in the workflow which checks the user status before initiating the call and that graph call was failing.

credential it does not seem to work and gives the following error:

What is the error message (if any)?

{
  "errorMessage": "Forbidden - perhaps check your credentials?",
  "errorDescription": "Insufficient privileges to complete the operation.",
  "errorDetails": {
    "rawErrorMessage": [
      "403 - \"{\\\"error\\\":{\\\"code\\\":\\\"Authorization_RequestDenied\\\",\\\"message\\\":\\\"Insufficient privileges to complete the operation.\\\",\\\"innerError\\\":{\\\"date\\\":\\\"2026-11-02T19:51:48\\\",\\\"request-id\\\":\\\"76a33348-e5b4-48e6-ae80-837772913323\\\",\\\"client-request-id\\\":\\\"76a33348-e5b4-48e6-ae80-837772913323\\\"}}}\""
    ],
    "httpCode": "403"
  },
  "n8nDetails": {
    "nodeName": "Resolve Test Recipient Teams Identity",
    "nodeType": "n8n-nodes-base.httpRequest",
    "nodeVersion": 4.4,
    "itemIndex": 0,
    "time": "11/2/2026, 2:51:48 PM",
    "n8nVersion": "2.39.6 (Self Hosted)",
    "binaryDataMode": "database",
    "stackTrace": [
      "NodeApiError: Forbidden - perhaps check your credentials?",
      "    at ExecuteContext.requestWithAuthentication (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file++++home+runner+_work+n8n+n8n+packages+core/node_modules/n8n-core/src/execution-engine/node-execution-context/utils/request-helpers/authentication.ts:283:10)",
      "    at processTicksAndRejections (node:internal/process/task_queues:104:5)",
      "    at ExecuteContext.requestWithAuthentication (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file++++home+runner+_work+n8n+n8n+packages+core/node_modules/n8n-core/src/execution-engine/node-execution-context/utils/request-helpers/factory.ts:178:11)"
    ]
  }
}

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 2.39.6
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): AKS
  • Operating system:

403 with a generic Microsoft OAuth2 credential almost always means the app registration behind the credential has no application permission the token actually carries, not that the call itself is wrong. For a headless service account, use client credentials grant with an app registration that carries Microsoft Graph Chat.ReadWrite application consent; the n8n credential then needs the token URL and the scopes (for example https://graph.microsoft.com/.default) plus the correct resource. Also double check the redirect URI: client credentials does not do a browser callback, so any credential configured for auth-code flow with a callback URI will fail silently.

Hey @_ali welcome to the n8n community.
Since your service account is interactive, reconnect the Microsoft OAuth2 credential and sign in as that account. Keep delegated OAuth; client credentials would authenticate as the app rather than your service user.

The 403 is from Resolve Test Recipient Teams Identity. Could you share that node’s HTTP method, Graph URL and the credential’s Scope field, without secrets? If it’s a basic /users lookup, check delegated User.ReadBasic.All. Chat permissions alone don’t grant access to that lookup.

Following are the permissions for the app registration, all delegated. My enterprise has OKTA based SSO, I login using a private window then on the credentials page I click on switch account and then use the service account email address. However, one thing I have noticed is that although I am in a private browser session the popout window never prompts me for service account credentials. I am guessing its using the correct service account credentials which is why I am getting 403 else if it were my credentials I would be able to initiate the chat.

@Deepankar I am running into a separate issue now, I am unable to sign in with the service account unfortunately on the Graph API credential. Even though I am trying to login in the private window.

Hi @_ali,

Do you mind creating a new thread for this sign-in issue? It keeps the forum organized and helps others facing the same problem find the fix once this main thread is marked as solved.

On the Graph API sign-in failure: this usually happens when Azure app registration or OKTA SSO requires interactive admin consent, or blocks single-tenant logins. A few quick things to test:

  1. Verify “Allow public client flows” is enabled in your Azure App Registration.

  2. Check if your Azure tenant requires explicit admin consent for the requested delegated scopes.

Drop the link to the new thread here and we can jump right back into troubleshooting!