Skip to main content
Best answer

How do I segment parsed email HTML into blocks for dynamic WordPress post creation?

  • 19 December 2023
  • 7 replies
  • 128 views

Hey team,

 

I am trying to figure out a rather complicated problem (at least to me). My aim is to generate a wordpress post from a Campaign Monitor email. I have got to the point where I have extracted the feature image from the HTML version of the email, uploaded to wordpress and then parsed the data from the email and written some basic HTML to format it in the Create a Wordpress Post Zap. 

My problem is, even following the same template in Campaign monitor (same text and image blocks but different character counts) some text is getting left out from my fields. I have formatted the email input in the email parser but when I do a different campaign, some text gets cut off. 

 

 

I have then tried to parse the HTML Webpage version and then segment the HTML using <p> so that I can simply use HTML to build and include what I need out of that data. 

 

 

The problem is, I cannot extract those segments on their own, it appears I can only use the WHOLE output. Is there a way I can segment the HTML from a web parser into blocks somehow? and then build my own HTML to reference those blocks? 

 

7 replies

Userlevel 7
Badge +14

Hi @CMI 

Generally that type of customized parsing logic would be best served for one of these options:

Userlevel 1

Thanks Troy,

 

Any chance you could give me an example of how I would go about using these? I am unfamiliar on using these processes. 

Userlevel 7
Badge +14

@CMI 

The Code app has AI that can help you write the Code.

 

Here’s a help article that applies to HTML as well:

 

 

Userlevel 1

I can extract the data fine. I just don’t know how to reference the individual output fields. So in this instance I have Paragraphs separated to number values. But I can’t reference those numbers, only the whole thing (paragraphs). How can I use or extract the data associated with those number values?

I apologise, I have only just started using zapier and haven’t done anything like this before.

 

 

Userlevel 7
Badge +14

@CMI 

The Paragraphs are being returned as an array of items.

This article will give you guidance on how to use Zap steps to get individual fields to map for each:

 

Userlevel 1

Thanks for your help Troy. I have added what I did below for anyone else wanting to do this. 

 

I basically just converted the text to line items and then I was able to use the individual items. The 8 step process now takes all the important info from an email campaign including the image and creates a new post on wordpress with a feature image and select fields formatted in HTML. Results are perfect. 

 

Thanks again! 

 

 

Userlevel 7
Badge +11

Thanks so much for sharing those details on how you solved this @CMI! 🤗 And big thanks to @Troy Tessalone for helping out here! 🙌

It appears you have everything sorted for now, but please do return to the Community if you require further help at all. 

Reply