Access token error in flow when call Microsoft Teams Graph Spoke Post Message to Chat Action

yunbo
Tera Contributor

 

I have a requirement:

after the IT Service Help Desk starts a Teams Chat for a incident record, ServiceNow background should automatically send a  message to the new created chat, sending more detailed incident information to the chat as shown in the image below.(Figure-1)

To meet this requirement, I created a Flow that calls the "Post message to Chat" action (Microsoft Teams Graph Spoke). In the Flow Designer's Connection Tab, I used one Microsoft Account to obtain a token for authentication in Microsoft Teams Graph Spoke and Microsoft Teams Spoke. (the validity period for Teams Spoke is only one hour).(Figure-2)

The result is that only when the incident caller is authentication user, be able to successfully run the flow after starting a Teams chat from the incident form/workspace, posting the message to the specific Chat Id. However, other users' incidents encounter the following error shown in Figure-3.

{"error":{"code":"InvalidAuthenticationToken","message":"Access token is empty.","innerError":{"date":"2024-03-06T19:07:05","request-id":"f2f9a60c-9fd7-4ab7-a5d7-d456888a0df5","client-request-id":"f2f9a60c-9fd7-4ab7-a5d7-d456888a0df5"}}}

Error: Access token is empty. Please Check Oauth Token and scope permission.
I'm not sure where the issue is. Could it be that my connection settings are incorrect, requiring the use of the login user to obtain a token each time? If so, how can I configure it to achieve it? Alternatively, could there be any restrictions on the "Post Message to Chat" Spoke Action?

Figure-1:

yunbo_1-1709754080311.png

Figure-2 Connection Setting and Request Token

yunbo_2-1709754847381.png

Figure-3 Flow Error in Post Message to Chat Action

yunbo_3-1709755015527.png

Figure-4 permissions in Azure Portal

yunbo_4-1709755742684.png


I referred to the following document:

https://docs.servicenow.com/bundle/vancouver-integrate-applications/page/administer/integrationhub-s...

https://docs.servicenow.com/bundle/vancouver-integrate-applications/page/administer/integrationhub-s...

 

 

3 REPLIES 3

jyeon110
Tera Expert

Hello,

 

When you are setting up the credential information, make sure to add /oauth2/v2.0/authorize for Authorization URL and /oauth2/v2.0/token at the end of Token URL

 

example: 

Authorization URL: https://login.microsoftonline.com/[your input]/oauth2/v2.0/authorize

Token URL: https://login.microsoftonline.com/[your input]/oauth2/v2.0/token

 

then click "Edit and Get OAuth Token".

 

Hopefully that helps.

IbrahimK4837164
Tera Contributor

To resolve the issue, try the following: Check the expiration date of your token and renew it if necessary. Make sure your connection settings are correct and meet Microsoft Teams Graph requirements. Review the Send Chat Message action limits and make sure your request meets those limits. If the problem persists after doing this, please refer to the Microsoft Teams Graph documentation or contact support for further assistance.

spike
Mega Sage

Did you ever resolve this problem? I've got the same issue and I'm drawing a blank on how to fix it.

Anything you can offer would be appreciated.

Cheers!