0

Create Project Comment

by
Published Jun 6, 2022

Adds a comment to a project. [See the docs here](https://developer.todoist.com/rest/v2/#create-a-new-comment)

Script todoist Verified

The script

Submitted by hugo697 Bun
Verified 398 days ago
1
import { TodoistApi } from '@doist/todoist-api-typescript'
2
import { v9 as Todoist } from 'todoist'
3

4
type Todoist = {
5
	Token: string
6
}
7

8
export async function main(
9
	resource: Todoist,
10
	comment: {
11
		args: {
12
			content: string
13
			attachment?: {
14
				fileName?: string
15
				fileUrl: string
16
				fileType?: string
17
				resourceType?: string
18
			}
19
			taskId?: string
20
			projectId?: string
21
		}
22
		requestId?: string
23
	}
24
) {
25
	const api = new TodoistApi(resource.Token)
26
	// @ts-ignore
27
	const commentResponse = await api.addComment(comment.args, comment.requestId)
28
	return commentResponse
29
}
30