chatMessage resource type

Namespace: microsoft.graph

Represents an individual chat message within a channel or chat. The message can be a root message or part of a thread that is defined by the replyToId property in the message.

Note: This resource supports subscribing to changes (create, update, and delete) using change notifications. This allows callers to subscribe and get changes in real time. For details, see Get notifications for messages.

Methods

Method Return Type Description
Channel messages
List messages in channel chatMessage collection List of all root messages in a channel.
Get delta of messages in channel chatMessage Get incremental messages in a channel.
Create subscription for new channel messages subscription Listen for new, edited, and deleted messages, and reactions to them.
Get message in channel chatMessage Get a single root message in a channel.
Send message in channel chatMessage Create a new root message in a channel.
Update message in channel chatMessage Update the policyViolation property of a chat message.
Channel message replies
List replies to message chatMessage collection List of all replies to a chat message in channel.
Get reply message in channel chatMessage Get a single reply message in a channel.
Reply to a message in channel chatMessage Reply to an existing chat message in a channel.
Update reply message chatMessage Update the policyViolation property of a chat message.
Chat messages
List messages in chat chatMessage List chat messages in a chat.
Get message in chat chatMessage Get a single chat message in a chat.
Create subscription for new chat messages subscription Listen for new, edited, and deleted chat messages, and reactions to them.
Send message in chat chatMessage Send a chat message in an existing 1:1 or group chat conversation.
Update message in chat chatMessage Update the policyViolation property of a chat message.
Hosted content
List all hosted content chatMessageHostedContent collection Get all hosted contents associated with a message.
Get hosted content chatMessageHostedContent Get hosted content (and its bytes) for a message.

Properties

Property Type Description
id String Read-only. Unique ID of the message.
replyToId string Read-only. ID of the parent chat message or root chat message of the thread. (Only applies to chat messages in channels, not chats.)
from chatMessageFromIdentitySet Details of the sender of the chat message. Can only be set during migration.
etag string Read-only. Version number of the chat message.
messageType chatMessageType The type of chat message. The possible values are: message, chatEvent, typing, unknownFutureValue, systemEventMessage. Note that you must use the Prefer: include-unknown-enum-members request header to get the following value in this evolvable enum: systemEventMessage.
createdDateTime dateTimeOffset Timestamp of when the chat message was created.
lastModifiedDateTime dateTimeOffset Read only. Timestamp when the chat message is created (initial setting) or modified, including when a reaction is added or removed.
lastEditedDateTime dateTimeOffset Read only. Timestamp when edits to the chat message were made. Triggers an "Edited" flag in the Teams UI. If no edits are made the value is null.
deletedDateTime dateTimeOffset Read only. Timestamp at which the chat message was deleted, or null if not deleted.
subject string The subject of the chat message, in plaintext.
body itemBody Plaintext/HTML representation of the content of the chat message. Representation is specified by the contentType inside the body. The content is always in HTML if the chat message contains a chatMessageMention.
summary string Summary text of the chat message that could be used for push notifications and summary views or fall back views. Only applies to channel chat messages, not chat messages in a chat.
attachments chatMessageAttachment collection References to attached objects like files, tabs, meetings etc.
mentions chatMessageMention collection List of entities mentioned in the chat message. Supported entities are: user, bot, team, and channel.
importance string The importance of the chat message. The possible values are: normal, high, urgent.
reactions chatMessageReaction collection Reactions for this chat message (for example, Like).
locale string Locale of the chat message set by the client. Always set to en-us.
policyViolation chatMessagePolicyViolation Defines the properties of a policy violation set by a data loss prevention (DLP) application.
chatId string If the message was sent in a chat, represents the identity of the chat.
channelIdentity channelIdentity If the message was sent in a channel, represents identity of the channel.
webUrl string Read-only. Link to the message in Microsoft Teams.

Relationships

Relationship Type Description
replies chatMessage Replies for a specified message.
hostedContents chatMessageHostedContent Content in a message hosted by Microsoft Teams - for example, images or code snippets.

JSON representation

The following is a JSON representation of the resource.

{
  "id": "string (identifier)",
  "replyToId": "string (identifier)",
  "from": {"@odata.type": "microsoft.graph.chatMessageFromIdentitySet"},
  "etag": "string",
  "messageType": "string",
  "createdDateTime": "string (timestamp)",
  "lastModifiedDateTime": "string (timestamp)",
  "lastEditedDateTime": "string (timestamp)",
  "deletedDateTime": "string (timestamp)",
  "subject": "string",
  "body": {"@odata.type": "microsoft.graph.itemBody"},
  "summary": "string",
  "attachments": [{"@odata.type": "microsoft.graph.chatMessageAttachment"}],
  "mentions": [{"@odata.type": "microsoft.graph.chatMessageMention"}],
  "importance": "string",
  "reactions": [{"@odata.type": "microsoft.graph.chatMessageReaction"}],
  "locale": "string",
  "policyViolation": {"@odata.type": "microsoft.graph.chatMessagePolicyViolation"},
  "chatId": "string",
  "channelIdentity": {"@odata.type": "microsoft.graph.channelIdentity"},
  "webUrl": "string"
}