Skip to main content

Notifications

Community site session details

Community site session details

Session Id : dswn7468gcpgB1jpNq0ZLv
Power Automate - Building Flows
Answered

Mandrill Webhook parse application/x-www-form-urlencoded request

Like (0) ShareShare
ReportReport
Posted on 1 Mar 2023 16:05:36 by 12

Hello all,

 

I am trying to configure Mandrill  (for mail transactions) Webhook to write on Teams when a mail is bounce. Webhook is generating a request in application/x-www-form-urlencoded format instead json format. So I am trying to parse it correctly and I am having some difficulties.

 

Hope somebody could help me.

 

I am trying to get access to properties into formadata > value.

 

This is the output of the trigger

 

{
"headers": {
"Accept": "*/*",
"Host": "prod-31.westeurope.logic.azure.com",
"User-Agent": "Mandrill-Webhook/1.0",
"X-Mandrill-Signature": "M2YBbE5ZzBaxGBcGDOL0Cj6LIhA=",
"Content-Length": "3884",
"Content-Type": "application/x-www-form-urlencoded"
},
"body": {
"$content-type": "application/x-www-form-urlencoded",
"$content": "base64code",
"$formdata": [
{
"key": "mandrill_events",
"value": "[{\"event\":\"delivered\",\"ts\":1677682563,\"diag\":\"250 2.6.0 <adbff3de-44dd-4282-88ed-9bb54e7fb876> ,\"sender\":\"mail@mail.com\",\"template\":\"template\"}}]"
}
]
}
}
 
I censored base64 content and "value" for privacy reasons.
 
How can I achieve this? I am not sure how to parse that output and extract $formdata.
 
Thanks in advance
  • hahart Profile Picture
    3 on 16 May 2023 at 19:49:53
    Re: Mandrill Webhook parse application/x-www-form-urlencoded request

    Thank you! This worked a dream.

  • Verified answer
    ndndnnn Profile Picture
    12 on 02 Mar 2023 at 10:13:24
    Re: Mandrill Webhook parse application/x-www-form-urlencoded request

    in case there is someone with the same problem, here is the solution with Mailchimp Webhook. It was a little bit tricky:

     

    step 1 and 2step 1 and 2

     

    1.- When a HTTP request is received Connector with empty JSON scheme.

    2.- JSON Parse with:

        Content: triggerBody()['$formdata']

        Scheme:

    {
    "type": "array",
    "items": {
    "type": "object",
    "properties": {
    "key": {
    "type": "string"
    },
    "value": {
    "type": "string"
    }
    },
    "required": [
    "key",
    "value"
    ]
    }
    }

     

     

    Monosnap Edición de un flujo _ Power Automate 2023-03-02 11-07-39.png 

    3.- Apply to each:

        Output: body('parse_JSON')

    4.- Parse JSON 2:

        Content: items('Apply_to_each')['value']     

        Scheme:

    {
    "type": "array",
    "items": {
    "type": "object",
    "properties": {
    "event": {
    "type": "string"
    },
    "_id": {
    "type": "string"
    },
    "msg": {
    "type": "object",
    "properties": {
    "ts": {
    "type": "integer"
    },
    "_id": {
    "type": "string"
    },
    "state": {
    "type": "string"
    },
    "subject": {
    "type": "string"
    },
    "email": {
    "type": "string"
    },
    "tags": {
    "type": "array",
    "items": {
    "type": "string"
    }
    },
    "smtp_events": {
    "type": "array"
    },
    "resends": {
    "type": "array"
    },
    "_version": {
    "type": "string"
    },
    "diag": {
    "type": "string"
    },
    "bgtools_code": {
    "type": "integer"
    },
    "sender": {
    "type": "string"
    },
    "template": {
    "type": "string"
    },
    "bounce_description": {
    "type": "string"
    }
    }
    },
    "ts": {
    "type": "integer"
    }
    },
    "required": [
    "event",
    "_id",
    "msg",
    "ts"
    ]
    }
    }

    Now you can use the useful keys Mailchimp Webhook has. You could send it via email.

     

     

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

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

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,731 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,077 Most Valuable Professional

Leaderboard
Loading started