Mahesh Bhagat
Mahesh Bhagat

Reputation: 23

How do i display XML/HTML tags in teams message using incoming wehbook api?

Problem statement: Whenever I pass XML/HTML tags in the request JSON, teams interpret it as a code and hide the XML/HTML tags given. And only displays the data within the tags as a message like 12388pdfserver

{
  "text": "<?xml version=\"1.0\"encoding=\"UTF-8\"?><Event><id>123</id><pid>88</pid><assettype>pdf</assettype><applicationname>server</applicationname></Event>"
}

I would like to print below two messages as-is in the team channel message via incoming webhook. Message format #1:

Processing failed for the below event:

{
  "objectId": 1983925,
  "jornal": "RPRJ",
  "objectType": "MAN",
  "approved": "Y",
  "event": "<?xml version=\"1.0\"encoding=\"UTF-8\"?><Event><id>123</id><pid>88</pid><assettype>ProofPDF</assettype><applicationname>HUB</applicationname></Event>"
}

Failure Reason: Could not find object id.

Message format #2:

Processing failed for below event:

<?xml version="1.0" encoding="UTF-8"?>
<Event>
    <id>123</id>
    <pid>88</pid>
    <assettype>pdf</assettype>
    <applicationname>server</applicationname>
</Event>

Failure Reason: Could not find ID and PID.

Upvotes: 0

Views: 1911

Answers (1)

Nivedipa-MSFT
Nivedipa-MSFT

Reputation: 1458

All text fields in actionable messaging cards support basic Markdown.

Do not use HTML markup in your cards.

HTML is ignored and treated as plain text.

Ref Doc: https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook#key-features-of-an-incoming-webhook

Upvotes: 0

Related Questions