Problem with variable replacement in API Call to Resend for sending email after user registration.

Database & APIs

Dear FlutterFlow Community,

I am experiencing an issue while trying to send a notification email via the Resend API after a new user registers in my application.

Workflow:

1. A user registers through a form with fields for name and email.

2. Upon clicking the registration button, an "Auth - Create Account" action is executed.

3. Immediately after, a "Backend Call API" action configured for the Resend API is executed.

Objective:

The goal is to send an email to *****@gmail.com notifying about the new registration, including the registered user's name and email in the email body.

Problem:

Despite the configuration, the variables {{name}} and {{email}} are not being replaced with the user's data in the email body sent through the Resend API.

Request:

I would appreciate your help in identifying the cause of this problem and how to correctly configure FlutterFlow so that the variables are replaced in the email body when using an API Call with a JSON body (or plain text) containing HTML.

When I use the JSON format, that's when I'm closest to achieving it, as I receive this in the email:

A new user has registered on the name of the app.

Name and Surname: {{name}}
Email: {{email}}

What have you tried so far?

API Call Configuration:

Body Type: I have tried both "JSON" and "Text".

Defined Variables: name(String), email(String).

Attempt with JSON Body:

{

"to": ["*****@gmail.com"],

"from": "[My verified address in Resend]",

"subject": "New Registration on [App Name]",

"html": "<p>A new user has registered on the [App Name] app.</p>\n<p><strong>Name and Surname:</strong> {{name}}</strong></p>\n<p><strong>Email:</strong> {{email}}</strong></p>"

}

Result: The email arrives with {{name}} and {{email}} unreplaced.

Attempt with "Text" Body:

{

"to": ["*****@gmail.com"],

"from": "[My verified address in Resend]",

"subject": "New Registration on [App Name]",

"html": "<p>A new user has registered on the [App Name] app.</p>\\n<p><strong>Name and Surname:</strong> {{name}}</strong></p>\\n<p><strong>Email:</strong> {{email}}</strong></p>"

}

Result: The email arrives with {{name}} and {{email}} unreplaced, and the newline characters \n are shown literally.

"Register" Button Action Configuration:

The API Call action is executed after the "Auth - Create Account". In the action's configuration, the name and email variables are correctly mapped to the values of the form's text fields (nameField and emailField) using "Widget State".

Did you check FlutterFlow's Documentation for this topic?
No
2
1 reply