Backend workflows, file upload & APIs

Guys I need your quick advice, if I may:

I’ve built an email generator for my client’s users.
They fill out a form about who they are about to email and we generate hyper personalized email body for them. (using OpenAI)

We are about to add “bulk upload’ feature. User will upload a file and we’ll generate emails for each row.

I’m thinking of the following structure:

  1. Upload a file.
  2. Save each row as a separate thing Email_Empty in the DB. And delete the actual file.
  3. Run a backend workflow that will initiate the API call to generate email for each thing in the DB. (recursive 1 by 1). Recursively create a thing Email_Generated. And recursively delete Email_Empty
  4. Once the emails are generated I’ll allow the user to export the list as CSV. And recursively delete Email_Full as well.

QUESTIONS:

  1. Can I upload a file using Backend Workflows? I’d to pass the file to BW and then initiate the Upload Action in there…
  2. Would you implement the email generation the way I’ve described in the 3rd step or is there a better way of doing it?

For the file upload use the excellent 1T - CSV Uploader Plugin | Bubble by @eli I still can’t believe he doesn’t charge for this plugin and you can happily create backend workflows to manage the files.

For the workflows, I’d set a flag on the table as each email is sent rather than delete the whole thing. That way if there’s an error somewhere you can reset the flag and manually run the send email workflow again.

The workflow this way is easy to run too it just takes the first item in the thing that hasn’t got a sent email flag and runs, make that recursive and once the table has no more flagged messages to send, it schedules a delete on the file at 6am the next morning. (giving you time to followup for errors)

1 Like

Thank you Johnny! I was thinking about updating the status rather than deleting things right away! I think I’ll do that! :pray:

I’ll look into Eli’s plugin. I never had to deal with csv-s before :v:

1 Like