//native
/**
* Get Sequence Enrollment
* Retrieve the sequence a contact is currently enrolled in, if any. Requires automation.sequences.read (Sales or Service Hub Professional or Enterprise).
*/
export async function main(auth: RT.Hubspot, contact_id: string) {
const url = new URL(
`https://api.hubapi.com/automation/v4/sequences/enrollments/contact/${contact_id}`
)
const response = await fetch(url, {
headers: {
Authorization: `Bearer ${auth.token}`,
Accept: "application/json",
},
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 5 hours ago