//native
type Zoho = {
token: string;
};
/**
* Bulk invite users
*
*/
export async function main(
auth: Zoho,
_module: string,
body: {
portal_invite?: {
data?: {
id?: string;
user_type_id?: string;
type?: "reinvite" | "invite";
language?:
| "it_IT"
| "ru_RU"
| "pl_PL"
| "tr_TR"
| "hi_IN"
| "pt_BR"
| "th_TH"
| "fr_FR"
| "ja_JP"
| "in_ID"
| "cs_CZ"
| "de_DE"
| "hu_HU"
| "zh_TW"
| "es_ES"
| "nl_NL"
| "sv_SE"
| "da_DK"
| "bg_BG"
| "vi_VN"
| "iw_IL"
| "hr_HR"
| "en_GB"
| "ko_KR"
| "en_US"
| "zh_CN"
| "ar_EG"
| "pt_PT";
}[];
}[];
},
) {
const url = new URL(
`https://zohoapis.com/crm/v8/${_module}/actions/portal_invite`,
);
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