type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* Delete Support Address
* Deletes a support address.
#### Allowed For
* Admins
* Agents with permission to manage channels and extensions. See the system permissions in [Creating custom roles and assigning agents (Enterprise)](https://support.zendesk.com/hc/en-us/articles/203662026-Creating-custom-roles-and-assigning-agents-Enterprise-#topic_cxn_hig_bd) in the Support Help Center
*/
export async function main(auth: Zendesk, support_address_id: string) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/recipient_addresses/${support_address_id}`
);
const response = await fetch(url, {
method: "DELETE",
headers: {
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 377 days ago
type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* Delete Support Address
* Deletes a support address.
#### Allowed For
* Admins
* Agents with permission to manage channels and extensions. See the system permissions in [Creating custom roles and assigning agents (Enterprise)](https://support.zendesk.com/hc/en-us/articles/203662026-Creating-custom-roles-and-assigning-agents-Enterprise-#topic_cxn_hig_bd) in the Support Help Center
*/
export async function main(auth: Zendesk, support_address_id: string) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/recipient_addresses/${support_address_id}`
);
const response = await fetch(url, {
method: "DELETE",
headers: {
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 923 days ago