Skip to main content

teams message send

Sends a message to a channel in a Microsoft Teams team

Usage

m365 teams message send [options]

Options

-t, --teamId <teamId>

The ID of the team where the channel is located.

-c, --channelId <channelId>

The ID of the channel.

-m, --message <message>

The message to send.

-h, --help [help]

Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are options, examples, remarks, response, full. Default is options.

--query [query]

JMESPath query string. See http://jmespath.org/ for more information and examples.

-o, --output [output]

Output type. json, text, csv, md, none. Default json.

--verbose

Runs command with verbose logging.

--debug

Runs command with debug logging.

Remarks

You can only send a message to a channel in a Microsoft Teams team if you are a member of that team or channel.

Examples

Send a message to a specified channel in a Microsoft Teams team.

m365 teams message send --teamId 5f5d7b71-1161-44d8-bcc1-3da710eb4171 --channelId 19:88f7e66a8dfe42be92db19505ae912a8@thread.skype --message "Hello World!"

Send an HTML formatted message to a specified channel in a Microsoft Teams team.

m365 teams message send --teamId 5f5d7b71-1161-44d8-bcc1-3da710eb4171 --channelId 19:88f7e66a8dfe42be92db19505ae912a8@thread.skype --message "Hello <b>World</b>!"

Response

{
"id": "1674320428077",
"replyToId": null,
"etag": "1674320428077",
"messageType": "message",
"createdDateTime": "2023-01-21T17:00:28.077Z",
"lastModifiedDateTime": "2023-01-21T17:00:28.077Z",
"lastEditedDateTime": null,
"deletedDateTime": null,
"subject": null,
"summary": null,
"chatId": null,
"importance": "normal",
"locale": "en-us",
"webUrl": "https://teams.microsoft.com/l/message/19%3Aeeafac000f844fcc8d98fdbc4ca17570%40thread.skype/1674320428077?groupId=6fb1231b-b2ad-4a81-b5d8-ed40ec7b3cd2&tenantId=189eb7cd-b689-4d93-88d8-8b8d30cd8847&createdTime=1674320428077&parentMessageId=1674320428077",
"policyViolation": null,
"eventDetail": null,
"from": {
"application": null,
"device": null,
"user": {
"id": "b2091e18-7882-4efe-b7d1-90703f5a5c65",
"displayName": "John Doe",
"userIdentityType": "aadUser"
}
},
"body": {
"contentType": "html",
"content": "<h2>Header</h2><ol><li>item 1</li><li>item 2</li><li>item 3</li></ol><p>This is <b>bold</b> text</p>"
},
"channelIdentity": {
"teamId": "6fb1231b-b2ad-4a81-b5d8-ed40ec7b3cd2",
"channelId": "19:eeafac000f844fcc8d98fdbc4ca17570@thread.skype"
},
"attachments": [],
"mentions": [],
"reactions": []
}
CTRL + M