OpenAI & Line Breaks, <br>, or \N

Hey y’all! I am trying to send an email using the output of a OpenAI prompt. Specifically, I’m attaching the content.text.value of the openAI output to a Sendgrid email {{body}} tag.

The issue, is passing it that way removes the line breaks and I just get one big blob of text. I tried adding “add br and \N tags” to the prompt but that doesn’t seem to do anything as they just get printed in the output…

How are y’all handling this? Any suggestions?

-Andrew

Do you have sample bundles you can share? You might also want to try different content types. For example, if your content is HTML, letting the tool know that might help.

L

Hey! So, these screenshot are a good example. It’s got the line breaks from OpenAI, but when send to the {{body}} of the Sendgrid Email, they all get jumbled together.

I’ve tried to work the prompt to include br tags, but that seems to still happen randomly, and even when it does, they get printed in the output instead of being recognized correctly.

The Make.com module allows me to send html content, but then I have to do the entire email instead of just the body section which seems like too much for me.


You’ll need to insert the paragraph tags after OpenAI has returned the response.

For more information, examples/screenshots, see

samliewrequest private consultation

Join the Make Fans Discord server to chat with other makers!

2 Likes

One think I have done in the past is just take the output and run it through OpenAI API as Chat Completion with the message:

“Format using double line breaks for increased post readability:”

and then insert the completion into my next module.

Yes, but for non-plaintext HTML fields, you’ll still need to convert them to HTML tags, as the double line breaks will not be recognised in HTML as a new paragraph.

3 Likes

Thanks for this, worked great!

The only thing I wanted to add was (perhaps Sendgrid specific) was I had to pass the body as {{{body}}} (with the extra {} to escape properly). Also, I replaced the

method with

.

Thanks for the assist!