Goal with this scenario.
- I’m working on getting a series of keys on a JSON webhook input into an email template.
- As some of the keys may be empty, I can’t just pass them to the MailGun email template or it will complain the value is missing.
- I was able to get it working with a custom JSON structure for the mail variables that I parse and iterate on. I’m not using all the variables I need in this example.
- I’m then iterating on the array object that is created from the previously mapped JSON keys and aggregating it into a MailGun template variables destination type while filtering out any keys that may not have a value. Required since some source events do not contain that data, while others do.
- Mailgun is taking the output aggregate array and is happy.
Request
Is this the correct way to do this? Or is there a more efficient / optimized way to handle this that doesn’t require creating and re-parsing a JSON object into a different format than what the webhook recevies?