Skip to content
// EFFECT DAYS 2026

ChatThread unstable

Addresses for chat threads.

A ChatThread names a channel, a thread or a direct conversation on one platform. The address itself does not say which of the three it is: ChatEvent.MessageCreated.kind and Chat.getThread do. The id is opaque to the core and owned by the platform's adapter.

7 exports Since v4.1.5 Source

Comparisons

equals

unstable
Since v4.1.5

Returns whether two thread addresses name the same platform and id.

Signature

declare function equals(self: {
readonly id: string;
readonly platform: string;
}, that: {
readonly id: string;
readonly platform: string;
}): boolean

Constructors

make

unstable
Since v4.1.5

Creates a thread address from a platform name and the adapter's id.

Signature

declare function make(platform: string, id: string): {
readonly id: string;
readonly platform: string;
}

Converting

fromString

unstable
Since v4.1.5

Parses a {platform}:{id} string into a thread address.

Details

The platform is everything before the first :, so an id may contain :. Both parts must be non-empty, otherwise the result is None.

See

Signature

declare function fromString(value: string): Option<{
readonly id: string;
readonly platform: string;
}>

toString

unstable
Since v4.1.5

Formats a thread address as {platform}:{id}.

When to use

Use to build session keys, entity ids and URLs from an address.

Gotchas

The format is frozen once released, because consumers persist it.

See

Signature

declare function toString(thread: {
readonly id: string;
readonly platform: string;
}): string

Models

ChatThread

type unstable
Since v4.1.5

The address messages go to: a channel, a thread or a direct conversation on one platform.

Signature

type ChatThread = typeof ChatThread.Type

Schemas

ChatThread

unstable
Since v4.1.5

Schema for the address messages go to: a channel, a thread or a direct conversation on one platform.

Details

id is opaque to the core and owned by the adapter. Slack's is {team}/{channel} or {team}/{channel}/{thread_ts}, Discord's is the channel snowflake.

Signature

declare const ChatThread: Struct<{
readonly id: String;
readonly platform: String;
}>

FromString

unstable
Since v4.1.5

Schema that decodes a {platform}:{id} string into a ChatThread and encodes it back.

Gotchas

The string format is frozen once released, because consumers persist it.

Signature

declare const FromString: Schema.Codec<ChatThread, string>