//native
type Zoho = {
token: string;
};
/**
* Update call preference
*
*/
export async function main(
auth: Zoho,
body: {
call_preferences?: {
show_from_number: false | true;
show_to_number: false | true;
};
},
) {
const url = new URL(`https://zohoapis.com/crm/v8/settings/call_preferences`);
const response = await fetch(url, {
method: "PUT",
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