Delete Campaign ( mailchimp)
One script reply has been approved by the moderators Verified

Created by stephanexpsychodollxx 293 days ago Viewed 53 times 0 Points

No comments yet

Login to be able to comment
Points: 0
deno
One script reply has been approved by the moderators
Ap­pro­ved
import { Resource } from 'https://deno.land/x/windmill@v1.70.1/mod.ts'

export async function main(
  auth: Resource<'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 adam186 119 days ago

Edited 27 days ago

No comments yet

Login to be able to comment