How I built a free newsletter referral system for EmailOctopus in an hour
By: Stan Choi
Tags: Indiehackers, Referral Marketing, Email Marketing, Email Newsletters, Serverless

I am using EmailOctopus for my newsletter ARK Watcher (https://join.arkwatcher.com) and I love it. It allowed me to scale up to first 2500 subscribers for free and being able to connect AWS SES (Simple Email Service) to send up to 62,000 emails for free every month was essential for a daily newsletter like mine. And don’t get me started with their world class customer service! You can check them out here (disclaimer: referral link):

But, unlike Mailchimp and Convertkit, EmailOctopus does not have a robust ecosystem of solutions to support subscriber engagement activities as you scale up. One of the most important ways of organically growing your subscriber base is through a referral program and as far as I know, I do not know of any solution to date that easily integrates with EmailOctopus.

Now there are myriad of solutions out there for integrating referral system for newsletters but most have bells and whistles that you probably don’t need at this point and don’t offer any “free till you become legitimate newsletter” plan.

Here is a list of companies offering referral system integration and their pricing (as of 12/25/2020):

Sparkloop (https://sparkloop.app/)

Lowest Tier Price: $29/month

Easy Integration with EmailOctopus: No

Viral Loops (https://viral-loops.com/)

Lowest Tier Price: $34/month (can try for free for 14 days for up to 100 participants)

(can try for free for 14 days for up to 100 participants) Easy Integration with EmailOctopus: No

Referral Hero (https://referralhero.com/)

Lowest Tier Price: $49/month (can try for free for 14 days)

(can try for free for 14 days) Easy Integration with EmailOctopus: No

GrowSurf (https://growsurf.com/)

Lowest Tier Price: Free! (for 500 participants)

(for 500 participants) Easy Integration with EmailOctopus: No

So being the cheapskate and lazy maker I am, I decided to just roll with my own solution that I can build under an hour and not maintain ever.

Here are requirements to get started:

You know how to code a bit. Knowing Javascript is necessary for later part of the implementation. AWS account — you can signup for free at https://aws.amazon.com/ EmailOctopus account (not sure why you don’t have this yet but) — you can signup for free at (disclaimer: referral link) https://emailoctopus.com/?urli=FLqt8 And that’s it!

Now let’s get started.

Add a new numerical custom field to your EmailOctopus list contacts:

I named mine “Referred” but You can name your field anything. Just remember what you named it for later.

Also, take a note of what your list unique id is by looking at the url: https://emailoctopus.com/lists/{list id}

2. Add {{ID}} merge tag to your referral link. This will merge in EmailOctopus’s unique contact Id. I’ve updated my Facebook, Twitter and email button with the link with ID merge tag as well. Here is an example:

3. Create your EmailOctopus API key

Keep the API key copied for later.

4. Install Serverless on your local terminal and setup your project by following instructions here: https://www.serverless.com/examples/aws-python-simple-http-endpoint

npm install serverless -g serverless install -u https://github.com/serverless/examples/tree/master/aws-python-simple-http-endpoint -n aws-python-simple-http-endpoint npm install --save serverless-python-requirements

*** I chose python as my language as I built all my backend with python but you are more than welcome to use any of supported languages by AWS Lambda. ***

5. Update handler.py file like so:

6. Update serverless.yml file and insert your credentials:

*** If you don’t have your AWS profile setup separately like I have, you can remove profile key and use your default one. ***

7. Add requirements.txt file:

8. Deploy the function and take a note of the route url:

serverless deploy

9. On your landing page, add a click event bind (target.addEventListener()) to the subscribe button with function that does following:

Detects that url path has id params If id params exists, make a AJAX GET request to Serverless function url deployed in #8 with the id as route params.

My landing page is implemented is vanilla VueJS and probably won’t be relevant for most readers but here is an example:

Detect id params on document load

Subscribe button with click event bind

Click event bound method with url to Serverless function

If all things are setup correctly, you should see this once your subscribers start sending referrals to their friends and they subscribe:

Now you can setup a segment with contacts over a specified referred count. I set mine up for greater than equal to 3:

Let me know if you have any questions down below and if you are interested in my newsletter or just want to show me some ❤️, you can subscribe here: