graph rest api to send a message to a teams channel failing

Arka Dutta 1 Reputation point
2021-09-27T18:47:31.437+00:00

Request =>

curl --location --request POST 'https://graph.microsoft.com/v1.0/teams/{teamId}/channels/{channelId}/messages' \
--header 'Authorization: Bearer <bearer_token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"body": {
"content": "Dude !!! Please work"
}
}'

Response =>

{
"error": {
"code": "InternalServerError",
"message": "Unable to find target address",
"innerError": {
"date": "2021-09-27T18:23:48",
"request-id": "2edd2854-1edc-47b8-aa1b-52e8e252f767",
"client-request-id": "2edd2854-1edc-47b8-aa1b-52e8e252f767"
}
}
}

teamId and channelId s are fetched from the graph API itself for the same.

What am I doing wrong here. Have followed as per this blog => https://learn.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-1.0&tabs=http

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,573 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 36,891 Reputation points
    2021-09-28T02:43:20.257+00:00

    This is an error caused by your personal account. Personal microsoft account is not currently supported. You need to switch to a work/school account.

    135619-image.png

    135724-image.png


    If an Answer is helpful, please click "Accept Answer" and upvote it.

    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.