Feature: Add verification link into custom-email-provider event object
Description: Currently there is no easy way to obtain a verification link (link to the user email verification or to the password reset page) from the email to use it inside the custom email provider script. To get it now developer needs to parse html attribute from event.notification object and just then include it into the API call.
Use-case: Custom email provider with own templates, which are triggered by API service with own business logic. API service should accept some information about the user and some dynamic parameters to use with email service. Adding a verification link will make it more convenient to make such API calls.
// Beware, this method will only work if the first id attribute in the HTML is the verification link.
const getVerificationLink = (html) => {
const idRegex = /id\s*=\s*["']([^"']+)["']/;
const match = html.match(idRegex);
return match ? match[1] : '';
}
// Usage
getVerificationLink(event.notification.html)