Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
393 views
in Technique[技术] by (71.8m points)

json - How do I post multiline message using Teams Webhooks?

I have a webhook setup to post a message to one of our Teams Team channels. I'm using one of the teams webhook examples given here: https://docs.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/cards-reference#hero-card .

The problem I have is that I am unable to display multiple lines. In the example below, I'd like to separate out 'Test1' and 'Test2' on separate lines. However, using or in the JSON didn't translate to multi line format in Teams. Screenshot outcome attached below.

    "type": "message",
    "attachments": [
        {
            "contentType": "application/vnd.microsoft.card.hero",
            "content": {
                "title": "Alerts",
                "text": "*Test1 
 *Test
",
                "buttons": [
                    {
                        "type": "openUrl",
                        "title": "Open in SumoLogic",
                        "value": ""
                    }
                ]
            }
        }
    ]
}

What is the way to send a multi-line message to Teams using webhook? Any guidance here is appreciated.

how the result in teams look like at the moment

question from:https://stackoverflow.com/questions/65836444/how-do-i-post-multiline-message-using-teams-webhooks

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

@Anoj Shrestha Please try using and check.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...