//native
/**
* Delete Workflow
* Delete a workflow (legacy v3 API). This cannot be undone through the API. Requires the automation scope and a Professional or Enterprise subscription.
*/
export async function main(auth: RT.Hubspot, workflow_id: string) {
const url = new URL(
`https://api.hubapi.com/automation/v3/workflows/${workflow_id}`
)
const response = await fetch(url, {
method: "DELETE",
headers: {
Authorization: `Bearer ${auth.token}`,
Accept: "application/json",
},
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
if (response.status === 204) return { success: true }
return await response.json()
}
Submitted by hugo989 4 hours ago