Convert html template to json to send in the gmail body

Hello. My first time here.
I’m a more basic user, with only basic programming skills, for low code applications.

I normally use the template from the link above to send text messages in the Gmail body.

I would like to use an email template in the body of Gmail. With the html node I can render normally.

I can also attach the html manually in gmail and it works great, but I don’t know how to take the html, convert it to json and replace it in ““send_on_day”: 0” in the “Email Sequence” node with the correct json format, if that’s possible.

Could anybody help me?
I imagine it will be simple for more advanced users.
I hope so.

Email sequence node: see “send_on_day”: 0

Used example(on image of html node) of html template to replace it in “send_on_day”: 0 (link bellow to check the html source code)
https://d2p078bqz5urf7.cloudfront.net/static-predesigned-templates/email/1-3/joy-of-reading-email-template/preview.html

If I just copy and paste the json output from the HTML node into the Email sequence node to replace the message of “send_on_day”: 0, it doesn’t work.

N8N version
image

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

I got the solution (chatGPT)

// Insert your HTML here
const html = `
<!DOCTYPE html>
<html>
<head>
  <title>Example</title>
</head>
<body>
  <h1>Hello, world!</h1>
  <p>This is an example of HTML email.</p>
</body>
</html>
`;

// Encode the HTML into JSON
const jsonMessage = JSON.stringify(html);

// Return the encoded JSON
return {
  jsonMessage: jsonMessage
};

Thank you

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.