APIs & Integrations

ab-jordanskole
Participante

Access to complete HTML on MarketingEmails endpoint

Hey All, 

 

I am trying to get access to the complete HTML for a MarketingEmail. The only way I can access it is by visiting the preview URL. 

 

I initially solved this by making a GET request to the preview url endpoint, however the cloudflare ddos is stopping me. 

 

Before I go building a bot to counter cloudflare -- this seems like something that should be possible from the API. 

 

There are two properties that look promising "emailBody" which is useless and returns the exact same response for every call. and "hsEmailBody" which does return with every response, and isn't documented. 

 

How can I get around the cloudflare bots, or better yet pull this down from the API. 

0 Me gusta
1 Respuesta 1
dennisedson
Equipo de producto de HubSpot
Equipo de producto de HubSpot

Access to complete HTML on MarketingEmails endpoint

Hey @ab-jordanskole ,

What API are you looking at. 

I hit this url: https://api.hubapi.com/marketing-emails/v1/emails/37720142304?hapikey={{hapi}} and it returns the the content of the email.  Broken up into modules (I tested with a drag and drop email)

This is a bit of what was returned

"module-1-1-1": {
            "body": {
                "css_class": "dnd-module",
                "hs_enable_module_padding": true,
                "html": "<p style=\"margin-bottom: 10px;\"><a href=\"https://www.google.com\" rel=\"noopener\">Welcome</a> friend, thank the reader for signing up to your newsletter and welcome them on board. Below your introduction, add a few links to some popular pages or posts on your website to give the reader an idea of what’s to come.</p>\n<ol>\n<li><strong>Showcase your best stories<br></strong>Give an overview of an existing blog post or a popular story from a previous newsletter. Be sure to add a <a target=\"_blank\" rel=\"noopener\">link</a> so the reader can learn more.<br><br></li>\n<li><strong>Help people get to know you<br></strong>Share a link to your website’s <a target=\"_blank\" rel=\"noopener\">about us</a> page where the reader can learn more about you and your community.<br><br></li>\n<li><strong>Keep the conversation going<br></strong>Tell your reader how they can get in touch if they have questions.</li>\n</ol>\n<p style=\"margin-bottom: 10px;\">Thanks,<br>The Your Company Name team</p>",
                "i18nKey": "richText.welcome.primary",
                "path": "@hubspot/rich_text",
                "schema_version": 2
            },

 

Curious what your use case is for this.

0 Me gusta