Skip to content

Add support for HTML messages using teams chat message send #6483

@apc005

Description

@apc005

Enhancement:

Let's add a --contentType [contentType] option that accepts text and html as values, but defaults to text.


Original issue

Priority

(Medium) I'm annoyed but I'll live

Description

Hi

When using second example on https://pnp.github.io/cli-microsoft365/cmd/teams/message/message-send I don't get a bold message but a text message with html tags:

1

Running the command with the debug option shows that the contentType is not set in the query:

2

The response shows it's handled as text:

3

It would be great to have an option to force the contentType value to "text" or "html"

Thanks

Steps to reproduce

m365 teams message send --teamId XXXXX --channelId YYYY --message "Hello World!"

Expected results

Hello World!

Actual results

Hello <b>World</b>!

Diagnostics

Lack of contentType in JSON data sent to O365

CLI for Microsoft 365 version

"v10.0.0"

nodejs version

v18.19.0

Operating system (environment)

Linux

Shell

bash

cli doctor

{
  "os": {
    "platform": "linux",
    "version": "#1 SMP PREEMPT Debian 1:6.6.51-1+rpt3 (2024-10-08)",
    "release": "6.6.51+rpt-rpi-2712"
  },
  "cliVersion": "10.0.0",
  "nodeVersion": "v18.19.0",
  "cliEntraAppId": "xxxx",
  "cliEntraAppTenant": "single",
  "authMode": "password",
  "cliEnvironment": "",
  "cliConfig": {
    "autoOpenLinksInBrowser": false,
    "copyDeviceCodeToClipboard": false,
    "output": "json",
    "printErrorsAsPlainText": false,
    "prompt": false,
    "showHelpOnFailure": false,
    "clientId": "xxxx",
    "helpMode": "options",
    "authType": "browser",
    "tenantId": "xxxx"
  },
  "roles": [],
  "scopes": {
    "https://graph.microsoft.com": [
      "AllSites.FullControl",
      "AppCatalog.ReadWrite.All",
      "AuditLog.Read.All",
      "Bookings.Read.All",
      "Calendars.Read",
      "ChannelMember.ReadWrite.All",
      "ChannelMessage.Read.All",
      "ChannelMessage.ReadWrite",
      "ChannelMessage.Send",
      "ChannelSettings.ReadWrite.All",
      "Chat.ReadWrite",
      "Community.ReadWrite.All",
      "Directory.AccessAsUser.All",
      "Directory.ReadWrite.All",
      "ExternalConnection.ReadWrite.All",
      "ExternalItem.ReadWrite.All",
      "Group.ReadWrite.All",
      "IdentityProvider.ReadWrite.All",
      "InformationProtectionPolicy.Read",
      "Mail.Read.Shared",
      "Mail.ReadWrite",
      "Mail.Send",
      "Notes.ReadWrite.All",
      "OnlineMeetingArtifact.Read.All",
      "OnlineMeetings.ReadWrite",
      "OnlineMeetingTranscript.Read.All",
      "PeopleSettings.ReadWrite.All",
      "Place.Read.All",
      "Policy.Read.All",
      "RecordsManagement.ReadWrite.All",
      "Reports.Read.All",
      "RoleAssignmentSchedule.ReadWrite.Directory",
      "RoleEligibilitySchedule.Read.Directory",
      "SecurityEvents.Read.All",
      "ServiceHealth.Read.All",
      "ServiceMessage.Read.All",
      "ServiceMessageViewpoint.Write",
      "Sites.Read.All",
      "Tasks.ReadWrite",
      "Team.Create",
      "TeamMember.ReadWrite.All",
      "TeamsAppInstallation.ReadWriteForUser",
      "TeamSettings.ReadWrite.All",
      "TeamsTab.ReadWrite.All",
      "TermStore.ReadWrite.All",
      "User.Invite.All",
      "User.ReadWrite.All",
      "profile",
      "openid",
      "email"
    ]
  }
}

Additional Info

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions