I checked the issue is the teamId u r using does not have the channel you have specified. Use list channels API to figure out the right channelId
Posting channel message to Teams facing 400 Bad Request
Hi!
When I am trying to POST a message to /teams/{team-id}/channels/{channel-id}/messages
I am facing a 400 Bad Request. During implementation I was following the steps described in Send chatMessage in a channel or a chat The message is posted to Teams however the response is 400 with no specific error message. I've tried in several environments and only this is not working. I don't have any clue how should I solve the issue.
Please check my request below.
{
"error": {
"code": "BadRequest",
"message": "Bad Request",
"innerError": {
"date": "2022-01-20T11:49:37",
"request-id": "63d8b596-b4a4-429f-b377-aa41a90ec682",
"client-request-id": "63d8b596-b4a4-429f-b377-aa41a90ec682"
}
}
}
Thanks in advance!
Microsoft Teams | Development
Microsoft Security | Microsoft Graph
Microsoft Teams | Microsoft Teams for business | Other
-
Ramjot Singh 861 Reputation points Microsoft Employee
2022-01-21T09:46:59.17+00:00
2 additional answers
Sort by: Most helpful
-
CarlZhao-MSFT 46,376 Reputation points
2022-01-21T08:37:07.68+00:00 First you have to make sure you are in the team before you can send messages to the team. You can use the Graph Explorer tool for a quick test.
Also, by the way, sending messages doesn't support application permissions.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread. -
Tamas Fazekas 21 Reputation points
2022-01-21T08:47:15.387+00:00 @Sayali-MSFT
@CarlZhao-MSFT
Thank you for your response.
The message is posted to Teams, however the request comes back with 400 which should mean that the Team Id and the Channel Id is fine.