//native
type Zoho = {
token: string;
};
/**
* Create notes
*
*/
export async function main(
auth: Zoho,
body: {
data: {
Modified_Time: string;
$attachments: {
Owner: { name: string; id: string; email?: string };
Modified_By: { name: string; id: string; email?: string };
Created_By: { name: string; id: string; email?: string };
Parent_Id: { id: string; name: string };
$sharing_permission?: string;
$attachment_type?: number;
id: string;
Modified_Time: string;
Created_Time: string;
File_Name: string;
Size: string;
$editable: false | true;
$file_id: string;
$type: string;
$se_module: string;
$state: string;
$link_url: string;
}[];
Owner: { name: string; id: string; email?: string };
Created_Time: string;
Parent_Id: {
module?: {
api_name: string;
id: string;
module_name?: string;
module?: string;
};
id?: string;
name?: string;
};
$editable: false | true;
$is_shared_to_client: false | true;
$sharing_permission?: string;
Modified_By: { name: string; id: string; email?: string };
$size: string;
$state: string;
$voice_note: false | true;
id: string;
Created_By: { name: string; id: string; email?: string };
Note_Title: string;
Note_Content: string;
}[];
},
) {
const url = new URL(`https://zohoapis.com/crm/v8/Notes`);
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