SENDGRID only allows a certain amount of characters in a variable

Does SendGrid only allow a certain number of characters in a variable? I’ve been experiencing an error message when the input is too long

Thanks for posting this @acatalano - I’ve been having the same issue with a variable that’s a paragraph. I’ve isolated it by testing several different variations of how the email’s text is structured and it seems to be that Sendgrid is rejecting anything above a few words as a “Bad Request”.

@copilot - Any idea if there’s an answer or workaround to this one. I’ve been using your plugin on this and love it with the exception of this one issue.

Thanks!

Brian

Hey @brian,

It seems like SendGrid has a 10,000 byte limit per personalization block, which is the object that is sent to their email endpoint through the Send emails with SendGrid plugin. However, it’s not likely that you’re sending around that many characters in a single call so it’s something worth investigating. While we wait for SendGrid to get back to us with some insight, give us a shout at plugins@cobubble.com and we can take it from there! :slightly_smiling_face:

Hi everyone!
I am interested in this too since I have the same issue.
The error message is:

webapp_name returned (400) Bad Request and said "Raw error from SendGrid API - Send email with BCC: {“errors”:[{“message”:“Substitutions are limited to 10000 bytes per personalization block.”,“field”:“personalizations.0.substitutions”,“help”:"Authentication | Twilio “}]}”

To my undestanding 1 character = 1 or 2 bytes.
So definitely not using 10k bytes (in both cases).

On two sets of data, one was sent just fine while the other gave the error message. The only difference I can see are some slightly longer paragraphs in the second case. I deleted these variables to re-test but no better luck :man_shrugging:

Just mentionning the specifics of the webapp I’m on, in case there’s a pattern with @acatalano and @brian :

  • About 15 variables in the plugin
  • On a Bubble “Hobby” / Free Plan
  • Webapp unpublished (ie version-test)

@copilot, did you get any answer from SendGrid so far?

Hey @LucM,

Thanks for following up! Our case has actually been escalated by SendGrid through Alex, one of the support team members that have helped us make enhancements in the past. Thanks for shooting over your credentials so we can look at how this affects your application specifically, and we’ll let you know more as we do. :blush:

1 Like

Hi everyone!
Update since problem solved on my side :white_check_mark:

The problem:
I was trying to send an image through one of the variables but was using :encoded_in_base_64 in the variable instead of a plain URL. And so the image was sent to SendGrid as a long chain of characters, which then exceeded the 10000 bytes.

The solution:
@copilot has been really helpful and reactive in dealing with this issue so thanks and :+1: thumbs up :+1: to the team :grinning:

“When sending images, you should likely have a tag in your HTML email template and have it’s “src” tag be a variable like %VAR1%. You could pass the link to an image to that variable so that its injected into the template properly and you don’t Base64-encode anything.”

So the trick is to normally input the file URL in the given variable in Bubble and to add a HTML code block in your SendGrid template that will call this variable.

  • You could simply put <img src="%VAR1%"> in your HTML block
  • alt="(image bloquée)" is for alternative text (when the image isn’t displayed properly)
  • align="middle" is probably useless (if you only have your variable in that HTML)
  • <center></center> is to have the image centered in you template. You could also use “right” / “left” / “top” / “bottom”

There’s also a conversation here on the forum.