Skip to main content

I’m using an IMAP email trigger for an automation where I’m using the content of the email in a workbench with the goal of delivering a JSON payload to Cityworks to automatically create a new Work Order.

I’ve set up a User Parameter in the workbench to receive data from the the email. When I use the “Event as JSON” option for the parameter in FME Flow, the message body is being delivered to the workbench as HTML. This crashes the JSON being delivered. Everything up to the body is fine, but the message body doesn’t make it over, and everything that follows the body is also lost.

I’ve been able to get the message content into a workbench by using the individual headings such as “Email Body”, “Email Subject”,  “Sent from Address” headings in Flow as the parameters to pass, but doing it this way does not allow you to use the JSON transformers in the workbench.

Essentially what I am needing to do is receive JSON formatted data in a workbench from the IMAP email trigger, create attributes from the JSON (including the email body), and then build a JSON payload from the attributes to deliver to Cityworks.

I’ve been working on this a couple of days, and the only hangup is the email body. Any suggestions?

 

Since no responses have been received, I’ve opened a help desk ticket on this topic. Will post an update if a resolution is reached.


If you have found your way here, I was told by FME support that sending the body of an html email via the “Event as JSON” payload in FME Flow  IMAP Email Trigger is not possible.

 

 


What I wound up doing instead is sending individual email components that I wanted to work with using the Text Editor and the unique items such as  +From:{email.from}+Subject:{email.subject}+Sent:{email.sent}+BodyType:{email.contentType}+Attachments:{email.attachment}+Body:{email.body}

I added some text in a way that I could separate the individual items in a workbench using a String Searcher with Regex and grabbing the content between the headings using a StringSearcher for each part of the data. Then an AttributeCreator for each, and then using an HTML Extractor using a CSS Selector on the HTML body content, and finally an Aggregator to compile the attributes back together.

 


Reply