open-revolution / openrevolution

Open Revolution website, courses and wiki including diginomics (introduction to the digital economy)
https://openrevolution.net/
3 stars 0 forks source link

Email Course: setup in Brevo (SendinBlue) #86

Closed theo-cox closed 1 year ago

theo-cox commented 1 year ago

Work out - by doing it - how to setup a simple email course in Brevo.

Can start with a trial run by creating the course from e.g. two input emails. ie. given two emails in markdown in a gist or github repo have a little course

Next part would be documenting or doing the setup for the full course.

Job Stories

When i have a course drafted i want to copy it over as quickly as possible

When i revise my course i want to update my existing emails as easily as possible

Acceptance

Tryout

Tooling and docs

Tasks

Test email course

Notes

Email creation howto / notes

Means you need to use the inbuilt editor and do things internally. Quickstart guide to the editor: https://help.brevo.com/hc/en-us/articles/360016831820-Drag-Drop-Editor-New-design-Part-1-Editor-Overview-

Alternatives

Automation Howto

For the Diginomics 101 course we want to send 5 emails over 5 days, triggered when people sign up.

This makes use of Brevo's automation features: https://www.sendinblue.com/blog/email-automation/#what-are-automated-emails

The process is fairly simple. Login and navigate to the automation section on the side menu and create a new automation. The key things are:

An entry point: this is the trigger that starts the email.

image

We'll want to select the diginomics 1010 signup form: image

Workflow steps: these are the ordered steps triggered by the entry condition. They can be chained together using the little "+" icon

image

We basically just need to automate sending an email and a wait condition equaling 1 day.

Each new email will require a new template:

image

And the wait can be set under "conditions"

image

Final thing is to test the workflow - click the little the little conical flask icon (top right of screeenshot) and enter test email

image

You're then good to go!

theo-cox commented 1 year ago

@rufuspollock @khalilcodes see here for automation notes

rufuspollock commented 1 year ago

@khalilcodes regarding creating email templates we can't use markdown directly in brevo it seems. However, maybe we can get around this via api using html - see https://developers.brevo.com/reference/createsmtptemplate and excerpt below.

Suggestion: could you spend 30-1h seeing if you can:

const SibApiV3Sdk = require('sib-api-v3-sdk');
let defaultClient = SibApiV3Sdk.ApiClient.instance;

let apiKey = defaultClient.authentications['api-key'];
apiKey.apiKey = 'YOUR API KEY';

let apiInstance = new SibApiV3Sdk.TransactionalEmailsApi();

let smtpTemplate = new SibApiV3Sdk.CreateSmtpTemplate();

smtpTemplate.sender = {"name":"John Doe","email":"example@example.com"};
smtpTemplate.templateName = "Example Template";
smtpTemplate.htmlContent = "<html><body><h1>This is my first transactional email</h1></body></html>";
smtpTemplate.subject = "New Subject";
smtpTemplate.replyTo = "replyto@domain.com";
smtpTemplate.toField = "example@example.com";
smtpTemplate.isActive = true;
smtpTemplate.attachmentUrl = "https://example.net/upload-file";

apiInstance.createSmtpTemplate(smtpTemplate).then(function(data) {
  console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}, function(error) {
  console.error(error);
});
khalilcodes commented 1 year ago

@rufuspollock script moved to https://github.com/life-itself/create-template

khalilcodes commented 1 year ago

@rufuspollock updated tasks for script and automation. Basically the steps are creating templates (for each days) and then adding those in the automation workflow.

rufuspollock commented 1 year ago

@khalilcodes great. and what was the bug with the template creation in the end?

Also can you update acceptance?

rufuspollock commented 1 year ago

FIXED. Have a working script, follow up more ambitious workflow in life-itself/brevo-utils#1