Emails
Email mechanics are a pillar for creating engagement with your users.
Last updated
Email mechanics are a pillar for creating engagement with your users.
Last updated
LOOPS_TRANSACTION_ID=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" },
});
}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" },
});
}