Sendgrid plugin by cobubble for sending invoices in PDF by email?

Hello there,

I´ve seen this plugin by @iamsalar in the plugin page and I was wondering if this is useful for sending an invoice in PDF. Right now I´m letting users to download the invoice in PDF with the selectPDF plugin but I don´t know how to send the invoice attached in an email.

Plugin page: https://bubble.io/plugin/send-emails-with-sendgrid-1484327506287x474510747987607550

Thanks a lot.

1 Like

Hey @ryanck,

There’s not many options as far generating .pdf files go, but I can personally see two ways of sending .pdf files (or attachments in general) for use-cases like invoices and receipts via SendGrid.

Linked Attachment
You can take advantage of SendGrid’s substitution tags and set one of the included tags to the location of your attachment. Keep in mind that this method won’t register as an attachment in the email, plus it’d be in your best interest to include a button or visible link in your email to them so recipients know where to click to do what.

Encoded Attachment
SendGrid supports including attachments via certain parameters sent with the request to the Mail API. The filename, type and more can also be set for each attachment, with the maximum allowable email size of 30MB. For the content of the attachment (this being the attachment itself), it must be base64 encoded which would involve some play with Bubble’s :encoded in base64 module. This seems like a great feature to have, so I’ll add it to our queue to see if it’s possible.

You should be on your way shortly. :slight_smile:

2 Likes

It´ll be awesome since there are lots of users requesting to have a way to send PDF´s directly from Bubble as an email.

Thanks a lot @iamsalar

Will you update this topic or create a new one once you get this?

Bests.

The SendGrid plugin now supports attachments.

When creating your workflow, use the ‘Send email with attachments’ module to send up to 3 attachments in one email. For each attachment, you must set the content parameter to be your file encoded in Base64 and the filename parameter to be your file’s name and extension. Your email’s total size must not exceed 30MB.

Get sending! (with attachments) :slight_smile:

1 Like

Holy moly!

That´s great. So for example if I generate an invoice in PDF through the SelectPDF plugin, then I can configure the Sendgrid plugin to send this invoice that is stored somewhere (I´ve the URL) to a client by email?

It seems as though the Base64 recorder module needs a file object, so as long as you have it somewhere accessible, it will be fetched and encoded for you. Give the Bubble team a shout if you run into issues. :wink:

Hello @iamsalar,

This is awesome, it works but I´ve a problem now. It was working for a few minutes till I got this error message. I´ve tried creating another API Key but I´m still getting the same error.

> Error connecting to SendGrid API - Send email with 1 attachment: {"errors":[{"message":"Bad Request","field":null,"help":null}]}

Thanks a lot.

I´ve been testing and the problem is with the %VAR1%, %VAR2%, …

Here´s my template in Sendgrid, as you can see there is just the VAR1.

Thanks a lot.

Hey @ryanck,

Best way to get help is to give me a shout directly so we can take it from there. We didn’t push any updates to the plugin so it may just be a formatting error in your request as SendGrid didn’t send you their usually-included link to the relevant help docs. As far as variables go, not all must be set prior to use. :slight_smile:

Hey @iamsalar,

I´ve just sent you a direct message.

Bests.

So me and @iamsalar are working to solve this as soon as possible.

We´ll let you know once we get this solved.

Bests to all.

Hi Salar – Where is the Bubble base64 module?

Hey @kramwe,

Take a peek at Bubble’s reference guide to see where the :encoded in base64 module can be found. :slight_smile:

Thanks.

Hi Salar,

Ok, I see the module. Any idea what the Header or Data Type needs to be if one parameter “file” is encoded?

Our use case has mostly been front-end requests where the file object is coming from the File Uploader component. We had our go at AWS specifically but haven’t poured enough resources there just yet. :slight_smile:

hi @ryanck, I’m running into this error too (bad request). Were you able to solve it? If so, is there any chance you could share a screen shot of your API call? I feel like I’m missing something teeny and it’s driving me nuts!

Thanks,
Jamie

@copilot @ryanck @jamie Has anyone solved this issue? I am dealing with the same thing right now, and can’t find a solution at all…

Hey @andrew6,

We haven’t yet received any related bug reports. Give us a shout at plugins@cobubble.com. :slight_smile:

Hi @copilot ,

I am like andrews6 and I have sent to you a direct email at plugins@cobubble.com since 4 days as it looks to be the best way. Have you received it ?
I would really appreciate your help to figure out this bug cause I can’t move on any further on my app while it won’t be fixed.