0

Create notes

by
Published Oct 17, 2025
Script zoho Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Zoho = {
3
  token: string;
4
};
5
/**
6
 * Create notes
7
 *
8
 */
9
export async function main(
10
  auth: Zoho,
11
  body: {
12
    data: {
13
      Modified_Time: string;
14
      $attachments: {
15
        Owner: { name: string; id: string; email?: string };
16
        Modified_By: { name: string; id: string; email?: string };
17
        Created_By: { name: string; id: string; email?: string };
18
        Parent_Id: { id: string; name: string };
19
        $sharing_permission?: string;
20
        $attachment_type?: number;
21
        id: string;
22
        Modified_Time: string;
23
        Created_Time: string;
24
        File_Name: string;
25
        Size: string;
26
        $editable: false | true;
27
        $file_id: string;
28
        $type: string;
29
        $se_module: string;
30
        $state: string;
31
        $link_url: string;
32
      }[];
33
      Owner: { name: string; id: string; email?: string };
34
      Created_Time: string;
35
      Parent_Id: {
36
        module?: {
37
          api_name: string;
38
          id: string;
39
          module_name?: string;
40
          module?: string;
41
        };
42
        id?: string;
43
        name?: string;
44
      };
45
      $editable: false | true;
46
      $is_shared_to_client: false | true;
47
      $sharing_permission?: string;
48
      Modified_By: { name: string; id: string; email?: string };
49
      $size: string;
50
      $state: string;
51
      $voice_note: false | true;
52
      id: string;
53
      Created_By: { name: string; id: string; email?: string };
54
      Note_Title: string;
55
      Note_Content: string;
56
    }[];
57
  },
58
) {
59
  const url = new URL(`https://zohoapis.com/crm/v8/Notes`);
60

61
  const response = await fetch(url, {
62
    method: "POST",
63
    headers: {
64
      "Content-Type": "application/json",
65
      Authorization: "Zoho-oauthtoken " + auth.token,
66
    },
67
    body: JSON.stringify(body),
68
  });
69
  if (!response.ok) {
70
    const text = await response.text();
71
    throw new Error(`${response.status} ${text}`);
72
  }
73
  return await response.json();
74
}
75