0

Complete Task

by
Published today

Marks a task as complete.

Script outreach Verified

The script

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

3
/**
4
 * Complete Task
5
 * Marks a task as complete.
6
 */
7
export async function main(auth: RT.Outreach, task_id: number) {
8
  const response = await fetch(
9
    `https://api.outreach.io/api/v2/tasks/${task_id}/actions/markComplete`,
10
    {
11
      method: "POST",
12
      headers: {
13
        Authorization: `Bearer ${auth.token}`,
14
        Accept: "application/vnd.api+json",
15
      },
16
    }
17
  )
18

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

23
  return await response.json()
24
}
25