Forum Documentation Showcase Pricing Learn more

Sendgrid Plugin by Copilot

Hey Bubblers and @copilot,

Does anyone know how to line break when using sendgrid transactional templates with the @copilot Sendgrid plugin?

I know that the built in Bubble email feature lets you do line breaks how does that exactly work? @emmanuel @josh

Maybe this is something that can also be added into the @copilot Sendgrid plugin?

Let me know if anyone has a solution for this :slight_smile:

Bump! Any ideas?

I’ve tried everything in this forum post but still not working. No line breaks. Strange behaviour from SendGrid

@copilot any solutions?

Hi, I might be able to help. The way I found this problem was to use the JSON email feature and join each repeated item with a comma.
image
When your email template processes this, it will work separate it line by line.

Cheers!

Thanks! I’ll try this out!

The isn’t working for me because I run backend workflows with the Sendgrid plugin and when the backend workflow is scheduled it just saves to a parameter called, “Body” where it’s type is text, and after I put that there is no option to use the method, “join with.”

Thanks for trying though!

Anyone have another solutions? @copilot

I’m using a backend workflow as well, so that’s not the reason.

“join with” doesn’t show up as an option. You have to type it in manually.

Cheers,
Lee

Hmm interesting, I’ll look into it.

Hey @leehaber,

It’s not quite working. Do you have any suggestions? I have attached a screenshot below.

image

Which event are you using here?

My parameters looks like this:
image

The action looks like this:

Hi @Dragon_Busters,

There’s a number of ways to tackle line breaks in general. It’s important to know the structure of data coming in and the structure/limitations of where that data is going. One of the most common issues we end up addressing in Sessions dealing with emails is HTML character formatting.

A simple example to demonstrate text block formatting is the data coming from a multiline input, also a very common instance for message notifications, order notes among other examples:

Copilot offers on-demand assistance, targeted courses
and custom development for all types of projects.

When you punch that raw text into an API request, you’ll likely be including the newline character represented by the \n you’ve probably seen before in logs, documentations and other sources:

Copilot offers on-demand assistance, targeted courses\n
and custom development for all types of projects.

SendGrid sends HTML emails with templating enabled by Handlebars. The newline character cannot be interpreted by HTML to form a newline, but you can accomplish that with the <br> tag:

Copilot offers on-demand assistance, targeted courses<br>
and custom development for all types of projects.

When the block above is run through SendGrid’s interpreter, it can easily recognize <br> (as well as other tags) to achieve the multiline structure. You can handle the swap using the :find and replace module across Bubble’s native inputs and JSON strings among others.

Line breaks have less to do with the plugin than the data itself. We could explore adding a built-in line break handler in a future update, but we’re definitely believers in configurability over all. :slight_smile:

1 Like

Hello @copilot,

Thank you for your response.

This was my initial thought and I tested it out using a multiline input; however, on my Sendgrid HTML email it returned back with <br> in the body of the text.

Any tips to fix that?

@Dragon_Busters

You’re likely not using Handlebars correctly, maybe omitting a bracket/stash. Continuing the example, you’d want to bring everything together into your template using the tag you choose:

Hello, you just received this message:

{{{body}}}

Understandably, body being the formatted multiline text coming from your application. Both SendGrid and Handlebars have sections in their documentations dedicated to escaping HTML. Always be sure to thoroughly explore a service provider’s documentation and syntax prior to making them a dependency in your application(s).

If you feel you could use more assistance around email formatting, you know where to find us. :slight_smile:

1 Like

THANK YOU! That was the issue!!! Y’all the best!