Note: It is a violation of the terms of use to use Microsoft Teams as a log file. Only send messages that people will read.
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
Permission type
Permissions (from least to most privileged)
Delegated (work or school account)
ChannelMessage.Send, Group.ReadWrite.All**
Delegated (personal Microsoft account)
Not supported.
Application
Teamwork.Migrate.All
Note: Permissions marked with ** are supported only for backward compatibility. We recommend that you update your solutions to use an alternative permission listed in the previous table and avoid using these permissions going forward.
Note: Application permissions are only supported for migration.
In the future, Microsoft may require you or your customers to pay additional fees based on the amount of data imported.
HTTP request
POST /teams/{team-id}/channels/{channel-id}/messages/{message-id}/replies
Request headers
Name
Type
Description
Authorization
string
Bearer {token}. Required.
Request body
In the request body, supply a JSON representation of a message object. Only the body property is mandatory, other properties are optional.
Response
If successful, this method returns 201 Created response code with the message that was created.
// Code snippets are only available for the latest version. Current version is 5.x
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new ChatMessage
{
Body = new ItemBody
{
ContentType = BodyType.Html,
Content = "Hello World",
},
};
var result = await graphClient.Teams["{team-id}"].Channels["{channel-id}"].Messages["{chatMessage-id}"].Replies.PostAsync(requestBody);
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new ChatMessage();
$body = new ItemBody();
$body->setContentType(new BodyType('html'));
$body->setContent('Hello World');
$requestBody->setBody($body);
$result = $graphServiceClient->teams()->byTeamId('team-id')->channels()->byChannelId('channel-id')->messages()->byMessageId('chatMessage-id')->replies()->post($requestBody);
// Code snippets are only available for the latest version. Current version is 5.x
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new ChatMessage
{
CreatedDateTime = DateTimeOffset.Parse("2019-02-04T19:58:15.511Z"),
From = new ChatMessageFromIdentitySet
{
User = new Identity
{
Id = "8c0a1a67-50ce-4114-bb6c-da9c5dbcf6ca",
DisplayName = "John Doe",
},
},
Body = new ItemBody
{
ContentType = BodyType.Html,
Content = "Hello World",
},
};
var result = await graphClient.Teams["{team-id}"].Channels["{channel-id}"].Messages["{chatMessage-id}"].Replies.PostAsync(requestBody);
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new ChatMessage();
$requestBody->setCreatedDateTime(new DateTime('2019-02-04T19:58:15.511Z'));
$from = new ChatMessageFromIdentitySet();
$fromUser = new Identity();
$fromUser->setId('8c0a1a67-50ce-4114-bb6c-da9c5dbcf6ca');
$fromUser->setDisplayName('John Doe');
$from->setUser($fromUser);
$requestBody->setFrom($from);
$body = new ItemBody();
$body->setContentType(new BodyType('html'));
$body->setContent('Hello World');
$requestBody->setBody($body);
$result = $graphServiceClient->teams()->byTeamId('team-id')->channels()->byChannelId('channel-id')->messages()->byMessageId('chatMessage-id')->replies()->post($requestBody);