//native
type Kustomer = {
apiKey: string;
};
/**
* Upsert spam sender
* Assigns a spam list status for a new sender, or updates the spam list status for an existing sender.
You can assign senders to a `list` status: `whitelist` (never considered spam) or `blacklist` (always considered spam).
Any one of the following roles is required for this endpoint:
|Legacy Role|Equivalent Permission Set Role|
|-----|--------|
|org.admin.spam.write|org.permission.spam.update|
*/
export async function main(auth: Kustomer) {
const url = new URL(`https://api.kustomerapp.com/v1/spam/senders`);
const response = await fetch(url, {
method: "PUT",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.apiKey,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago