Message POST is allowed in application-only context only for import purposes

Nirmallya Ghosh 20 Reputation points

I am trying to send message to teams Channel but i am getting below error -

Can anyone please help ?


    "error": {
        "code": "Unauthorized",
        "message": "Message POST is allowed in application-only context only for import purposes. Refer to for more details.",
        "innerError": {
            "date": "2023-05-30T04:07:23",
            "request-id": "14e70f9f-46f4-45dc-99ab-2bb0094ded3f",
            "client-request-id": "14e70f9f-46f4-45dc-99ab-2bb0094ded3f"


curl --location '******c-99c6-e***ac44/oauth2/v2.0/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=8c4d5231-e***********3f8e1d9c' \
--data-urlencode 'scope=' \
--data-urlencode 'client_secret=VfS8************n2PLhcqjcRC' \
--data-urlencode 'grant_type=client_credentials'

cURL for Sending Message to Teams Channel -

curl --location '**********-abdd-bb5772cf50ee/channels/1**********c7872b9bb@thread.tacv2/messages' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer accessToken
Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
9,549 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
3,034 questions
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 39,746 Reputation points

    Hi @Nirmallya Ghosh

    Application permissions are only supported for migration, which means you need to use application permissions to create a team and channel in a migration state, and then import third-party platform messages into the team.

    If your context is just sending chat messages in a channel, then use delegated permissions instead.

    User's image

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.

    1 person found this answer helpful.