//native
type Zoho = {
token: string;
};
/**
* Create users
*
*/
export async function main(
auth: Zoho,
body: {
users: {
country?: string;
language?: string;
microsoft?: false | true;
$shift_effective_from?: {};
id?: string;
state?: string;
fax?: string;
country_locale?: string;
zip?: string;
created_time?: string;
time_format?: "HH:mm" | "hh:mm a";
offset?: number;
imap_status?: false | true;
image_link?: string;
ezuid?: string;
profile?: { name: string; id: string };
role?: { name: string; id: string };
created_by?: { name: string; id: string; email?: string };
full_name?: string;
zuid?: string;
phone?: string;
dob?: string;
status?: string;
customize_info?: {
notes_desc: {};
show_right_panel: {};
bc_view: {};
unpin_recent_item: {};
show_home: false | true;
show_detail_view: false | true;
};
city?: string;
signature?: string;
sort_order_preference__s?: string;
category?: string;
date_format?: "MMM d, yyyy";
confirm?: false | true;
decimal_separator?: "Comma" | "Period";
number_separator?: "Space";
time_zone?: {};
last_name?: string;
mobile?: string;
$current_shift?: { name: string; id: string };
Reporting_To?: { name: string; id: string; email?: string };
Currency?: string;
$next_shift?: { name: string; id: string };
Modified_Time?: string;
website?: string;
status_reason__s?: string;
email?: string;
first_name?: string;
sandboxDeveloper?: false | true;
alias?: string;
street?: string;
Modified_By?: {
name: string;
id: string;
last_name: string;
first_name: string;
};
Isonline?: false | true;
locale?: string;
name_format__s?:
| "Salutation,First Name,Last Name"
| "Saluation,Last Name,First Name"
| "First Name,Last Name,Saluation";
personal_account?: false | true;
default_tab_group?: string;
theme?: {
normal_tab: { font_color: "#FFFFFF"; background: "#222222" };
selected_tab: { font_color: "#FFFFFF"; background: "#222222" };
new_background: string;
background: "#F3F0EB";
screen: "fixed";
type: string;
};
ntc_notification_type?: number[];
ntc_enabled?: false | true;
rtl_enabled?: false | true;
telephony_enabled?: false | true;
sort_order_preference?: string;
}[];
},
) {
const url = new URL(`https://zohoapis.com/crm/v8/users`);
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