Skip to main content

Notifications

Community site session details

Community site session details

Session Id : NMWW2jLWu4ZxD1cbuXrt73
Power Automate - Building Flows
Answered

Create JSON from Teams Message

Like (0) ShareShare
ReportReport
Posted on 31 Oct 2022 20:28:08 by 4

How can I make the body of a message received in a channel in Teams (coming from another application by webhook) be mapped and understood as JSON by Power Automate so that I can use the variables individually along the flow

text sent as a message on the channel.

Name: AAAA
Login: BBB
email: CCCC

 

exemple

Captura de Tela 2022-10-31 às 17.25.51.png

 

after converting to JSON I would like to be able to use each piece of information (name, login, email..) individually along the flow

  • DanteBRSP Profile Picture
    4 on 03 Nov 2022 at 20:14:21
    Re: Create JSON from Teams Message

    Woowwww !!!!! 
    Tks! it works !!!!

  • Verified answer
    grantjenkins Profile Picture
    11,059 Super User 2025 Season 1 on 01 Nov 2022 at 02:28:02
    Re: Create JSON from Teams Message

    I've created a sample flow that should get what you're after.

     

    Assumptions:

    • You will always have Name, Login, and Email in the message with the data for each separated with a colon :

     

    Below is the full flow. I'll go into each of the actions.

    grantjenkins_0-1667268691089.png

     

    The trigger is: When a new channel message is added, which I'm assuming you already have to pick up new messages.

     

    Html to text removes all the HTML and just leaves the raw text and any new line characters. The input is the Message body content from the trigger.

    grantjenkins_1-1667268813726.png

     

    The Filter array takes in an expression which is your Html to text output, split by new line. The expression is:

    split(outputs('Html_to_text')?['body'], decodeUriComponent('%0A'))

    Note that decodeUriComponent('%0A') represents a new line character.

     

    The item represents each of the items in the array. For this we are testing to see if the item is NOT empty, which will end up removing all the empty lines from our initial output. The expression we use for item is:

    item()

    grantjenkins_2-1667269086719.png

     

    Finally, we use Parse JSON so we can get our fields available to use within the rest of the flow. For this we input a JSON object with the Name, Login and Email as our properties. And for the values we need to split each line by ": " then get just the value part (index 1).

    grantjenkins_5-1667269349809.png

     

    The input for Name, Login and Email is using the following expressions:

    split(body('Filter_array')[0], ': ')[1]
    split(body('Filter_array')[1], ': ')[1]
    split(body('Filter_array')[2], ': ')[1]

     

    The JSON is:

    {
     "Name": @{split(body('Filter_array')[0], ': ')[1]},
     "Login": @{split(body('Filter_array')[1], ': ')[1]},
     "Email": @{split(body('Filter_array')[2], ': ')[1]}
    }

     

    And the schema to get our properties is:

    {
     "type": "object",
     "properties": {
     "Name": {
     "type": "string"
     },
     "Login": {
     "type": "string"
     },
     "Email": {
     "type": "string"
     }
     }
    }

     

    You should now see the properties from Parse JSON that you can use.

    grantjenkins_6-1667269467900.png

     

  • schwibach Profile Picture
    Super User 2025 Season 1 on 31 Oct 2022 at 21:28:00
    Re: Create JSON from Teams Message

    You can trigger the flow on each new message in the channel.

     

    With the split expression you can cut out the individual parts of the message that you need in compose actions and then do with them what you need to do.

    You'll have to fiddle with it a bit, but you'll get it to work that way eventually.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

#1
stampcoin Profile Picture

stampcoin 101

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 82 Super User 2025 Season 1

#3
David_MA Profile Picture

David_MA 48 Super User 2025 Season 1

Overall leaderboard
Loading started