Create a new thread

Create a thread without messages


Overview #

Create a new empty thread i.e. a thread without messages. Please note that because the new thread won't have any messages, it will not be displayed on any of the thread-related components like ThreadedComments, ThreadList or Thread. If you would like to create a thread containing a message instead, please use the SendMessage API and pass in thread data via the createThread argument.
Vanilla JavaScript:
await window.CordSDK.thread.createThread({
  id: 'my-awesome-thread-id',
  name: 'A more awesome name',
  location: {'page': 'sales'},
  url: "https://my-awesome-url.com",
});
await window.CordSDK.thread.createThread({
  id: 'my-awesome-thread-id',
  name: 'A more awesome name',
  location: {'page': 'sales'},
  url: "https://my-awesome-url.com",
});
Copy

What this function returns #

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

Arguments this function takes #


data #

required
ClientCreateThread
The data values the new thread should have.

This is an object with the following fields:


addSubscribers #

optional
string[]
A list of subscribers to add to this thread.

name #

required
string
The name of the thread. This is shown to users when the thread is referenced, such as in notifications. This should generally be something like the page title.

url #

required
string
A URL where the thread can be seen. This determines where a user is sent when they click on a reference to this thread, such as in a notification, or if they click on a reference to a message in the thread and the message doesn't have its own URL.

location #

required
Location
The location of this thread.

id #

optional
string
The ID for this thread.

metadata #

optional
EntityMetadata
Arbitrary key-value pairs that can be used to store additional information.

groupID #

optional
string
The group ID this thread is in.

extraClassnames #

optional
string | null
An optional space separated list of classnames to add to the thread.

Ask Cordy