Update a thread
/v1/email/threads/{thread_id}const thread = await bird.email.threads.update("thr_01abc", {
labels: { add: ["archive"] },
});
console.log(thread.id);thread = client.email.threads.update(
"thr_01krdgeqcxet5s7t44vh8rt9mg", labels={"add": ["archive"]}
)
print(thread.id)thread, err := client.Email.Threads.Update(context.Background(), "thr_123", bird.EmailThreadsUpdateParams{
Labels: &bird.EmailLabelsUpdate{Add: &[]string{"urgent"}},
})
if err != nil {
log.Fatal(err)
}
fmt.Println(thread.Id)$bird->email->threads->update(
'thr_01krdgeqcxet5s7t44vh8rt9mg',
(new EmailThreadUpdateRequest())
->setLabels((new EmailLabelsUpdate())->setAdd(['escalated']))
->setContactId('con_01krdgeqcxet5s7t44vh8rt9mg'),
);bird email threads update <thread-id> --body-file - <<'JSON'
{
"labels": {
"add": [
"urgent"
],
"remove": [
"pending"
]
},
"contact_id": "con_01krdgeqcxet5s7t44vh8rt9mg"
}
JSONcurl -X PATCH "https://us1.platform.bird.com/v1/email/threads/{thread_id}" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"labels": {
"add": [
"urgent"
],
"remove": [
"pending"
]
},
"contact_id": "con_01krdgeqcxet5s7t44vh8rt9mg"
}'{
"id": "thr_01krdgeqcxet5s7t44vh8rt9mg",
"mailbox_id": "mbx_01krdgeqcxet5s7t44vh8rt9mg",
"channel": "email",
"contact_id": "con_01krdgeqcxet5s7t44vh8rt9mg",
"subject": "Re: Your order",
"last_direction": "inbound",
"labels": [
"inbox",
"urgent"
],
"highlights": {
"subject": [
"Re: your **order** **4821**"
],
"text": [
"confirming your **order** **4821** shipped"
]
}
}
Applies label changes to a conversation, and links or unlinks a contact. Adding spam files the conversation, and its received messages, as spam. Adding archive files it away without deleting it. Adding inbox, or removing spam, blocked, or archive, returns it to the inbox, and its unread count recomputes to match. An archived conversation returns to the inbox by itself when a new message arrives that isn't spam or blocked; a junk reply or an outbound send leaves it archived. To block a sender going forward, add a receive rule instead. Any field you leave out stays unchanged.
Parameters
thread_idstringThread identifier. Starts with thr_.
Request Payload
labelsLabel changes to apply. Labels in add are applied and labels in remove are taken off; other labels are left untouched. Adding a label that is already present, or removing one that is not, has no effect. System labels express state changes. On a conversation, adding spam files it as spam. Adding archive files it away without deleting it. Adding inbox, or removing spam, blocked, or archive, returns it to the inbox. Removing unread marks all retained received messages as read in one call. On a message, adding or removing unread flips read state. Adding or removing trash moves it to or out of the trash. The API rejects changes that contradict this model. A request cannot add more than one placement label. It cannot add blocked, because blocking a sender is a receive-rule decision. Removing inbox requires adding a destination. A conversation cannot add trash or unread; removing unread is the mark-all-read shortcut, and trash uses the DELETE verb. A message cannot use placement labels; move its conversation instead. A sent message cannot use unread. Custom labels are 1-64 characters with no commas, control characters, or leading or trailing whitespace. System label names and a small reserved set (all, archived, deleted, draft, drafts, flagged, important, junk, muted, none, outbox, pinned, read, scheduled, snoozed, starred) cannot be used as custom labels, in any casing. A conversation or message has at most 20 labels, system labels included.
Show child parameters
labels.addLabels to apply.
labels.removeLabels to take off.
contact_idContact to link this conversation to, or null to unlink the current contact.
Response Payload
idThread ID.
mailbox_idMailbox this conversation belongs to.
channelChannel this conversation lives on. Always email.
contact_idContact linked to this conversation, or null when none is linked.
subjectSubject of the conversation, taken from its first message. Null when that message had no subject.
participantsAddresses that appear on the retained messages in this conversation, including the mailbox's own address.
message_countNumber of retained messages in this conversation, both directions.
unread_countNumber of retained received messages that are still unread. Spam and blocked mail is not counted.
last_message_atWhen the most recent retained message in this conversation was received or sent.
last_directionDirection of the most recent message: inbound for a received message, outbound for a sent one.
Possible values: inbound, outbound
labelsLabels on this conversation. Exactly one system placement label is always present, set by the message that started the conversation:
inbox: The conversation is in the inbox.archive: The conversation was filed away and is done for now.spam: The conversation's opening message is filed in Spam.blocked: The conversation's opening message was rejected by the mailbox's receive policy or rules.
Move a conversation by updating its labels. Add spam to file it as spam, add archive to clean it out of the inbox, and add inbox, or remove spam, blocked, or archive, to bring it back. An archived conversation returns to the inbox by itself when a new message arrives. Custom labels share the same list, and a conversation has at most 20 labels in total.
created_atWhen the thread was created.
updated_atWhen the thread last changed.
highlightsMatched search fragments, keyed by the field that matched. Returned only by thread search. Omitted when listing threads.
Show child attributes
highlights.subjectMatched fragments from the conversation's subject.
highlights.textMatched fragments from a message's body text.
Related resources
Continue with the documentation, guides and examples for this topic.