0

Update event

by
Published Oct 17, 2025

Update a specific event. Only the params included in the operation will update the event.

Script holded Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Holded = {
3
  apiKey: string;
4
};
5
/**
6
 * Update event
7
 * Update a specific event.
8

9
Only the params included in the operation will update the event.
10
 */
11
export async function main(
12
  auth: Holded,
13
  eventId: string,
14
  body: {
15
    name?: string;
16
    contactId?: string;
17
    contactName?: string;
18
    kind?: string;
19
    desc?: string;
20
    startDate?: number;
21
    duration?: number;
22
    status?: number;
23
    tags?: string[];
24
    locationDesc?: string;
25
    leadId?: string;
26
    funnelId?: string;
27
    userId?: string;
28
  },
29
) {
30
  const url = new URL(`https://api.holded.com/api/crm/v1/events/${eventId}`);
31

32
  const response = await fetch(url, {
33
    method: "PUT",
34
    headers: {
35
      "Content-Type": "application/json",
36
      key: auth.apiKey,
37
    },
38
    body: JSON.stringify(body),
39
  });
40
  if (!response.ok) {
41
    const text = await response.text();
42
    throw new Error(`${response.status} ${text}`);
43
  }
44
  return await response.json();
45
}
46