DirectoryFast
  • 🚀Get Started
  • 🔤Tutorials
    • Bring me to life!
    • How it's structured?
    • Make it yours
    • Bonus
  • 🛠️Features
    • AI
      • AI URL Scanner & Scan Jobs
    • Analytics
    • Authentication
    • API
      • Protected Endpoints
    • Blog
    • Database
    • Emails
    • Error Pages
    • Icons
    • Payments
    • Private Pages
    • SEO
  • 📦General Components
    • Shadcn/ui Components
    • Navbar
    • Footer
    • SignIn Modal
    • Hero Section
    • Social Proof
    • Collections Social Proof
    • Featured Section
    • Latest Collections Section
    • Latest Products Section
    • Recommended Section
  • 📦Directory Components
    • Product Card
    • Collection Card
    • Product Note
    • Search Bar
    • Tags
    • Product Options Toggle
    • Combobox
    • Multi-Combobox
    • Submit Product
    • Feature Product
    • Manage Note
    • Manage Collection
    • Dashboard Tables
  • ⛓️Links
    • GitHub Repository
    • Support
Powered by GitBook
On this page
  • Loops
  • Setup
  • Contacts
  • Newsletter
  1. Features

Emails

Email mechanics are a pillar for creating engagement with your users.

PreviousDatabaseNextError Pages

Last updated 11 months ago

Loops

Loops is a great tool for collecting mails, sending transactional mails (think user action like SIgnIn) and even more like marketing mails or newsletter handling.

Setup

  1. Create an account on .

  2. On your Dashboard go to Settings > API and Generate Key

  3. Paste it to your .env file

.env
LOOPS_API_KEY=
  1. Create a Transactional ID in Transactional > New, this will be the mail your users receive when they SignIn.

  2. Customize your email and Publish it, paste the Publish > transactionalId value into your .env file:

.env
LOOPS_TRANSACTION_ID=
  1. Set your DNS Records on Settings > Domain > View records from your registrar (Cloudflare, NameCheap, Gandi...)

Contacts

DirectoryFast automatically add all the signed up users to your contact list.

If you want to update or modify this behavior, go to the /api/mailing/signin/route.ts file:

mailing/signin/route.ts
export async function POST(request: Request) {
  const body = await request.json();
  const res = await fetch(`https://app.loops.so/api/v1/contacts/create`, {
    method: "POST",
    body: JSON.stringify({
      email: body.email,
      subscribed: false,
    }),
    headers: {
      Authorization: `Bearer ${process.env.LOOPS_API_KEY}`,
      "Content-Type": "application/json",
    },
  });
  return new Response(JSON.stringify(res), {
    status: 201,
    statusText: "Created",
    headers: { "content-type": "application/json" },
  });
}

Newsletter

The newsletter feature let visitors subscribe to your newsletter with or without signing up.

It adds those visitors to the contact list with the "subscribed" value set to "true".

To modify this, go to the /api/mailing/subscribe/route.ts file:

mailing/subscribe/route.ts
export async function POST(request: Request) {
  const body = await request.json();
  const res = await fetch(`https://app.loops.so/api/v1/contacts/create`, {
    method: "POST",
    body: JSON.stringify({
      email: body.email,
      source: "newsletter",
    }),
    headers: {
      Authorization: `Bearer ${process.env.LOOPS_API_KEY}`,
      "Content-Type": "application/json",
    },
  });
  return new Response(JSON.stringify(res), {
    status: 201,
    statusText: "Created",
    headers: { "content-type": "application/json" },
  });
}
🛠️
Loops
API Details from Publish tab