• George
  • Posts
  • How I save myself $43/month by writing my own script to collect emails using Beehiiv API

How I save myself $43/month by writing my own script to collect emails using Beehiiv API

The decision to build an email list

I have been putting it off becuase it’s a lot of effort, but growing and owning an email list might be the best way to make money in the long term.

Since I am already posting on Beehiiv. I thought I would collect emails using a lead magnet

So I went ahead and tried to find out how I could put a lead magnet on a landing page and build my email list.

I need to be on Scale plan and it costs $43 a month?!

I found out I need to be on the Scale Plan to be able to put a lead magnet on my landing page to collect emails.

Beehiiv Scale Plan

To pay $43 a month, whilst I have 1 active subscriber, doesn’t sound like a good deal to me. What if it doesn’t work out?

Yea, I could go on a 30 day trial and cancel it if it doesn’t work, but that means I would need to work super hard to try to get people to sign up within these 30 days which I don’t have the time, the know-how to do.

How many subscribers do I need to justify the $43 a month?

To justify the cost, I need to breakeven at the minimum. Assuming a 3% conversion rate, I need 33 active subscribers, 1,111 visitors.

I can build my own landing page, I have my own lead magnet. I just need a way to send the email to Beehiiv

Leverage Beehiiv API so I don’t need to upgrade my plan

Beehiiv happens to have an API that allows me to import email and that is exactly what I need

Here’s the plan:-

  1. Build a landing page to collect email using Django

  2. Put up a lead magnet on an S3 bucket

  3. Use Beehiiv API to add subscribers to the email list from my Django app

Here’s what my views.py looks like to use Beehiiv API

def index(request):
    if request.method == 'POST':
        # Get form data
        name = request.POST.get('name')
        email = request.POST.get('email')

        # Optional: Save to your local DB
        signup = EmailSignup(email=email)
        signup.save()

        # Add to Beehiiv
        beehiiv_url = f"https://api.beehiiv.com/v2/publications/{settings.BEEHIIV_PUBLICATION_ID}/subscriptions"
        headers = {
            "Authorization": f"Bearer {settings.BEEHIIV_API_KEY}",
            "Content-Type": "application/json",
        }
        payload = {
            "email": email,
            "send_welcome_email": True,  # Sends Beehiiv’s welcome email
            "utm_source": "django_app",  # Optional tracking
        }
        if name:
            payload["custom_fields"] = [{"name": "name", "value": name}]

        response = requests.post(beehiiv_url, json=payload, headers=headers)

        # Check if Beehiiv accepted it
        if response.status_code == 201:
            # Success: Return the download link (or whatever you want)
            s3_client = boto3.client('s3', aws_access_key_id=settings.AWS_ACCESS_KEY, aws_secret_access_key=settings.AWS_SECRET_ACCESS_KEY)
            download_url = s3_client.generate_presigned_url(
                'get_object',
                Params={'Bucket': settings.AWS_STORAGE_BUCKET, 'Key': 'dj_saas_boilerplate2-main (1).zip'},
                ExpiresIn=300
            )
            return render(request, 'partials/download_link.html', {'download_url': download_url})
        else:
            # Failure: Log error, show form again with message
            print(f"Beehiiv error: {response.text}")
            return render(request, 'partials/email_form.html', {'error': 'Something went wrong, try again.'})

    # GET request: Show the form
    return render(request, 'core/index.html', {'form': None})  # Adjust template name

That’s it

It is working flawlessly and I have saved myself $43 a month. Beehiiv team, I like your product but I am too stingy, please have mercy on this post.

Hi, my name is George. My goal is to build apps, make money and quit my job. I blog about copywriting, marketing and technical here. Consider subscribing to my newsletter :)