Shipped
HomeContacts
  • Get started
  • 📚Tutorials
    • Make a waiting list
    • Launch a pre-sale
    • Build a SaaS
    • Create your store on Lemon Squeezy
  • 🟩Features
    • AI Services
    • Affiliate Program
    • Analytics
    • Authentication
      • MailChimp
      • Loops
      • AWS SES
      • SendGrid
      • Supabase Auth
        • Supabase Authentication Flow
        • Supabase Magic Link
        • Supabase Email & Password
        • Supabase Login with Google
    • API endpoints
      • 🛡️Authenticated API
    • Blog
    • Customer support
    • Chrome Extension
    • Dark mode
    • Database
      • Update your database
      • MongoDB
    • Emails
    • Error pages
    • Icons
    • Onboarding
    • Payments
      • Lemon Squeezy
        • Subscriptions
        • One-time purchase
        • Test mode
      • Stripe
    • Private pages
    • SEO
    • shadcn/ui
    • Supabase
    • Workspace / Organizations
  • 📦Components
    • AccountMenu
    • CtaBox
    • DarkModeSwitch
    • Explainer video
    • FAQ
    • Features
    • Footer
    • Header
    • Hero
    • Lifetime
    • Pricing
    • Sales Notification
    • Secondary Sidebar Pages
    • Sidebar
    • Tabs
    • Testimonials
    • Waitlist
    • WebAppPage
  • 🚀Deployment
  • ✅Other
    • Configuration
    • Changelog widget
    • Favicon
    • Google Fonts
    • Sitemap
    • Theme
  • Updates
  • GitHub Repository
  • Support
Powered by GitBook
On this page
  • MailChimp setup
  • Find your Audience ID
  • Create your API Key
  • Configure server prefix
  • Add a new email contact at sign-up
  • Send transactional email
  • Send transactional email with template
  • Loops setup
  • Create API Key
  • Add a new contact at sign-up
  • Send a transactional email

Was this helpful?

  1. Features

Emails

Collect emails, send transactional emails, product updates, and email drip.

PreviousMongoDBNextError pages

Last updated 11 months ago

Was this helpful?

I've built 5 SaaS in the last 2 years, and I know how email is crucial to engage with your customers, still in 2024.

Shipped comes with support for two popular products, and .

Both allow you to:

  • Collect user emails

  • Send product update emails to the subscribers

  • Configure an email drip

  • Send transactional emails from your product

MailChimp setup

Configure these environment variables MAILCHIMP_AUDIENCE_LIST_ID, MAILCHIMP_API_KEY, and MAILCHIMP_SERVER_PREFIX.

Find your Audience ID

You need it to add the users to your email list.

Log in to your account and then:

  1. Click Audience

  2. Click All contacts

  3. If you have more than one audience, click the Current audience drop-down and choose the one you want to work with.

  4. Click the Settings drop-down and choose Audience name and defaults.

  5. In the Audience ID section, you’ll see a string of letters and numbers. This is your audience ID.

Save the value into MAILCHIMP_AUDIENCE_LIST_ID in the .env file

Create your API Key

Needed to send transactional emails.

  1. Click Create New Key.

  2. Name your key. Be descriptive, so you know what app uses that key. Keep in mind that you’ll see only this name and the first 4 key digits on your list of API keys.

  3. Click Generate Key.

  4. Once we generate your key, click Copy Key to Clipboard. Save your key someplace secure–you won’t be able to see or copy it again. If you lose this key, you’ll need to generate a new key and update any integration that uses it.

  5. Click Done.

Save the value into MAILCHIMP_API_KEY in the .env file

Configure server prefix

To find the value for the server log into your Mailchimp account and look at the URL in your browser. You’ll see something like https://us19.admin.mailchimp.com/ The us19 part is the server prefix. Note that your specific value may be different.

Save the value into MAILCHIMP_SERVER_PREFIX in the .env file

Add a new email contact at sign-up

Open the file src/config/auth.ts and uncomment addMailChimpListMember in the signIn event handler

src/config/auth.ts
events: {
  async signIn(event) {
    if (event.isNewUser && event.user.email) 
      await addMailChimpListMember({
        email: event.user.email,
        firstName: event.user.name || "",
        lastName: "",
        tags: ["new-user"],
      });

    }
  },
},

Send transactional email

import { sendTransactionalEmail } from "@/libs/mailchimp";

await sendTransactionalEmail({
    to: ["john@doe.com", "jane@doe.com"],
    subject: "You reached the limits",
    text: "Upgrade to get more requests",
    html: "<p>Upgrade to get more</p>"
})

Send transactional email with template

Define and store your template in MailChimp.

import { sendTransactionalEmailWithTemplate } from "@/libs/mailchimp";

await sendTransactionalEmailWithTemplate({
    to: ["john@doe.com", "jane@doe.com"],
    subjplateName: "my template",
    mergeTags: [{ 
        name: "merge1",
        content: "merge1 content",
    }]
})

Loops setup

To set up Loops you need to create an API Key.

Create API Key

  1. Go to Settings

  2. Click on API

  3. Click on Generate key

  4. Copy the key and paste it to .env as the value for LOOPS_API_KEY

Add a new contact at sign-up

Open the file src/config/auth.ts and uncomment createLoopsContact in the signIn event handler

src/config/auth.ts
events: {
  async signIn(event) {
    if (event.isNewUser && event.user.email) {
      await createLoopsContact({
        email: event.user.email,
        firstName: event.user.name || "",
        lastName: "",
        userGroup: "new-user",
      });

    }
  },
},

Send a transactional email

Go to Loops and create a new Transactional. Copy the transactional id.

import { sendTransactionalEmail } from "@/libs/loops";

await sendTransactionalEmail({
    "clfq6dinn000yl70fgwwyp82l", // <-- transactional id
    "john@doe.com", // <-- to email
    {
        loginUrl: "https://myapp.com/login/" // <-- dynamic content
    }
})

Navigate to the section of your account.

Learn more about the MailChimp Marketing API on the

Learn more about the MailChimp Transactional API on the

Log in to

Learn more about the Loops API in the

🟩
MailChimp
Loops
MailChimp
API Keys
documentation
documentation
Loops
documentatio
n
How to use Loops for Magic Link with NextAuth