How to set up Email OTP solution in Flow Builder
Last updated
Last updated
In this guide, you’ll learn how to set up a one-time password (OTP) email solution with . OTPs are single-use passcodes that allow you to verify your customers' identity.
The Email OTP Send flow and Email OTP Verification flow
(to test your Email OTP solution)
Familiarize yourself with , which can be reached from your MessageBird Dashboard.
If you’d like to send authentication emails from your email domain (we'll show you how to do this in Step 2), you’ll need to . For detailed instructions, go to our .
Pro tip: In this guide, we’ll use screenshots to help you navigate through the more technical set up steps.
Once set up, the Email OTP Send flow will send an OTP to your customer. The Email OTP Verification flow will check the input that your customer returns against the original OTP. If it matches, the customer will be sent a Success email. If it doesn't match, the customer will be sent a Failed email.
1. Log in to your and go to .
3. Publish the Email OTP Send flow. You don’t need to copy the webhook URL from the dialogue box.
6. Publish the Email OTP Verification flow.
7. Copy the webhook URL from the dialogue box that appears. You’ll also be able to find and copy this webhook URL in the Webhook step, as demonstrated in the screenshot below.
8. With the webhook URL copied, navigate back to the Email OTP Send flow. Go to the HTTP Request step and paste the URL into the URL field, as shown in the screenshot below.
9. Go to the very end of the URL that you’ve just pasted into the URL field and add the following query string:
Your URL should now look similar to this: https://flows.messagebird.com/flows/5540bbfb-71db-42ca-b421-88eadbf0cc26/invoke?otp={{random[0]}}
10. Save the changes you’ve made to the HTTP Request step.
11. Publish the Email OTP Send flow.
By default, the flows you’ve just set up will use MessageBird’s flows.messagebird.com email domain to send OTP emails. If you would prefer to send OTP emails from your email domain, you can create a custom email channel by updating the Email OTP Send flow and the Email OTP Verification flow as follows:
Use this screenshot as a reference as you follow the steps.
2. From Flow Builder, navigate to the Email OTP Send flow.
3. Add the Send conversation message step to your flow, placing it below the HTTP Request step and above the Send an email step. You can do this by dragging and dropping the new step from the Steps menu, or by clicking the plus symbol between the two existing steps.
4. In the settings of the new Send conversation message step, select Inbox Email from the Channel drop-down menu.
5. Drag and drop the email variable from the Available variables list into the Recipient field.
6. In the Originator name field, type in an identifying name, such as OTP.
7. In the Address field, enter the name of the email address you want to send OTP emails from. There’s no need to include the domain name here, as this information will be added automatically when an OTP email is sent.
8. In the Subject field, type in the subject line for your OTP emails. If you want to include the verification code in the subject line itself, you can drag and drop the random(0) variable from the Available variables list, as shown in the screenshot.
9. In the Content field, type in the email body text for your OTP emails, using a little basic HTML to format the email content. Remember to include the random(0) variable in your message, as seen in the screenshot, as this will display your customer’s verification code.
10. Save the changes you’ve made to the Send conversation message step.
11. Delete the Send an email step from your flow.
12. Publish your Email OTP Send flow.
Use this screenshot as a reference as you follow the steps.
1. Navigate to the Email OTP Verification flow
2. Add the Send conversation message step to your flow, placing it below the otp equals condition of the If/Else branch and before the Send an email step. See A1 in the screenshot for more details.
3. In the settings of the new Send conversation message step, select Inbox Email from the Channel drop-down menu.
4. Drag and drop the email variable from the Available variables list into the Recipient field. You can do this by dragging and dropping the new step from the Steps menu, or by clicking the plus symbol between the two existing steps.
5. In the settings of the new Send conversation message step, select Inbox Email from the Channel drop-down menu.
6. Drag and drop the email variable from the Available variables list into the Recipient field.
7. In the Originator name field, type in an identifying name, such as OTP.
8. In the Address field, enter the name of the email address you want to send OTP Success emails from. There’s no need to include the domain name here, as this information will be added automatically when an OTP email is sent.
9. In the Subject field, type in a subject line for your OTP Success emails (e.g., Your account has been verified).
10. In the Content field, type in the email body text for your OTP Success email, using a little basic HTML to format the email content.
11. Save the changes you’ve made to the Send conversation message step.
12. Delete the Send an email step below the Send conversation message step that you’ve just set up.
13. Add a second Send conversation message step to your flow, placing it below the Else condition of the If/Else branch and before the Send an email step. See A2 in the screenshot for more details.
14. Repeat steps 3 through 7.
15. In the Address field, enter the name of the email address you want to send OTP Failed emails from. There’s no need to include the domain name here, as this information will be added automatically when an OTP email is sent.
16. In the Subject field, type in a subject line for your OTP Failed emails (e.g., Your account has not been verified).
17. In the Content field, type in the email body text for your OTP Failed email, using a little basic HTML to format the email content.
18. Save the changes you’ve made to the Send conversation message step.
19. Delete the Send an email step below the Send conversation message step that you’ve just set up.
20. Publish your email OTP Verification flow.
1. To trigger the OTP, implement the Webhook URL of the Webhook step in the Email OTP send flow.
2. To verify the OTP, implement the Webhook URL of the Await webhook step in the Email Verification flow.
Please take note: the identifier variable is the user’s email address.
2. Click Import Flow, upload and import the Email OTP Send JSON file, which you can download . You’ll be taken to the flow.
4. Navigate back to .
5. Click Import Flow, upload and import the Email OTP Verification JSON file, which you can download . You’ll be taken to the flow.
1. .
To test your Email OTP solution, install. Set up two HTTP requests as shown in the screenshots below.
And that’s it! 🎉 Now you know how to set up an Email OTP solution through .