0

List Workflows

by
Published today

List the account's workflows (legacy v3 API: contact-based workflows).

Script hubspot Verified

The script

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

3
/**
4
 * List Workflows
5
 * List the account's workflows (legacy v3 API: contact-based workflows). Requires the automation scope and a Professional or Enterprise subscription.
6
 */
7
export async function main(auth: RT.Hubspot) {
8
  const url = new URL(`https://api.hubapi.com/automation/v3/workflows`)
9

10
  const response = await fetch(url, {
11
    headers: {
12
      Authorization: `Bearer ${auth.token}`,
13
      Accept: "application/json",
14
    },
15
  })
16

17
  if (!response.ok) {
18
    throw new Error(`${response.status} ${await response.text()}`)
19
  }
20

21
  return await response.json()
22
}
23