Getting the WhatsApp Message Details in Power Automate | WhatsApp Bot [Part 2]

In this blog series, we will create a WhatsApp Bot that will connect to QnA Maker using Power Automate and Twilio. This will eliminate the usage of cloud functions such as Azure Functions.

In this part, we will get the JSON payload that we received from Twilio that contains our WhatsApp message. There are many properties here, but we are only focused on few.


Get Metadata details in Array

In our first part, we had seen the JSON request that we received. We will get the following important details –

  1. Body [Contains the actual WhatsApp message received]
  2. To [WhatsApp number to which the message was sent]
  3. From [WhatsApp number from which the message was sent]

Convert the trigger body to string by adding a new action Compose. The Compose contains the Inputs as following –


Initialize a new variable whatsAppBody of type String and give value as output from the Compose step. You can also skip the Compose step and directly initialize the variable and pass the value as the above expression that was given in Compose step.

Initialize an Array variable formdataArray. Here we split the above string variable by a delimiter ‘&’ and create an array.


Below is how the flow look like as of now.

Save the flow and send a WhatsApp message. Check the output of the array variable.

The Body contains the actual WhatsApp message received. Next, we will iterate through each of the array element and replace some characters to get meaningful data. Currently, we have HTML encoded characters in this data. That we will see in our next part.

Note: The reason we are following above approach to get the data instead of Parse JSON is that because the content-type of this API request is application/x-www-form-urlencoded. Therefore, we cannot use normal Parse JSON on this. Here is the error you will get when you use normal Parse JSON on this content-type.

Thank you All!!! Hope you find this useful.

If you liked our content and it was helpful, you can buy us a coffee or a pizza. Thank you so much.

Up ↑

%d bloggers like this: