Forum Discussion

pritam2277's avatar
pritam2277
Copper Contributor
Jun 28, 2021
Solved

Sending message/replies to teams channel using graph api

I am trying to send message to teams channel using graph api and Python's msal library to get tokens. I have registered the app in Azure portal and added permission(delegated and application) to it as per https://docs.microsoft.com/en-us/graph/api/chatmessage-post-replies?view=graph-rest-beta&tabs=http . I am able to generate token, although tokens received only reflect application permission and not delegated permission. I am able to send messages using my username in graph explorer but NOT able to do it using my app. 

I tried searching many docs/forums but no luck:sad:; not sure what I am missing.



 Below are received decoded token and error message:{
"aud": "https://graph.microsoft.com",
"iss": "https://sts.windows.net/ff9b87e***********************/",
"iat": 1624887965,
"nbf": 1624887965,
"exp": 1624891865,
"aio": "E2Z*************=",
"app_displayname": "MyApp",
"appid": "dc753**************",
"appidacr": "1",
"idp": "https://sts.windows.net/ff9b87e3-c54*******************/",
"idtyp": "app",
"oid": "2b5abfe6-7********************",
"rh": "0.AR*********************************************",
"roles": [
"Teamwork.Migrate.All"
],
"sub": "2b5abfe6-73*************************",
"tenant_region_scope": "NA",
"tid": "ff9b87e3-c5************************",
"uti": "cv5Yb******************",
"ver": "1.0",
"wids": [
"0997a1d0-0d1d-*****************"
],
"xms_tcdt": 1420304885
}
Token Expires at: 2021-06-28 20:21:05
{'error': {'code': 'UnknownError', 'message': '', 'innerError': {'date': '2021-06-28T13:51:08', 'request-id': '2cc385c5-85e4-4fde-824c-399bac232e1e', 'client-request-id': '2cc385c5-85e4-4fde-824c-399bac232e1e'}}}

8 Replies

Resources