I’m trying to setup a trigger where an email is sent to a user and in that email it gives you an option to have that same email be resent to them in either 1, 3 or 6 hours from them opening it. Is this possible? If so, what would be the best way to set this up? I have a SendGrid api key that I added to the settings section but am not sure If I should use bubble’s “send email” action the SendGrid plugin.
You need to use Schedule API workflow
How would I have this be triggered upon selection (1, 3, 6 hours) within the email itself?
Hi @joshua.luna0, whether you have SendGrid set up or not doesn’t really affect whether you can create the functionality or not.
Using Bubble’s “Send Email” action or a custom email API also doesn’t really affect it, but the Bubble action will be the easiest path to start with.
What matters is how you schedule the workflow to run the email action and also how to allow the user to choose the resend time. Here is one way to do it, but keep in mind I don’t know what else is going on in your app and any other requirements or conditions you may need. There are many ways to achieve your goal.
- Create an API Endpoint (check out this tutorial on how to enable API Workflows) called “send-email”
- You’ll need to create parameters so that whatever first triggers the endpoint, data can be passed to it and the email can contain custom info. For example, a “Recipient” parameter (type User) .
- Add the action “send email” to this workflow. Fill in the fields and use whatever parameters you’ve created to help customize the dynamic data.
- Create a new page in your app. This is where the user will be taken when they make a re-send selection. This page will be in charge of re-scheduling the same email (or perhaps a different email) at the time the user selected. Either design this page to simply show the user a confirmation message or you can keep it blank and redirect them after the scheduling has occurred.
- So, in the email, you can have 3 separate links that all go to the new page - we’ll call the page “resend.” The links will each have a different URL parameter. For example:
myapp.com/resend?schedule=current date/time +(hours): 1
myapp.com/resend?schedule=current date/time +(hours): 3
myapp.com/resend?schedule=current date/time +(hours): 6
In the email, you can add anchor text to each URL so that it’s more human friendly for the User:
“Re-send in 1 hour”
“Re-Send in 3 hours”
“Re-send in 6 hours”
- On the “resend” page, create a Page is Loaded workflow: When page is loaded > Schedule API Workflow (“send-email”) where the scheduled date is extracted from the URL parameter (you can use “Get data from page URL” for this. Make sure to indicate your parameter (“schedule” and set the type to date).
- That should give you enough to work from, but keep in mind that something needs to trigger the Endpoint in the first place to kick things off. This should be from a workflow in a regular page in your app. Like when someone clicks a button > Schedule API Workflow: send-email.
This is amazing, thank you! I followed all of the steps but get lost regarding the url parameters. How can I set these up so I have those 3 separate links for the new “resend” page?
No problem! You can create the link within the body of the email along with everything else you want to send, like this:
The top version has the anchor text and the bottom version is just the link itself.
This is great! How would I be able get the direct URL for what you’ve inputed in the example above? I’m hoping to have an email template (from Sendgrid) be sent out with these links attached to “buttons” for users to click on.