Skip to content
The SAW API is in beta.

Comment on a ticket

POST /tickets/{ticketId}/comments posts a comment, and GET on the same path lists the ticket’s comments, oldest first. Posting needs Board — read & write access.

comment.ts
// Comment on a ticket, then read the ticket's comments back.
//
// node comment.ts <ticketId>
import { createClient } from './saw.ts';
const ticketId = process.argv[2];
if (!ticketId) throw new Error('Usage: node comment.ts <ticketId>');
const saw = createClient();
const comment = await saw.post('/tickets/{ticketId}/comments', {
path: { ticketId },
body: { body: 'Posted by the comment recipe through the SAW API.' },
});
console.log(`Posted comment ${comment.id}.`);
const comments = await saw.get('/tickets/{ticketId}/comments', { path: { ticketId } });
console.log(`The ticket has ${comments.length} comment(s):`);
for (const c of comments) console.log(` ${c.createdAt} ${c.body}`);
if (!comments.some((c) => c.id === comment.id)) throw new Error('The new comment is missing from the list.');
Terminal window
SAW_API_KEY=saw_live_… node --experimental-strip-types comment.ts <ticketId>
  • Replies. parentCommentId replies to a comment, one level deep.
  • Polling. Pass the newest createdAt you have seen as since (ISO 8601). Only comments created strictly after it are returned.
  • Author. A comment posted with an API key is attributed to the key. The key can edit (PATCH) and delete (DELETE …/comments/{commentId}) only its own comments.