Custom argument formatting for Sendgrid plugin


Hello, I’m looking for some guidance on the formatting for custom arguments using Cobubble’s Sendgrid plugin.

My variables contain information on a number of movies, and this info is pulled from a list that users will create, so I can’t predict how many variables will actually be sent in the email. However, the email will contain a poster and information for each movie that the user includes in their list, and I’ve filled out the maximum number of variables (40), in case a user’s list is that long.

What I’d like to do via the custom arguments is to tell Sendgrid that if there are only 4 items in the list, for example, do not make any substitutions beyond item #4. How would I write this into the value for the arguments?

Right now my test email looks like this, where you can see the broken links for where images are supposed to be, and you can see the dividers I’ve input to separate some of the dynamic data, because the list is only 2 items long, and Sendgrid is expecting 40 items:

I tried this custom argument where I specify that if a list’s count is less than a certain number, the value is a certain substitute, but I figure that this is off base, and although I didn’t receive an error message from Sendgrid when I tested this, the email didn’t come through:

If the custom arguments can’t accomplish this, any info on what can would be greatly appreciated!

This text will be hidden


@brianna – We’re using the plugin to successfully send both substitutions (eg %VAR1% = users name) and custom args (“tracking code”: "123, “is dev”: “no”}

It looks like you might be setting it up incorrectly. I cannot exactly tell.

Does your email template in Sendgrid have placeholders %VAR1%, %VAR2%. These need to be in the body of the email.

Also, the conditional logic, needs to live in Bubble. You’re essentially replacing %VAR1% and all those other placeholder values in your template with the corresponding value you pass from Bubble.

If your email template is some type of feed with a dynamic # items, I’d highly recommend (from experience), you have separate templates depending on the # of items you want shown. We’ve played around with our own feed (min2-max6 items), using css to hide content depending on how many items we wanted to show. It was hard to maintain + it had added complexity to make the template work cross browser.


@kramwe Yep, in Sendgrid I have the placeholders (%VAR1% etc) and in Bubble I have all of my dynamic data and conditional logic. Apparently I was using the custom args incorrectly because I was trying to use a lot of dynamic data there that wasn’t producing any results.

But the idea to have multiple email templates for lists of different numbers is brilliant, that’s what I’ll do!

Thank you!