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.
When your email template processes this, it will work separate it line by line.


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.


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.


Which event are you using here?

My parameters looks like this:

The action looks like this:

Hi @johnny,

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?


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:


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!

1 Like

Hi @copilot - Plugin throws error

Plugin action SendGrid - Send email error:
TypeError: Cannot read property ‘forEach’ of undefined
at eval (eval at build_function (/var/task/index.js:72:21), :3:102)
at /var/task/index.js:335:23
at run_fn (/var/task/u.js:594:18)

What would be the reason (During a send mail action) it was working before 1-2 months

1 Like

Hello @melon,

That doesn’t exactly look like a plugin bug and rather an error thrown for missing data in a list field.

For the future, please file a bug report at instead. :+1:

1 Like

Is there anyway to pass a category across with the plugin to help with the SendGrid analytics? @copilot

The error is a User Config / Data Error - So this happens especially when you don’t have the correct data being put in.

Have a check of dynamic data. In my case, I was playing around with this but put the receipt as the current user’s email, which was empty as I was not logged in. Once I forced it to a certain email, this was all good.

Hi all, I am using the Sendgrid Copilot plugin in a backend workflow and am repeatedly getting “Invalid SMTPAPI header” errors. The error states “The template id must be a valid template id for your account.” I have double and triple-checked my Dynamic Template ID and it is correct.

Because the backend workflow is triggered the day a Thing is created, but Sendgrid needs to send email at a future date (the day before the Thing expires), perhaps there is an authentication issue?

Should I check off in Bubble: “this workflow can be run without authentication”? or “Ignore privacy rules when running this workflow”?