How to insert registration/authentication link?

I would like to send Registration confirm emails in which I have some welcoming text and a « Confirm registration » button. How to make this button opens a specific authentication url, valid for the specific user who receives it?

Hi @MiroslavK , thanks for posting on this community!

How would you be generating this authentication URL, and how would you make it specific for each contact?

Hi, our software generates a unique authentication token, the url looks like: /activate/{{token}}. I think I have a clue on how to achieve it. What about if I create a new attribute « TOKEN » under normal attributes - /lists/add-attributes, then I pass it in me request along with the other attributes, will it work as expected? What do you think?

Exactly. What you can do:

  • create an attribute, maybe the whole authentication URL, including the TOKEN
  • in your email template, you add this attribute: each contact will have the attribute corresponding to him- / herself

Hey, maybe, I am trying to use transactional emails in a way they have not been design to :frowning_face:. Let me tell you the purpose - I would like to send emails to users upon registration in order they to confirm their emails. With that said tokens are issued on demand and I cannot put them in advance. Can/Should I still use transactional emails, i see they use Contact lists, while I do not have such as the users are still not registered when I want to send emails.

Ah ok I understand better your use case. Yes of course, you should be able to use the tokens as parameters in the API as well!

Hi, should our request to brevo be something like the one below? I just want to be sure that the following steps are enough 1. Create attribute with name « Token » under Settings → Contact attributes → Normal attributes 2. start passing this attribute in your request 3. create a link saying your_url/activate/{{contact.TOKEN}}.

Can you confirm?

// send mail with defined transport object
let info = await transporter.sendMail({
from: ‹ "mauricio@brevo.com ›, // sender address
to: « john@domain.com », // list of receivers
subject: « Hello :heavy_check_mark: », // Subject line
text: « Hello {{ contact.FIRSTNAME }} , This is an SMTP message with customizations », // plain text body
templateId: 1
** token: « kolskjudh12384nsghdbsbga »**
});

I am a bit puzzled on how it works when I do not have a « Contact list »… How will it recognize what contact.TOKEN is…

I think there are two things here, from what I see on this page: https://developers.brevo.com/docs/send-a-transactional-email

  1. Use an HTML template
    In this case, you send the whole HTML code so you can choose what you want to include.

  2. Create a template inside Brevo and then send parameters
    In this case, you have to add the contacts to the contact list, create a contact attribute, and fill in the contact attribute with the right value.

Inside the template, here is how I would do include the attribute to the link, so that it’s dynamic (double check that it’s working before sending the real emails):

1 Like

Hey,
as someone who discovered this after a bit of googling, it would be really great if this was in the docs.

1 Like

[quote=« MiroslavK, post:1, topic:366, full:true »]
I would like to send Registration confirm emails in which I have some welcoming text and a « Confirm registration » button. How to make this button opens a specific authentication url, valid for the specific user who receives it?
[/quote]

To achieve this, include a unique token or user-specific identifier in the confirmation URL behind the « Confirm Registration » button. When users click the button, this token should be sent to your server, allowing you to verify the user’s identity and confirm their registration. Ensure the token is secure, unique to each user, and has an expiration for added security.