//native
type Zoho = {
token: string;
};
/**
* Unblock emails
*
*/
export async function main(
auth: Zoho,
_module: string,
body: { ids: string[]; unblock_fields: string[] },
) {
const url = new URL(
`https://zohoapis.com/crm/v8/${_module}/actions/unblock_email`,
);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Zoho-oauthtoken " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago