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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Extracting content fro...
Power Automate
Answered

Extracting content from an object from Http request

(0) ShareShare
ReportReport
Posted on by 14

Using When a HTTP request form Twillio which is triggered when an SMS is received, I want to extract the content of the SMS, from number, message content etc. The below screenshot is as far as I have got, how to I extract the content? Ultimately I am wanting to push this information in an email for example661A41C4-087C-4B7D-ABFE-0052E5242097.jpeg

Categories:
I have the same question (0)
  • mahoneypat Profile Picture
    1,720 on at

    You need to add a Parse JSON step that uses your trigger output as the input, and then you hit the button called "Generate from sample" and paste in your json response (one time) as the example.  This will convert your JSON input to an array that you can use downstream in other steps.

    Power Automate Flow How to: Parse JSON - YouTube

     

    Pat

     

  • eliotcole Profile Picture
    4,390 Moderator on at

    @Blaired79 what would really help us out would be if you could put a screen shot of your flow (blank our sensitive data) in the original post for this thread.

     

    Also, I've done this previously, and remember it's a bit of toil and trouble.

     

    @mahoneypat, I didn't want to say anything, but I remember Twilio being a right pain, the SMS data is buried in an array of data. Whilst Adding the Parse JSON will help, it might not obviously result in the data for Blaired, but I do think it's a valid solution.

    Piecemeal Solution

    @Blaired79 , without seeing your flow, you can try this. Assuming that your Twilio instance is firing at an HTTP trigger in flow, then place a Filter action after it, like so:

    filter array.jpg

    From:

     

     

    @triggerBody()?['$formdata']

     

     

    Condition:

     

     

    @or(equals(item()?['key'], 'From'),equals(item()?['key'], 'Body'))

     

     

    Getting the Data From The Filter

    After this, I would unfortunately need my flow to be working (it isn't, because my Twilio lapsed) to get the rest. This said, looking at my old flow, I think each array entry is a part of the text data, there are more elegant ways to do this, but I made this before I knew them ... also ... will need to see your flow to apply the elegance anyway. 😉

     

    Either way, run an Apply to each action, which should run twice for the two matching entries that the Filter actions creates.

     

    Inside that, place a Switch action, that runs on the 'key' key (😩) value, and make two cases:

    1. Body - If the 'key' is Body, then it will set the smsBodyVAR variable.
    2. From - If the 'key' is From, then it will set the txtFromVAR variable.

    flow.jpg

     

    After this Apply to each has run (which should be swift) then you'll have the values you need.

  • Blaired79 Profile Picture
    14 on at

    Thanks @eliotcole Twilio is a right pain as I have discovered the output isn't what Parse JSON and I get this error

    The property ‘content’ must be of type JSON in the ‘ParseJson’ action inputs, but was of type ‘application/x-www-form-urlencoded’

     

    Below is what I have created so far and I've added your filter, which gives me the SMS body and the sending number.

    Untitled 2.png

     

    How do I turn these values into a variable that I can put in an email etc?

     

    Untitled.png

     

    I tried recreating your Power Automate but I did not have the 'key' value to use in the switch condition.




     

  • eliotcole Profile Picture
    4,390 Moderator on at

    It's all good, @Blaired79. 🙂 

     

    ((( if you look at my flow, you can see that the Switch is inside the Apply to each which runs on the Body from the Filter action )))

     

    You just need to run an Apply to each on the Filter body, that is where you can then take the values. 👍

     

    If your Apply to each is literally called 'Apply to each' then using the following expression in the Switch 'On' field, will get the 'key':

    On:

     

    items('Apply_to_each')?['key']

     

    Similarly, when defining either smsMsgVAR or smsFromNumVAR then use this expression to get the 'value':

     

    items('Apply_to_each')?['value']

     

     

    This just means that the expression looks at the current item in the loop, and in particular the 'value' field. Once you've run it once, Flow should automatically just label them key and value. 🙂

     

    If this is your first time using expressions, just look at the two tabs on the pop up, you have Dynamic content, and Expression. Choose 'Expression' and enter the function in there. 🏆

  • Blaired79 Profile Picture
    14 on at

    Hi @eliotcole, thanks for replying so quickly.  It's the apply to each area that I am having issues with.

    Blaired79_0-1636380688608.png

    I've been trying to read the text for your formulas in your apply to each and switch but the image pixelates.  I think the sticking point for me the is getting key in the switch condition.

     

  • Verified answer
    eliotcole Profile Picture
    4,390 Moderator on at

    Not a problem, @Blaired79, this is why I pasted the codes into my previous responses, above, in the code boxes.

     

    If you use as expressions (for example, with 'key' in the Switch) it should work.

     

    I'll reword them slightly to make that clearer.

  • Blaired79 Profile Picture
    14 on at

    I finally got there @eliotcole, thanks again, especially for your patience 🙂

  • eliotcole Profile Picture
    4,390 Moderator on at

    Don't give it a second thought, @Blaired79, mate, just happy to help!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 957

#2
Valantis Profile Picture

Valantis 847

#3
Haque Profile Picture

Haque 609

Last 30 days Overall leaderboard