Creating Plot Twists
    Preparing search index...

    Type Alias NewLinkWithNotes

    NewLinkWithNotes: Omit<NewLink, "channelId"> & {
        channelId: string | null;
        title?: string;
        notes?: Omit<NewNote, "thread">[];
        schedules?: Omit<NewSchedule, "threadId">[];
        scheduleOccurrences?: NewScheduleOccurrence[];
        originatingNote?: {
            key?: string;
            externalContent?: string;
            deliveryError?: DeliveryError | null;
        };
    }

    A new link with notes to save via integrations.saveLink()/saveLinks(). Creates a thread+link pair, with notes attached to the thread.

    channelId is required (pass null if the item genuinely has none): every sync/backfill/webhook builder already knows its channel before constructing the link (it's how it fetched the data), and there is no fallback if it's missing here. The platform persists this field to the link's channelId column and later reads it back — NOT from meta — to populate thread.meta.channelId/link.meta.channelId for connector callbacks like onNoteCreated. Omitting it (or only setting a duplicate inside meta) silently breaks those callbacks with no error anywhere. If you're implementing onCreateLink, return CreateLinkResult instead — that hook's channelId is genuinely optional, since the platform auto-fills it from the compose draft.

    Type Declaration

    • channelId: string | null

      Channel that produced this link. See the type-level doc above.

    • Optionaltitle?: string

      Title for the link and its thread container. Must be the real entity title (e.g. issue title, message subject), never a placeholder or ID. This value overwrites the existing title on upsert. Omit to preserve the existing title (e.g. for cancelled events where the title may not be available in the webhook payload).

    • Optionalnotes?: Omit<NewNote, "thread">[]

      Notes to attach to the thread

    • Optionalschedules?: Omit<NewSchedule, "threadId">[]

      Schedules to create for the link

    • OptionalscheduleOccurrences?: NewScheduleOccurrence[]

      Schedule occurrence overrides

    • OptionaloriginatingNote?: { key?: string; externalContent?: string; deliveryError?: DeliveryError | null }

      For onCreateLink only: binds the thread's opening note (the message the user composed in Plot, which this hook just posted to the external system) to its external counterpart. Mirrors the NoteWriteBackResult a reply returns from onNoteCreatedkey is the external message id and externalContent is the post-write content baseline. Without this the opening note stays keyless, so reactions and edits on it can't be routed back to the external system. Ignored outside onCreateLink.

      • Optionalkey?: string

        External message id; set as the opening note's key.

      • OptionalexternalContent?: string

        Content as the external system stored it post-write, for the sync baseline. Must equal what your sync-in path emits as this note's content on re-ingest (same contract as NoteWriteBackResult.externalContent).

      • OptionaldeliveryError?: DeliveryError | null

        Reports that sending the composed message FAILED (the onCreateLink send could not be delivered). The runtime records it on the opening note — surfacing a "Failed to send" affordance (Retry / Discard) — and marks the thread unread. Same contract as NoteWriteBackResult.deliveryError: object records, null clears, omitted leaves untouched. Return the link anyway (so the user's composed content is preserved in Plot) with this set, rather than returning null, when a compose send fails.