Threads can be in one of 3 statuses:
When you log into Plain you can filter threads by these statuses.
When threads are created they default to Todo
.
To change a threads status you need an API key with the following permissions:
Mark thread as Done
When any activity happens in a thread, it will move back to Todo
.
Unlike traditional ticketing software, we expect a ticket to move between Todo
and Done
a number of times in the course of helping a customer. This will not break or influence any metrics. Done
in Plain means “I’m done for now, there is nothing left for me to do”.
import { PlainClient } from '@team-plain/typescript-sdk';
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });
const res = await client.markThreadAsDone({
threadId: 'th_01HB924RWAW8H3Q8KZDFWYBJHZ',
});
if (res.error) {
console.error(res.error);
} else {
// The full thread is returned as res.data
console.log(`Thread marked as done (${res.data.id})`);
}
import { PlainClient } from '@team-plain/typescript-sdk';
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });
const res = await client.markThreadAsDone({
threadId: 'th_01HB924RWAW8H3Q8KZDFWYBJHZ',
});
if (res.error) {
console.error(res.error);
} else {
// The full thread is returned as res.data
console.log(`Thread marked as done (${res.data.id})`);
}
mutation markThreadAsDone($input: MarkThreadAsDoneInput!) {
markThreadAsDone(input: $input) {
thread {
id
externalId
customer {
id
}
status
statusChangedAt {
iso8601
unixTimestamp
}
title
previewText
priority
}
error {
message
type
code
fields {
field
message
type
}
}
}
}
{
"input": {
"threadId": "th_01H8H46YPB2S4MAJM382FG9423"
}
}
Snooze thread
You can snooze threads for a duration of time defined in seconds.
When any activity happens in a thread, it will be automatically unsnoozed and move to Todo
. Otherwise threads will be unsnoozed when the timer runs out.
import { PlainClient } from '@team-plain/typescript-sdk';
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });
const res = await client.snoozeThread({
threadId: 'th_01HB924RWAW8H3Q8KZDFWYBJHZ',
durationSeconds: 5 * 24 * 60 * 60, // 5 days
});
if (res.error) {
console.error(res.error);
} else {
// The full thread is returned as res.data
console.log(`Thread snoozed (${res.data.id}`);
}
import { PlainClient } from '@team-plain/typescript-sdk';
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });
const res = await client.snoozeThread({
threadId: 'th_01HB924RWAW8H3Q8KZDFWYBJHZ',
durationSeconds: 5 * 24 * 60 * 60, // 5 days
});
if (res.error) {
console.error(res.error);
} else {
// The full thread is returned as res.data
console.log(`Thread snoozed (${res.data.id}`);
}
mutation snoozeThread($input: SnoozeThreadInput!) {
snoozeThread(input: $input) {
thread {
id
externalId
customer {
id
}
status
statusChangedAt {
iso8601
unixTimestamp
}
title
previewText
priority
}
error {
message
type
code
fields {
field
message
type
}
}
}
}
{
"input": {
"threadId": "th_01H8H46YPB2S4MAJM382FG9423",
"durationSeconds": 432000 // 5 days
}
}
Mark thread as Todo
This is useful if you mistakenly marked a thread as Done
or snoozed a thread and want to unsnooze it. Otherwise just write a message or do what you want to do and the thread will be automatically moved back to do Todo.
import { PlainClient } from '@team-plain/typescript-sdk';
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });
const res = await client.markThreadAsTodo({
threadId: 'th_01HB924RWAW8H3Q8KZDFWYBJHZ',
});
if (res.error) {
console.error(res.error);
} else {
// The full thread is returned as res.data
console.log(`Thread marked as todo (${res.data.id})`);
}
import { PlainClient } from '@team-plain/typescript-sdk';
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });
const res = await client.markThreadAsTodo({
threadId: 'th_01HB924RWAW8H3Q8KZDFWYBJHZ',
});
if (res.error) {
console.error(res.error);
} else {
// The full thread is returned as res.data
console.log(`Thread marked as todo (${res.data.id})`);
}
mutation markThreadAsTodo($input: MarkThreadAsTodoInput!) {
markThreadAsTodo(input: $input) {
thread {
id
externalId
customer {
id
}
status
statusChangedAt {
iso8601
unixTimestamp
}
title
previewText
priority
}
error {
message
type
code
fields {
field
message
type
}
}
}
}
{
"input": {
"threadId": "th_01H8H46YPB2S4MAJM382FG9423"
}
}