0
Delete Mailing List Member
One script reply has been approved by the moderators Verified

Delete a mailing list member by address. See the docs here

Created by aurelieiriden 863 days ago Viewed 3190 times
0
Submitted by hugo697 Typescript (fetch-only)
Verified 163 days ago
1
type Mailgun = {
2
  api_key: string;
3
};
4

5
export async function main(
6
  resource: Mailgun,
7
  data: {
8
    listAddress: string;
9
    memberAddress: string;
10
  }
11
) {
12
  return (
13
    await fetch(
14
      `https://api.mailgun.net/v3/lists/${data.listAddress}/members/${data.memberAddress}`,
15
      {
16
        method: "DELETE",
17
        headers: {
18
          Authorization:
19
            "Basic " +
20
            Buffer.from(`api:${resource.api_key}`).toString("base64"),
21
        },
22
      }
23
    )
24
  ).json();
25
}
26