web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Create JSON from Teams...
Power Automate
Answered

Create JSON from Teams Message

(0) ShareShare
ReportReport
Posted on 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

Categories:
I have the same question (0)
  • schwibach Profile Picture
    2 Moderator on at

    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.

  • Verified answer
    grantjenkins Profile Picture
    11,063 Moderator on at

    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

     

  • DanteBRSP Profile Picture
    4 on at

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

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard