Microsoft Teams Connector - 400 Bad Request Error

Hi Guys,

              Requirement is that i need to connect chat functionalities with Microsoft Teams. In forge i found Microsoft Teams Connector and followed everything. I created Azure AD account and passed Tenant Id, ClientId, ClientName, UserName and Password. But it showing 400 Bad Request error. Anybody tried this component? Kindly update if you have worked on this. 

regards,

Naveen

mvp_badge
MVP
Solution

Hi Naveen,


You manage to make some progress, great!

Regarding the get users service, the web service called is this one and according to Microsoft Graph API documentation, these are the permissions that need to be granted on the side of Azure to the user you use to get the token:



Once you select the user and proceed to send the message, please also take into account that Microsoft Graph API's Chat services for 1-1 conversations (not channels) are limited by the following:



Hope it helps.


Cheers,

João

mvp_badge
MVP

Hi Naveen,


I have worked with this component successfully, we use it in an application without a problem.

Also, I would ask you to create this issue on the Forge component page on Support, so the creators of the component can be notified and can get back to you quickly.


Have you checked your Service Center logs?

As you can read here, executing an action in Microsoft Teams supposes several web services. For instance, sending a message to a channel presumes: 1) doing login 2) getting a team 3) getting a channel 4) sending a message.

Your error might be occurring in any one of them.

So you should turn the web services log to Full Log and analyse the logs from there.


I suggest you to do this analysis with your Azure admin since it is likely something to do with permissions and he can grant them to your user (for example, showing users, implies having permissions to show users; sending a channel presumes getting the channel by name which has some specific permissions).


Hope it helps.


Cheers,

João

Hi Joao Marques,

                                 

I would like the say the flow which i followed. First of all, I created 2 users. User1@outlook.com and User2@outlook.com.  

I opened https://portal.azure.com and logged with User1@outlook.com , created application. Now i got TenantId, ClientId, ClientName, Scope. 

I passed this values in screen and username as user1@outlook.com. then i got 400 Bad Request error. Might be I missed something here.

I checked in service center logs, kindly find the attachments


Kindly find where i am making mistakes.

regards,

Naveen

joao2.png

mvp_badge
MVP

Hi Naveen,


Have you checked the permissions which are required for the web service calls you are calling with the graph api links I gave you?

Have you confirmed your user has the permissions needed to call the api's you are calling?

Have you turned the full log on web services to try to understand where the error is? (See here how).

Have you debugged the call to see which service is failing?


Cheers,

João

Hi Joao Marques,

                           I tired with 2 Outlook users which is created by own, I got 400 Bad Request error. Now I tired with my office Azure AD account. Its connected now, no 400 Bad Request error is there. But while fetching users am getting 401 Unauthorized error and getting empty data in users dropdown. Its related to permission right. I gave permission and added my account as a Owner in Azure App. Not yet fixed. Any other rights we need to provide? 


regards,

Naveen

mvp_badge
MVP
Solution

Hi Naveen,


You manage to make some progress, great!

Regarding the get users service, the web service called is this one and according to Microsoft Graph API documentation, these are the permissions that need to be granted on the side of Azure to the user you use to get the token:



Once you select the user and proceed to send the message, please also take into account that Microsoft Graph API's Chat services for 1-1 conversations (not channels) are limited by the following:



Hope it helps.


Cheers,

João

Hi Joao Marques


As per the document, I gave the permissions to application in Azure, still same 401 Unauthorized error in User_GetUsers action.


regards,

Naveen

Hi Joao Marques,

I have some questions sir.

1. Is it possible to connect with non microsoft account

2. we are planning to use this component for endusers chatting,  enduser may have different domain accounts

3. we are planning to connect for Video Call also, so that can you help us in this?


regards,

Naveen

             

mvp_badge
MVP

Hi Naveen,


Regarding your error, I suggest you check again the permissions in Azure (in delegated mode). Following the instructions, I manage to make it work as you can see on the screenshot below:



Regarding your questions:


1 and 2. Is it possible to connect with non microsoft account

You can find your answer in detail with a simple Google search.


2. we are planning to connect for Video Call also, so that can you help us in this?

Taking a look at the Microsoft Graph API documentation, there are APIs for that so it is possible.

This component does not have calling functionality yet but it can definitely be something to explore and eventually include in a later version.

As you can understand, I have other assignments and cannot put a timetable on that.


Cheers,

João



Hi Joao Marques,

                             Now users are listed in dropdown. What i did is I gave permission related to Mail, Calender and Files in Microsoft Graph API. Thanks for your guidelines. 


      After choosing the user, when I try to send message it shows 403 Forbidden error. I think it also related to some authorization permission. Kindly text me for an idea. I am also trying with Postman for finding the issue and will update.


regards,

Naveen

mvp_badge
MVP

Hi Naveen,


It is very likely it has to do with permissions. The web service called to send the message 1 on 1 is the send ChatMessage in a chat and these are the permissions needed according to the documentation:


Once again, note that due to the limitations of 1-1 message services from Microsoft Graph API in beta version, you will only be able to send a message if there was ever a message exchanged between the two users, otherwise you are going to get an error message like: 


A chat between <user sending the message> and <GUID of the user you trying to send the message to> doesn't exist yet, thus it is not possible to send a message. 


Cheers,

João

Hi Joao Marques,

Finally I sent message with Microsoft Teams Connector....! Thank you Very Much Man for your guidelines..! Am totally new for Azure AD and API permissions, but your way of guidelines makes me to implement. Thank you once again. So now am started trying to perform Video and Audio call with Microsoft Graph API.


regards,

Naveen

mvp_badge
MVP

Hi Naveen,


That's great, I am glad you manage to got it working!

Good luck!


Cheers,

João

Hi Joao Marques,

                             https://developer.microsoft.com/en-us/graph/graph-explorer 

This link is very useful for finding the right api permissions for each api url from Microsoft graph API.


regards,

Naveen

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.