Files
js/utils/convertkit.ts
T
2022-05-27 17:46:49 +02:00

23 lines
573 B
TypeScript

const URL = "https://api.convertkit.com/v3/forms/2840699/subscribe";
export async function sendEmailToConvertkit(email: string, tags: number[]) {
const data = {
email,
api_key: process.env.NEXT_PUBLIC_CONVERTKIT_API_KEY,
tags,
};
const response = await fetch(URL, {
method: "POST",
mode: "cors",
cache: "no-cache",
credentials: "same-origin",
headers: {
"Content-Type": "application/json",
},
redirect: "follow",
referrerPolicy: "no-referrer",
body: JSON.stringify(data),
});
return await response.json();
}