Extract image from URL, attach to email?

Hi all,

We’re storing images in S3 and storing the links to those images in our Postgres DB. We’re then populating a repeating group with a user’s image links. See demo here.

We have a “Share” feature that allows the user to send the image to a phone number or email address, and we’re currently just sending the link as text by pulling the current cell’s URL and sending it via SMS/email.

Does anyone know of a way to download the actual image from the URL, then send it via email as an attachment, or as a “media” SMS?

Perhaps an API where I could send a URL and it would return the image, then I could use the “Result from step 1’s image” to attach it to an email?

Thanks for your help, let me know if any clarification is needed.

1 Like

Have you looked into a Twilio API integration? CoBubble has a plugin for sending Twilio MMS, which wouldn’t require any extra work on your end other than providing Twilio API calls with a publicly accessible image URL (Twilio will handle the GET process) in your sharing workflow. Twilio is very affordable – I’ve been using their API in North America (+1 phone numbers) for over a year without too many problems. MMS does cost more than SMS, so you may want to limit the number of shares a person can execute every month or subscription cycle.

Thanks @philip. Yep, we use Twilio for just about everything we can. The only issue we’re facing is sending the image as an email attachment from a provided URL. We’re able to do this via Twilio MMS to a phone # by passing the URL as a “Media_url” parameter, but I’m not sure how we’d do this for an email attachment. Do you know of anything similar, but for email instead of MMS? Maybe Twilio has a feature I’m unaware of?

Thanks again.

Ah, I misunderstood. I was thinking you were primarily having issues with MMS. Check out yet another awesome CoBubble plugin for SendGrid emails: https://bubble.io/plugin/send-emails-with-sendgrid-1484327506287x474510747987607550

Sendgrid starts at $10/mo but is completely worth it. I’ve sent out over 10000 emails with 100% reliability (0 errors) and their API is a breeze. With the plugin you can choose to send an email with custom variables
(https://sendgrid.com/docs/API_Reference/SMTP_API/substitution_tags.html) and all you would need to to is create a variable with the value of your image URL and embed in your email with a string such as %CUSTOM_IMAGE_VAR%. There is a little more to it than that, which is explained further in their documentation, but it’s definitely the right option for bulk email sending from within Bubble. I am using the SendGrid campaigns feature to sync all user data in my app DB with their segmented lists. You’d have to define custom API calls in the API Connector plugin (by Bubble) to access this portion of the API but if you start with basic SG features now you can adopt and easily scale up into more advanced stuff down the road without switching providers.

Thanks @philip. I implemented SendGrid and was able to send it as an embedded image instead of a URL. Still trying to get it as an attachment, but this might work for now. I’m not HTML-savvy, so I just created an “image” module in SendGrid with an example URL, copied the HTML code, pasted it into an HTML module, and replaced the example URL with %VAR1%. Then in Bubble, I populated that %VAR1% with the image URL I’m looking to send. Looks like this:


Pretty simple, thanks again!

Hey @greg.nallie,

You could use the ‘Send email with 1 attachment’ action with the :encoded in base64 module too. :slight_smile:


Perfect, thanks for the tip. Nice work on the plugin, too!

Still having trouble getting the URL’s image to an attachment… I can’t find where to encode as base64, I think that’s for image/file types in Bubble… (https://bubble.io/reference#Data.Messages.file) I need to go the opposite direction, URL to image/file, unless I’m missing something.

I found this plugin, but the conversion is too slow to be viable. Any other ideas for pulling the image from a URL and sending it as a SendGrid attachment?



Figured it out! Just needed to pass the URL to my API Workflow as a “file” type, and encode it as base64 in the SendGrid “Attachment Content” field. My mistake was setting “Attachment Filename” to “Test” instead of “Test.JPG”. Thanks so much for your help!


This topic was automatically closed after 70 days. New replies are no longer allowed.