Add contacts without sending double opt-in
Contacts added to a newsletter are legally obliged to give their consent (usually via double opt-in). There may be scenarios, in which a contact already gave their permission. In this case, this feature allows adding or importing contacts without sending a double opt-in message.
caution
Make sure that your project uses Brevo Module v3.1.0 or later.
Allow adding contacts without sending a double opt-in mail
- Add
contactsWithoutDoi
to yourAppModule
:
BrevoModule.register({
brevo: {
//...
BlacklistedContacts
}
+ contactsWithoutDoi: {
+ allowAddingContactsWithoutDoi: true,
+ },
//...
});
- Add
allowAddingContactsWithoutDoi
to theconfig.ts
in the api:
//...
ecgRtrList: {
apiKey: envVars.ECG_RTR_LIST_API_KEY,
},
+ contactsWithoutDoi: {
+ allowAddingContactsWithoutDoi: true,
+ },
//...
- Add it to the
config.ts
in the admin:
//...
return {
...cometConfig,
apiUrl: environmentVariables.API_URL,
adminUrl: environmentVariables.ADMIN_URL,
sitesConfig: JSON.parse(environmentVariables.SITES_CONFIG) as SitesConfig,
buildDate: environmentVariables.BUILD_DATE,
buildNumber: environmentVariables.BUILD_NUMBER,
commitSha: environmentVariables.COMMIT_SHA,
campaignUrl: environmentVariables.CAMPAIGN_URL,
+ allowAddingContactsWithoutDoi: true,
}
- Add
allowAddingContactsWithoutDoi
to theBrevoConfigProvider
in yourApp.tsx
:
//...
<BrevoConfigProvider
value={{
scopeParts: ["domain", "language"],
apiUrl: config.apiUrl,
resolvePreviewUrlForScope: (scope: ContentScope) => {
return `${config.campaignUrl}/block-preview/${scope.domain}/${scope.language}`;
},
+ allowAddingContactsWithoutDoi: config.allowAddingContactsWithoutDoi,
}}
>
Add BlacklistedContacts
table
To prevent re-adding contacts, that unsubscribed (are blacklisted), those contacts are hashed and stored in a separate table. Adding a contact again, is only possible, if the contact gives his consent via double opt-in.
- Use
createBlacklistedContactsEntity
for creating aBlacklistedContacts
entity. PassScope
and add it to theAppModule
:
BrevoModule.register({
brevo: {
//...
+ BlacklistedContacts
}
//...
});
- Add
emailHashKey
to your environment variables:
+ @IsString()
+ @Length(64)
+ EMAIL_HASH_KEY: string;
- Also add it to the
config.ts
and yourAppModule
:
//...
ecgRtrList: {
apiKey: envVars.ECG_RTR_LIST_API_KEY,
},
contactsWithoutDoi: {
allowAddingContactsWithoutDoi: config.contactsWithoutDoi.allowAddingContactsWithoutDoi,
+ emailHashKey: config.contactsWithoutDoi.emailHashKey,
},
sitePreviewSecret: envVars.SITE_PREVIEW_SECRET,
BrevoModule.register({
brevo: {
//...
BlacklistedContacts
}
contactsWithoutDoi: {
allowAddingContactsWithoutDoi: config.contactsWithoutDoi.allowAddingContactsWithoutDoi,
+ emailHashKey: config.contactsWithoutDoi.emailHashKey,
},
//...
});
Add action logging for adding contacts without sending a double opt-in
When a user adds a contact and skips sending the double opt-in email, the action is logged.
- Use
createBrevoEmailImportLogEntity
for creatingBrevoEmailImportLog
entity. PassScope
and add it to theAppModule
:
BrevoModule.register({
brevo: {
//...
+ BrevoEmailImportLog
}
//...
});