//native
type Mailchimp = {
api_key: string;
server: string;
};
export async function main(auth: Mailchimp, campaign_id: string) {
const url = `https://${auth.server}.api.mailchimp.com/3.0/campaigns/${campaign_id}`;
const response = await fetch(url, {
method: "DELETE",
headers: {
Authorization: `Bearer ${auth.api_key}`,
},
});
if (!response.ok) {
throw Error(await response.text());
}
return `Successfully deleted campaign with ID '${campaign_id}'`;
}
Submitted by hugo989 3 days ago