chore: add script for listing newsletter contacts
This commit is contained in:
parent
ecb57cf7ab
commit
c41817c704
@ -1,8 +1,8 @@
|
|||||||
# MkSaaS
|
# MkSaaS
|
||||||
|
|
||||||
Make AI SaaS in days, simply and effortlessly.
|
Make AI SaaS in a weekend.
|
||||||
|
|
||||||
MkSaaS is a complete Next.js boilerplate for building AI SaaS websites. Make money from day one with our battle-tested stack and built-in monetization features.
|
The complete Next.js boilerplate for building profitable SaaS, with auth, payments, i18n, newsletter, dashboard, blog, docs, blocks, themes, SEO and more.
|
||||||
|
|
||||||
## Author
|
## Author
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
"db:migrate": "drizzle-kit migrate",
|
"db:migrate": "drizzle-kit migrate",
|
||||||
"db:push": "drizzle-kit push",
|
"db:push": "drizzle-kit push",
|
||||||
"db:studio": "drizzle-kit studio",
|
"db:studio": "drizzle-kit studio",
|
||||||
|
"list-contacts": "tsx scripts/list-contacts.ts",
|
||||||
"docs": "content-collections build",
|
"docs": "content-collections build",
|
||||||
"email": "email dev --dir src/mail/templates --port 3333"
|
"email": "email dev --dir src/mail/templates --port 3333"
|
||||||
},
|
},
|
||||||
|
25
scripts/list-contacts.ts
Normal file
25
scripts/list-contacts.ts
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import dotenv from 'dotenv';
|
||||||
|
import { Resend } from 'resend';
|
||||||
|
dotenv.config();
|
||||||
|
|
||||||
|
const resend = new Resend(process.env.RESEND_API_KEY);
|
||||||
|
|
||||||
|
export default async function listContacts() {
|
||||||
|
const contacts = await resend.contacts.list({
|
||||||
|
audienceId: process.env.RESEND_AUDIENCE_ID!,
|
||||||
|
});
|
||||||
|
|
||||||
|
// print all emails
|
||||||
|
const emails: string[] = [];
|
||||||
|
if (Array.isArray(contacts.data?.data)) {
|
||||||
|
for (const contact of contacts.data.data) {
|
||||||
|
emails.push(contact.email);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.error('contacts is not iterable');
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(emails.join(', '));
|
||||||
|
}
|
||||||
|
|
||||||
|
listContacts();
|
Loading…
Reference in New Issue
Block a user