0

Get Meeting Link Booking Info

by
Published today

Retrieve the details needed to book on a scheduling page (durations, form fields, availability), by its slug.

Script hubspot Verified

The script

Submitted by hugo989 Typescript (fetch-only)
Verified 4 hours ago
1
//native
2

3
/**
4
 * Get Meeting Link Booking Info
5
 * Retrieve the details needed to book on a scheduling page (durations, form fields, availability), by its slug. `timezone` is an IANA name such as Europe/Paris. Requires scheduler.meetings.meeting-link.read.
6
 */
7
export async function main(
8
  auth: RT.Hubspot,
9
  slug: string,
10
  timezone: string,
11
  month_offset: number | undefined
12
) {
13
  const url = new URL(
14
    `https://api.hubapi.com/scheduler/v3/meetings/meeting-links/book/${slug}`
15
  )
16
  url.searchParams.append("timezone", timezone)
17
  if (month_offset != null)
18
    url.searchParams.append("monthOffset", String(month_offset))
19

20
  const response = await fetch(url, {
21
    headers: {
22
      Authorization: `Bearer ${auth.token}`,
23
      Accept: "application/json",
24
    },
25
  })
26

27
  if (!response.ok) {
28
    throw new Error(`${response.status} ${await response.text()}`)
29
  }
30

31
  return await response.json()
32
}
33