Automated workflow to google doc into a Brevo email or a series of emails (e.g. to make an email course).
Specifically, converts markdown to html and uploads that as a template to Brevo (formely Sendinblue) via API.
Excalidraw source: https://link.excalidraw.com/l/9u8crB2ZmUo/3aW9SZ0aW3C
Before running the script we need a Brevo api key and a markdown file with required frontmatter data (see details below).
Create a .env
file in createTemplate's root and add the variable as shown below..
BREVO_API_KEY=your_api_key
Make sure you have node installed. node -v
- Run
npm install
- run
node index.js
- provide the path to the markdown file you want to convert into a Brevo template e.g.
mycourse/day1.md
!important Frontmatter fields
senderEmail
andreplyTo
should be valid emails from Brevo. If frontmatter isn't provided, default values will be used.
Add frontmatter with following fields at the top of the markdown file.
---
title: "Template name"
subject: "Subject of email template"
senderName: "Sender's name"
senderEmail: "Sender's email"
replyTo: "reply email"
---
content here
If the template already exists and you want to update it, then add an id
field in the frontmatter with the value matching the template's id in Brevo.
---
id: 33
---
content here
The template id can be found in the table list as #(id)
in Brevo -> Campaigns -> Templates.
TODO: document from #2
After creating all the templates using the above, follow the steps below to create an automation workflow ..
-
Create a new automation in Brevo -> Automations
-
Add an entry point (eg. a contact submits a form) and choose the form in the dropdown
-
Add a new step and select
Send an email
and choose the first email template to send when a form submits (ie. immediately) -
Add another step, select the condition
Add a delay
and specify the no. of day(s) to wait before sending the next course email -
Add a next step that sends the email and choose the relevant template (same as step 3)
-
Repeat steps 4 and 5 to add more
-
Finally, activate the automation