How to send a message to a channel of MS Team using Graph APÌ?
I have used below commands to generate token for grant_type client_credentials.
curl --location --request POST 'https://login.microsoftonline.com/{tenant_ID}/oauth2/v2.0/token' --header 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'grant_type=client_credentials' --data-urlencode 'client_id={client_id}' --data-urlencode 'client_secret={client_secret}' --data-urlencode 'scope=https://graph.microsoft.com/.default'
Then using token generated i ran following curl command to get list of channels and it run successfully.
curl --location --request GET 'https://graph.microsoft.com/v1.0/teams/{team_ID}/channels/' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJub25jZSI6IjBMa0VQY1V4RjgxWnJOTnlUb2Z1SUFRc2VEVUYwQ25wa3pPcWFiY2wwcjgiLCJhbGciOiJSUzI1NiIsIng1dCI6ImtnMkxZczJUMENUaklmajRydDZKSXluZW4zOCIsImtpZCI6ImtnMkxZczJUMENUaklmajRydDZKSXluZW4zOCJ9.eyJhdWQiOiJodHRwczovL2dyYXBoLm1pY3Jvc29mdC5jb20iLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC9lODZiZjgyMS1kNmVhLTQ1MTAtOGZmYi03YzY4NmM2NDU3ZjIvIiwiaWF0IjoxNjA1MzU1NDg5LCJuYmYiOjE2MDUzNTU0ODksImV4cCI6MTYwNTM1OTM4OSwiYWlvIjoiRTJSZ1lPQzZ2dWFYN3Awc2s3WmM0Ym1uNjZjd0FnQT0iLCJhcHBfZGlzcGxheW5hbWUiOiJmeHRlc3QiLCJhcHBpZCI6ImVmYWQzZjlhLWY4MmQtNGNkMS05OTE1LTIwNDA0YjQ2NmYzNyIsImFwcGlkYWNyIjoiMSIsImlkcCI6Imh0dHBzOi8vc3RzLndpbmRvd3MubmV0L2U4NmJmODIxLWQ2ZWEtNDUxMC04ZmZiLTdjNjg2YzY0NTdmMi8iLCJpZHR5cCI6ImFwcCIsIm9pZCI6Ijc2ZmQwM2FlLTE3MDEtNGFiZS1iMmI2LWIwNGVmZWRhYWU4NSIsInJo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v1.0/$metadata#teams('e76f9b0b')/channels",
"@odata.count": 3,
"value": [
{
"id": "19:[email protected]",
"displayName": "General",
"description": null,
"isFavoriteByDefault": null,
"email": "",
"webUrl": "https://teams.microsoft.com/l/channel/19%3a%40thread.tacv2/General?groupId=e76f9b0b-b6d3&tenantId=e86bf",
"membershipType": "standard"
},
{
"id": "19:[email protected]",
"displayName": "apiSec-Issues",
"description": null,
"isFavoriteByDefault": null,
"email": "",
"webUrl": "https://teams.microsoft.com/l/channel/19%3b0b%40thread.tacv2/apiSec-Issues?groupId=e76f9b0b-b6d3&tenantId=e86bf821-d6ea-4510",
"membershipType": "standard"
},
{
"id": "19:[email protected]",
"displayName": "Dev",
"description": "This channel is where we debate all future development plans",
"isFavoriteByDefault": null,
"email": "",
"webUrl": "https://teams.microsoft.com/l/channel/19%330%40thread.tacv2/Dev?groupId=e76f9b0b-b6d3-42bb-baf1-6a798e4&tenantId=e86bf821-d6ea-4510-8ffb-7c686c64",
"membershipType": "standard"
}
]
}
However it throws unauthorized error when tried to post/sent a message to a channel using token generated from above mention curl command
curl --location --request POST 'https://graph.microsoft.com/v1.0/teams/{team_ID}/channels/{channel_ID}/messages/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJub25jZSI6IlRiYnhpOWlNZWZaTUZOaDNhNERIVDdlakNheU5QR1V2X3RhYzdwM3hxMVEiLCJhbGciOiJSUzI1NiIsIng1dCI6ImtnMkxZczJUMENUaklmajRydDZKSXluZW4zOCIsImtpZCI6ImtnMkxZczJUMENUaklmajRydDZKSXluZW4zOCJ9.eyJhdWQiOiJodHRwczovL2dyYXBoLm1pY3Jvc29mdC5jb20iLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC9lODZiZjgyMS1kNmVhLTQ1MTAtOGZmYi03YzY4NmM2NDU3ZjIvIiwiaWF0IjoxNjA1MzU4MDY4LCJuYmYiOjE2MDUzNTgwNjgsImV4cCI6MTYwNTM2MTk2OC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xNn3gD1WgibPuD55VC1hxirBkHjMa5xIn242AJJ2bpITcuun3glSSel9rHefmVEnqV9UXkSeq4OJTMGL-XrzZSUw09EkbKxOIq9FqWIJLe_LZS54to6xM62z4V-3YrNSHS9dUsQXRRoaeTe6_n_zzdx_epFtvoNiKnxmSggMN1Ly8yBJPitDpZsqjLtIRWcLRnARFD-_A8VkBjGr2k4KWTlcFlt7ltPDRfqEio7FNpRq4-B_4M14JuDEPAybdoJKXoyg87bFUmNMFf-lPnEmxNuHcUmYU3iy8ZJnX6SU1vCZwln0dQMUb_U7sOI796af7g8INksxVAwCA' \
--data-raw '{
"body": {
"content": "Hello World"
}
}'
In response it throws Unauthorized Error
{
"error": {
"code": "Unauthorized",
"message": "Unauthorized",
"innerError": {
"date": "2020-11-14T12:54:36",
"request-id": "d2e6aaa7-2884-4e4d-bd71-b92038b",
"client-request-id": "d2e6aaa7-2884-4e4d-bd71"
}
}
}
Just to get this working for testing purpose, i have given all permissions for delegated and application(About 442 permissions) with admin consent but still response throws "Unauthorized Error"
So can someone help out over here, where am i getting it wrong.
What is right procedure to send a message to channel of a MS team using MS-Graph-api or what else needs to be enable/done which i am forgetting over here, to get this working.