-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Expand file tree
/
Copy pathcreate-task.mjs
More file actions
100 lines (99 loc) · 2.82 KB
/
Copy pathcreate-task.mjs
File metadata and controls
100 lines (99 loc) · 2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import pipedriveApp from "../../pipedrive.app.mjs";
export default {
key: "pipedrive-create-task",
name: "Create Task",
description: "Creates a new task under a project (BETA). Run **List Projects** first to obtain a valid project ID. Use **List User ID Options** for the assignee ID. [See the documentation](https://developers.pipedrive.com/docs/api/v1/Tasks#addTask)",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: false,
},
props: {
pipedriveApp,
title: {
type: "string",
label: "Title",
description: "The title of the task.",
},
projectId: {
type: "string",
label: "Project ID",
description: "The ID of the project this task belongs to. Run **List Projects** first to obtain a valid project ID.",
},
parentTaskId: {
type: "string",
label: "Parent Task ID",
description: "The ID of the parent task, if this is a subtask. Use **List Tasks** to obtain a valid task ID.",
optional: true,
},
description: {
type: "string",
label: "Description",
description: "The description of the task.",
optional: true,
},
done: {
type: "integer",
label: "Done",
description: "Whether the task is done. Integer: 0 (not done) or 1 (done).",
min: 0,
max: 1,
optional: true,
},
milestone: {
type: "integer",
label: "Milestone",
description: "Whether the task is a milestone. Integer: 0 (no) or 1 (yes).",
min: 0,
max: 1,
optional: true,
},
dueDate: {
type: "string",
label: "Due Date",
description: "The due date of the task. Format: YYYY-MM-DD (e.g. 2026-07-31).",
optional: true,
},
startDate: {
type: "string",
label: "Start Date",
description: "The start date of the task. Format: YYYY-MM-DD.",
optional: true,
},
assigneeId: {
propDefinition: [
pipedriveApp,
"userId",
],
label: "Assignee ID",
description: "The user ID of the task assignee.",
optional: true,
},
priority: {
type: "integer",
label: "Priority",
description: "The priority of the task (non-negative integer).",
min: 0,
optional: true,
},
},
async run({ $ }) {
const response = await this.pipedriveApp.addTask({
$,
title: this.title,
project_id: this.projectId,
parent_task_id: this.parentTaskId,
description: this.description,
done: this.done,
milestone: this.milestone,
due_date: this.dueDate,
start_date: this.startDate,
assignee_id: this.assigneeId,
priority: this.priority,
});
$.export("$summary", `Successfully created task ${response.data?.id}: ${this.title}`);
return response;
},
};