type Mailgun = {
api_key: string;
};
export async function main(
resource: Mailgun,
domain: string,
data: {
address: string;
tags: string[];
created_at?: string;
}[]
) {
return (
await fetch(`https://api.mailgun.net/v3/${domain}/unsubscribes`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization:
"Basic " + Buffer.from(`api:${resource.api_key}`).toString("base64"),
},
body: JSON.stringify(data),
})
).json();
}
Submitted by hugo697 229 days ago