0

List Meeting Links

by
Published 20 days ago

List the scheduling pages (meeting links) of the account, optionally for one organizer.

Script hubspot Verified

The script

Submitted by hugo989 Typescript (fetch-only)
Verified 21 days ago
1
//native
2

3
/**
4
 * List Meeting Links
5
 * List the scheduling pages (meeting links) of the account, optionally for one organizer. Requires scheduler.meetings.meeting-link.read.
6
 */
7
export async function main(
8
  auth: RT.Hubspot,
9
  organizer_user_id: string | undefined,
10
  name: string | undefined,
11
  type: "PERSONAL_LINK" | "GROUP_CALENDAR" | "ROUND_ROBIN_CALENDAR" | undefined,
12
  limit: number | undefined,
13
  after: string | undefined
14
) {
15
  const url = new URL(
16
    `https://api.hubapi.com/scheduler/v3/meetings/meeting-links`
17
  )
18
  if (organizer_user_id != null && organizer_user_id !== "")
19
    url.searchParams.append("organizerUserId", organizer_user_id)
20
  if (name != null && name !== "") url.searchParams.append("name", name)
21
  if (type != null && type !== "") url.searchParams.append("type", type)
22
  if (limit != null) url.searchParams.append("limit", String(limit))
23
  if (after != null && after !== "") url.searchParams.append("after", after)
24

25
  const response = await fetch(url, {
26
    headers: {
27
      Authorization: `Bearer ${auth.token}`,
28
      Accept: "application/json",
29
    },
30
  })
31

32
  if (!response.ok) {
33
    throw new Error(`${response.status} ${await response.text()}`)
34
  }
35

36
  return await response.json()
37
}
38