Trying to understand what I need to do with MS Graph API and tokens and Manual Credentials

I’m having some issues trying to using MS Teams through the HTTP request, it’s only because the standard N8N Teams nodes/dropdowns don’t appear to be able to do some features that I want , e.g. basic things… create NEW oneOnOne chat with a colleague or in this example Get Teams Channel information.

So I created a manual credential , connected to my microsoft account, using pretty much the same credentials as the N8N Teams credential, but in the manual credential I have to put the requested scopes etc and all works with subsequent URL requests etc … but the next day my N8N workflow stops working and and I have to re-connect my account ( even though it says connected ?? ) , which somehow refreshes my token ???

If I use the N8N Teams Node with a simple chat to an existing oneOnOne chat I have no problems the next day. It just works.

As I said I’m having to use my manually MS Graph credential because the existing N8N Teams nodes appear to be lacking in functionality.

I’ve tried to understand the existing Teams N8N documentation example and but it just seems to be missing steps.

Here’s just the Graph API URL I’m using

Please share the workflow

Share the output returned by the last node

Sorry I didn’t grab a screenshot this morning , but basically the request is rejected.

Information on your n8n setup

  • n8n version: 0.198.2
  • Database you’re using (default: SQLite): default
  • Running n8n with the execution process [own(default), main]: default
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: docker

Hey @0101binary0101,

It sounds like the issue is with the credential, Did you include offline_access in your scopes?

No, I’ll add it - as it wasn’t obvious that I’d have to do that … as I couldn’t see any info on the scopes of the N8N Teams or Outlook credentials, the scopes that I did setup only because it error’d when I experimented with the API, again because the N8N Teams nodes lacked the features (get info , get channel messages since filter date etc )

Is it possible to see what scopes/headers are in effect by the existing N8N credentials e.g. ‘Microsoft Teams Account’ credential ?

Hey @0101binary0101,

I found it in the Microsoft API documentation.

It looks like we also send openid as a scope, You can find the scopes we use in our credentials files. For Teams it is this one: n8n/MicrosoftTeamsOAuth2Api.credentials.ts at master · n8n-io/n8n · GitHub

To be honest the Microsoft API page wouldn’t have made much sense to me, needles in haystacks is all I can think of when I looked at that permissions page. I previously found it when I stumbled across the other calls because I couldn’t get the base n8n teams nodes to work.

Looking at your credentials node source makes it a bit easier to see how that was working so that’s a really big help thank you @Jon … I’ll book mark that location to examine when trying to understand other integration creds.

I’ve just thrown myself into n8n and was feeling smug that I had N8N checking my outlook and then a workflow using slack , telegram etc all sending me automated stuff… and I wanted to do MS Teams stuff as well.

My next headache is possibly going to be getting webhooks working… e.g. send a teams/slack messages with ‘click Accept’… ‘click Reject’ … I mean webhooks work but not how I expected them :slight_smile: … I’ll probably open up a ‘Question’ about using webhooks for responses mid workflow.

1 Like

What you will need is the wait node with webhook option :slight_smile:

yeah that’s the bit I’m struggling with … the example respond to webhook page Respond to Webhook - n8n Documentation seems make it trivial … but when I try it with what I thought it would do … it just sits waiting at Webhook1 (the first node) … anyway it’s off topic and I’ve only just started to look at this bit.

1 Like

@Jon - again thanks for the pointers on the scope IDs in the existing nodes.
I can confirm that yesterdays authenticated tokens using self made OAUTH2 MS Graph appear to have remained intact over 24hrs.

I used these scopes, including the openid you suggested

openid offline_access User.read Group.ReadWrite.All Chat.ReadWrite ChannelMessage.Read.All

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.