2.22.1 • Published 5 months ago

resin-emails v2.22.1

Weekly downloads
40
License
Apache-2.0
Repository
github
Last release
5 months ago

Balena newsletter generator

The purpose of this tool is to help with the creation of balena newsletters and other marketing emails. It uses templating principles and a responsive email framework to convert simple HTML tags into the complex table HTML required for emails, so you don't have thousands of tables in your markup. The main technologies used are:

Features

  • Generates the email as a responsive HTML file.
  • Mailchimp integration
    • Creates a Mailchimp campaign
    • Adds the HTML email to the campaign
    • Sends test email (will not be sent to audience, only specified tester)

Installation

You will need Node.js 8 or greater.

git pull https://github.com/balena-io/balena-emails
cd balena-emails
npm install

Usage

To use the tool you will need to:

  • specify which email template to use (see the templates section)
  • provide a JSON file with the template content (see the datafile section)

Watch

If you want to develop a new template, edit an existing one or just see how the template looks like:

npm run watch -- --datafile path/to/datafile.json --template <newsletter>

All files except the .json datafile are watched so you will see the changes imediately on your browser. If you modify the datafile you will need to re-run this command.

Build

If you just want to generate the responsive email run this command. The generated output can be located on the dist folder:

npm run build -- --datafile path/to/datafile.json --template <newsletter>

Staging

If you want to generate the responsive email and publish the result to a netlify webpage you can run:

npm run staging -- --datafile path/to/datafile.json --template <newsletter> --netlifytoken <NETLIFY_AUTH_TOKEN>

Here is how you can get your Netlify token.

Publish

If you want to generate the responsive email, publish to netlify, create the mailchimp campaign and send a test email (this will not send the campaign to the end users):

npm run publish -- --datafile path/to/datafile.json --template <newsletter> --netlifytoken <NETLIFY_AUTH_TOKEN> --mailchimpkey <YOUR_MAILCHIMP_API_KEY>

Here is how you can get your Mailchimp API_KEY.

Templates

This are the templates currently available:

  • newsletter

Datafile format

The datafile must be a JSON file with the following parameters (there is also a sample file in the data folder). Parameters in bold are required.

Global configuration

parametertypedescription
configurationobjectSettings for the template
configuration.mailchimp_recipientsstringThe target audience id. Some common ones are: 1c73cb7379 for 'Balena Users (Newsletter)', ab92290a0b for 'Test audience', 79b41f7587 for 'Testing'. Here is how to find the recipient/audience id. Default: ab92290a0b
configuration.mailchimp_titlestringThe title of the campaign. Default: Autogenerated campaign -- Default title
configuration.mailchimp_subject_linestringThe subject line for the campaign. Default: Autogenerated campaign -- Default subject line
configuration.mailchimp_preview_textstringThe preview text for the campaign. Default: Autogenerated campaign -- Default preview text
configuration.mailchimp_from_namestringThe from name on the campaign (not an email address). Default: balena
configuration.mailchimp_reply_tostringThe reply-to email address for the campaign. Default: hello@balena.io
configuration.mailchimp_test_emailsstring arrayAn array of email addresses to send the test email to. Default: []
configuration.netlify_site_namestringName of the website on netlify. The site can be accessed on https://<netlify_site_name>.netlify.com Default: balena-default-site
configuration.assets_folderstringPath to folder with images or other media embedded on the template. Relative to root.

Template: Newsletter settings

parametertypedescription
headerobjectSettings for the email header
header.titlestringThe title shown on the email header (top right, eg: October 2019)
header.imageurlBackground image for the header. For compatibility reasons it's better if the image has a 600/380 ratio. Default: here
header.image_heightnumericHeight for the image header. Default: 380px
header.image_widthnumericWidth for the image header. Default: 600px
header.colorstringBackground color for the header. Default: rgb(41, 80, 111)
featuredobjectSettings for the featured intro section
featured.textstringHTML formated content to be shown on the featured section (does not need to be escaped)
newsobject arraySettings for the News from balenaHQ section. Each object is constructed as follows below.
[news].titlestringNews card title
[news].imagestringLeft side image on the news card.
[news].button_textstringText to display on the button
[news].linkstringURL if button/image are clicked
[news].textstringHTML formated content to be shown on the news card (does not need to be escaped)
postsobject arraySettings for the The latest from our blog section. Each object is constructed as follows below.
[posts].titlestringBlog card title
[posts].imagestringLeft side image on the posts card.
[posts].button_textstringText to display on the button
[posts].linkstringURL if button/image are clicked
[posts].textstringHTML formated content to be shown on the blog card (does not need to be escaped)
projectsobject arraySettings for the Projects of the month section. Each object is constructed as follows below.
[projects].titlestringProject title
[projects].linkstringURL if title is clicked
[projects].textstringHTML formated content to be shown on the project description (does not need to be escaped)
jobsobjectSettings for the jobs section
jobs.textstringAdditional text to display under the jobs section.
eventsobject arraySettings for the Events section. Each object is constructed as follows below.
[events].attendingstringWhether there will be balena representation on the event or not. yes|no
[events].titlestringName of the event
[events].linkstringURL if title is clicked
[events].locationstringLocation of the event. Usually City, Country
[events].event_datestringDate of the event. Usually Month datefrom - dateto, year
2.22.1

5 months ago

2.22.0

1 year ago

2.21.0

2 years ago

2.19.0

2 years ago

2.18.0

2 years ago

2.20.0

2 years ago

2.17.0

2 years ago

2.15.0

2 years ago

2.15.1

2 years ago

2.16.0

2 years ago

2.14.1

2 years ago

2.14.0

2 years ago

2.13.0

2 years ago

2.12.0

3 years ago

2.11.0

3 years ago

2.10.0

3 years ago

2.9.1

3 years ago

2.8.0

3 years ago

2.9.0

3 years ago

2.7.0

3 years ago

2.6.0

3 years ago

2.5.0

3 years ago

2.4.8

3 years ago

2.4.5

3 years ago

2.4.7

3 years ago

2.4.6

3 years ago

2.4.4

3 years ago

2.4.3

3 years ago

2.4.1

3 years ago

2.4.2

3 years ago

2.4.0

3 years ago

2.3.0

3 years ago

2.2.0

3 years ago

2.1.0

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.1.0

5 years ago

1.0.0

5 years ago

0.0.2

6 years ago