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

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

Created by jeantioacido 938 days ago Viewed 4150 times
0
Submitted by hugo697 Typescript (fetch-only)
Verified 238 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: "GET",
17
        headers: {
18
          Authorization:
19
            "Basic " +
20
            Buffer.from(`api:${resource.api_key}`).toString("base64"),
21
        },
22
      }
23
    )
24
  ).json();
25
}
26