Set seen status

Set a thread's seen/read status for the current user


Overview #

Mark entire threads as seen or unseen for the current user. This does not affect whether the user is subscribed to the thread or not.
Vanilla JavaScript:
// To mark a thread as unseen
await window.CordSDK.thread.setSeen('my-awesome-thread-id', false);

// To mark a thread as seen
await window.CordSDK.thread.setSeen('my-awesome-thread-id', true);
// To mark a thread as unseen
await window.CordSDK.thread.setSeen('my-awesome-thread-id', false);

// To mark a thread as seen
await window.CordSDK.thread.setSeen('my-awesome-thread-id', true);
Copy

Vanilla JavaScript:
// To mark threads as unseen
await window.CordSDK.thread.setSeen({ metadata: {archived: true} }, false);

// To mark threads as seen
await window.CordSDK.thread.setSeen({ metadata: {archived: true} }, true);
// To mark threads as unseen
await window.CordSDK.thread.setSeen({ metadata: {archived: true} }, false);

// To mark threads as seen
await window.CordSDK.thread.setSeen({ metadata: {archived: true} }, true);
Copy

What this function returns #

A promise that resolves to true if the operation succeeded or rejects if it failed.

Arguments this function takes #

This function can be called in two ways:

Marking a single thread #


threadID #

required
string
The ID of the thread to operate on.

seen #

required
boolean
Whether the thread should now be seen (true) or unseen (false).

Marking multiple threads #


filter #

required
ClientThreadFilter
The set of threads to operate on.

This is an object with the following fields:


location #

optional
The Location of the threads. This can either be just the location value or an object with a value for both the location and partialMatch properties.
The value for partialMatch will default to false if only location is provided.

This property can be one of the following:

  • Location
  • LocationFilterOptions

    This is an object with the following fields:


    value
    Location
    The Location of the threads.

    partialMatch
    boolean
    If true, perform partial matching on the specified location. If false, fetch information for only exactly the location specified.

resolvedStatus #

optional
"any" | "resolved" | "unresolved"
If set to resolved, only resolved threads will be returned. If set to unresolved, only unresolved threads will be returned. If set to any, both resolved and unresolved threads will be returned.
If unset, defaults to any.

metadata #

optional
EntityMetadata
The value for a metadata entry should be an object representing the metadata key/value to filter on. For example, to show only threads with the metadata key of "category" set to "sales", set the filter to { metadata: { category: "sales" } }.

groupID #

optional
string
Filter to threads belonging to a specified group.

viewer #

optional
The status of the viewer in this thread. If multiple statuses are supplied, a thread will match the filter if the viewer has any of those statuses.

This property can be one of the following:

  • "subscribed"
  • "mentioned"
  • "subscribed" | "mentioned"[]

seen #

required
boolean
Whether the threads should now be seen (true) or unseen (false).

Ask Cordy