-
Notifications
You must be signed in to change notification settings - Fork 0
/
Create a reminder on a task.js
36 lines (33 loc) · 1.36 KB
/
Create a reminder on a task.js
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
const myHeaders = new Headers();
const userName = "email address or API KEY here";
const password = "password";
const siteName = "yourSiteName"
const taskId = "taskIdHere"
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Basic "+btoa(userName+":"+password));
const raw = JSON.stringify({
"reminder": {
"note": "Gentle reminder to review this task",
"type": "EMAIL",//SMS,PUSH
"date-time-utc": "2025-09-09T20:00:00Z",//Date format: YYYY-MM-DDTHH:MM:SSZ
"user-id": [
"userId1",
"userId2"
],//Add the user ids for the users who should be added to the reminder (comma separated)
"isRelative": false,//Set to true to follow task due date
"relative-number-days": "-3",//Positive number refers to days before task due date ie: 3 = 3 days before. Negative number refers to days after task due date ie: -2 = 2 days after task due date. O = On due date
"peopleAssigned": true,//true when reminder is set to all task assignees
"assignToMultiple": false,
"usingOffSetDueDate": false
}
});
const requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow"
};
fetch("https://"+siteName+".teamwork.com/tasks/"+taskId+"/reminders.json", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));