Invite OFN customers to subscribe to a newsletter
This flow is used to send an automated email invite to customers of an OFN enterprise to subscribe to a newsletter. The flow in the template uses Brevo nodes, but these can be swapped out for other mailing list providers (e.g. Hubspot, Mailchimp etc).

Overview
This flow is designed to invite new customers to subscribe to an enterprise's mailing list whilst adhering to GDPR. Customers are not automatically added to a mailing list, but instead are sent an email invite asking if they'd like to subscribe, which links to an 'opt-in' form. The flow is composed of four main sections.
A database query pulls the details of any new customers of an enterprise within the last 7 days. A new customer is defined as the first time a specific email address completes an order.
The Brevo API is queried for all existing subscribers of the enterprise and any 'blacklisted' subscribers. Blacklisted subscribers are those who:
Have unsubscribed from your email campaigns by using your unsubscription form.
Have marked your email campaigns as spam.
An email campaign sent to the contact resulted in a hard bounce.
By also getting the blacklisted contacts, we can exclude these from the newsletter invite. This maintains email reputation and minimises customer frustration. The flow therefore takes the new OFN customer list and excludes any existing subscribers or blacklisted contacts.
Customisable email content nodes allow you to enter your required email content.
The flow waits until 9am on Monday (to send email at a sociable hour) and sends invite emails to new customers
Requirements
The API key for your enterprise's mailing list provider (guidance on getting Brevo API key here).
A subscription form created by the enterprise for their newsletter. The subscribe button in the email invite will link to this form. Guidance on creating a subscription form in Brevo here.
Contact details (email, website) for the enterprise and a logo image to include in the email (more info later).
How to use
Download the template flow file, create a new workflow in N8N and import the file:
Add credentials
Enter your OFN instance credentials in the Postgres node (guidance here) and the enterprise's Brevo credentials in the Brevo nodes. In the HTTP node 'Finds existing Brevo contacts', select your Brevo credential here too. Enter your OFN Sendgrid credentials in the Sendgrid node (or your Brevo credentials if using Brevo to send the email invite - see flow for more info).
Get newsletter ID
Use the Get Contacts and Get Attributes nodes to find the newsletter ID for your required newsletter. The simplest way is to complete the 'subscribe' form with your own email address and then look up the newsletter ID that appears against your email (this avoids having to log in to the enterprise's mailing list provider to check the newsletter ID)
Complete the 'Customise Email Content' nodes
Enter all the required information in these nodes. Some are pre-filled with example text, but all can be edited. Paste the link to your enterprise's subscription form in the 'Sign up button link (to subscription opt-in form)' field, and paste the link to your enterprise's logo or suitable header image in the 'Enterprise logo link' field. For best results, use a landscape image. This must be an 'online' image with a URL. You can get the URL for an image on a webpage by right clicking and selecting 'Copy image address'.
Send a test email
In the Sendgrid node, I've created an HTML template for the email which uses the information you entered in the Customise Email Content nodes. This HTML template can be edited if required. To check everything looks okay, you can now test the workflow. You will receive as many emails as there were new contacts that week, so you can insert a 'Limit' node before the Sendgrid node if needed.
Looks good? Almost ready to activate!
If everything in the email looks good, then you can go ahead and replace your email in the Recipient and Sender email fields in the Customise Email Content 2 node with the enterprise's email in the Sender field, and {{$json['Recipient email']}} in the Recipient email field. Reconnect the 'Wait' node, so that emails are sent at a sociable hour on Monday (not 11pm on Sunday when the workflow runs).
Can this be used for providers other than Brevo?
Whilst this flow was built using Brevo nodes, these can be swapped out for other mailing list providers (e.g. Hubspot, Mailchimp etc). Most mailing list providers have nodes in N8N, so find the corresponding node for your required provider and copy the fields across. Some fields will undoubtedly be named differently, so always refer to the API or developers handbook for your required provider if unsure. You can also use the #n8n slack channel if you're stuck.
Last updated