0

Delete a spam sender

by
Published Oct 17, 2025

Deletes a spam sender based on the unique sender ID. Any one of the following roles is required for this endpoint: |Legacy Role|Equivalent Permission Set Role| |-----|--------| |org.admin.spam.write|org.permission.spam.delete|

Script kustomer Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Kustomer = {
3
  apiKey: string;
4
};
5
/**
6
 * Delete a spam sender
7
 * Deletes a spam sender based on the unique sender ID.
8
Any one of the following roles is required for this endpoint:
9

10
|Legacy Role|Equivalent Permission Set Role|
11
|-----|--------|
12
|org.admin.spam.write|org.permission.spam.delete|
13
 */
14
export async function main(auth: Kustomer, id: string) {
15
  const url = new URL(`https://api.kustomerapp.com/v1/spam/senders/${id}`);
16

17
  const response = await fetch(url, {
18
    method: "DELETE",
19
    headers: {
20
      Authorization: "Bearer " + auth.apiKey,
21
    },
22
    body: undefined,
23
  });
24
  if (!response.ok) {
25
    const text = await response.text();
26
    throw new Error(`${response.status} ${text}`);
27
  }
28
  return await response.text();
29
}
30