// Generated by notion tool-core codegen-script-types --connections. Do not edit. import type { ConnectionActionInvoker } from "./connection-actions.js" /** * Script input for the "Add a reaction to a Slack message" effect (`slack.addReactionToMessage`), * derived from its Tool Core definition's call_function input projection. * * Add a reaction to a Slack message */ export type AddReactionToMessageScriptInput = { /** * The URI of the Slack message */ prefixedMessageUri: string reaction: string } /** * Canonical Tool Core output for the "Add a reaction to a Slack message" effect (`slack.addReactionToMessage`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type AddReactionToMessageScriptOutput = { channelName: string prefixedMessageUri: string reaction: string status: "added" | "already_absent" | "already_present" | "removed" message?: string } /** * Script input for the "Create a new thread in a Slack channel" effect (`slack.createThreadInChannel`), * derived from its Tool Core definition's call_function input projection. * * Create a new thread in a Slack channel */ export type CreateThreadInChannelScriptInput = | { /** * The Slack ID of the channel to send the message in. */ channelId: string /** * The file IDs of any files attached to the message. */ attachedFileIds?: Array /** * Raw Slack user ID that should be the only user able to see the message. Omit for a normal channel message. */ ephemeralUserId?: string /** * Message body in standard Markdown. Never use Notion rich-text XML such as ; write Notion references as Markdown links ([label](https://example.com)). Use Slack mention tokens only when a verified Slack ID is available. */ message: string /** * Whether to unfurl links in Slack. Defaults to true. */ unfurlLinks?: boolean /** * A confirmation token for sending messages with URLs that require user approval. Do NOT provide unless specifically instructed or unless an error provides the token. */ userConfirmationToken?: string } | { /** * The name of the channel without the # symbol. For example, "engineering". */ channelName: string /** * The file IDs of any files attached to the message. */ attachedFileIds?: Array /** * Raw Slack user ID that should be the only user able to see the message. Omit for a normal channel message. */ ephemeralUserId?: string /** * Message body in standard Markdown. Never use Notion rich-text XML such as ; write Notion references as Markdown links ([label](https://example.com)). Use Slack mention tokens only when a verified Slack ID is available. */ message: string /** * Whether to unfurl links in Slack. Defaults to true. */ unfurlLinks?: boolean /** * A confirmation token for sending messages with URLs that require user approval. Do NOT provide unless specifically instructed or unless an error provides the token. */ userConfirmationToken?: string } /** * Canonical Tool Core output for the "Create a new thread in a Slack channel" effect (`slack.createThreadInChannel`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type CreateThreadInChannelScriptOutput = { channelId: string channelUri: string from: | { handle: string id: string type: "user" uri: string } | { type: "bot" } id: string message: string threadId: string timestamp: string uri: string url: string urls: Array channel?: string fileIds?: Array files?: Array } /** * Script input for the "Find a Slack user by email" effect (`slack.findUserByEmail`), * derived from its Tool Core definition's call_function input projection. * * Find a Slack user by email */ export type FindUserByEmailScriptInput = { email: string } /** * Script result of the "Find a Slack user by email" effect (`slack.findUserByEmail`): * the canonical Tool Core output schema with the effect's declared * script-output projection applied, exactly as the runtime encoder * returns it. */ export type FindUserByEmailScriptOutput = | { handle: string id: string uri: string displayName?: string email?: string notionUser?: string realName?: string statusEmoji?: string statusText?: string timeZone?: string title?: string } | undefined /** * Script input for the "Get Slack channel threads" effect (`slack.getThreadsInChannelSince`), * derived from its Tool Core definition's call_function input projection. * * Get all threads in a channel since a given timestamp */ export type GetThreadsInChannelSinceScriptInput = { /** * The name of the channel without the # symbol. For example, "engineering". */ channelName: string /** * ISO 8601 timestamp, for example 2026-01-01T00:00:00Z. */ timestamp: string } /** * Canonical Tool Core output for the "Get Slack channel threads" effect (`slack.getThreadsInChannelSince`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type GetThreadsInChannelSinceScriptOutput = Array< Array<{ channelId: string channelUri: string from: | { handle: string id: string type: "user" uri: string } | { type: "bot" } id: string message: string threadId: string timestamp: string uri: string url: string urls: Array channel?: string fileIds?: Array files?: Array }> > /** * Script input for the "Get a Slack user by ID" effect (`slack.getUser`), * derived from its Tool Core definition's call_function input projection. * * Get a Slack user by ID */ export type GetUserScriptInput = { userId: string } /** * Canonical Tool Core output for the "Get a Slack user by ID" effect (`slack.getUser`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type GetUserScriptOutput = { handle: string id: string uri: string displayName?: string email?: string notionUser?: string realName?: string statusEmoji?: string statusText?: string timeZone?: string title?: string } /** * Script input for the "Get all messages from a user within a time range" effect (`slack.getUserMessages`), * derived from its Tool Core definition's call_function input projection. * * Get all messages from a user within a time range */ export type GetUserMessagesScriptInput = | { /** * Name of the user to search for. Can be display name, handle, or partial match. Either name or email must be provided. */ name: string /** * Email address of the Slack user. Either name or email must be provided. */ email?: string /** * ISO 8601 timestamp for the start of the search range. Defaults to 7 days ago if not specified. */ since?: string } | { /** * Name of the user to search for. Can be display name, handle, or partial match. Either name or email must be provided. */ name?: string /** * Email address of the Slack user. Either name or email must be provided. */ email: string /** * ISO 8601 timestamp for the start of the search range. Defaults to 7 days ago if not specified. */ since?: string } /** * Canonical Tool Core output for the "Get all messages from a user within a time range" effect (`slack.getUserMessages`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type GetUserMessagesScriptOutput = { messages: Array<{ channelId: string id: string text: string timestamp: string channel?: string contextMessages?: { after?: Array<{ text: string timestamp: string userId: string }> before?: Array<{ text: string timestamp: string userId: string }> } url?: string }> totalCount: number user: { handle: string id: string uri: string displayName?: string email?: string notionUser?: string realName?: string statusEmoji?: string statusText?: string timeZone?: string title?: string } alternativeUsers?: Array<{ displayName?: string email?: string handle?: string }> } /** * Script input for the "Load Slack message" effect (`slack.loadMessage`), * derived from its Tool Core definition's call_function input projection. * * Load a Slack message by ID. */ export type LoadMessageScriptInput = | { /** * Slack channel ID for the message. */ channelId: string /** * Slack message timestamp (ts). */ messageTs: string /** * Slack thread timestamp (ts) if threaded. */ threadTs?: string /** * Slack workspace host parsed from the user's URL */ workspaceHost?: string } | { /** * A Slack message identifier. Accepts a slackMessage:// URI as returned by other Slack tools (e.g. slackMessage://workspace.slack.com/C0123ABCDEF/12345/9876543210.987654), a https Slack archive URL, or a connector href from search results (slack://?base_url=...&channel_id=...&message_id=...). */ url: string } /** * Canonical Tool Core output for the "Load Slack message" effect (`slack.loadMessage`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type LoadMessageScriptOutput = { type: "slack" channel: string messages: Array<{ user: { name: string notionUserName?: string notionUserId?: string } text: string date?: string ts?: string attachments?: Array files?: Array }> timestamp: number additionalMessageToModel?: string } /** * Script input for the "Parse a Slack URI or URL" effect (`slack.parseSlackUriOrUrl`), * derived from its Tool Core definition's call_function input projection. * * Parse a Slack message URI or URL to a parsed agent entity */ export type ParseSlackUriOrUrlScriptInput = { /** * A Slack message URI or URL. */ uriOrUrl: string } /** * Canonical Tool Core output for the "Parse a Slack URI or URL" effect (`slack.parseSlackUriOrUrl`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type ParseSlackUriOrUrlScriptOutput = | { channelId: string messageTs: string threadTs: string type: "slackMessage" workspaceHost: string } | { channelId: string type: "slackChannel" workspaceHost: string } | { type: "slackUser" userId: string workspaceHost: string handle?: string } /** * Script input for the "Query Slack channels" effect (`slack.queryChannels`), * derived from its Tool Core definition's call_function input projection. * * Query Slack channels by criteria */ export type QueryChannelsScriptInput = { id?: string name?: string /** * Filter channels created after this date. ISO format with timezone (e.g. 2024-01-01T00:00:00-05:00 for Eastern Time) */ createdStart?: string /** * Filter channels created before this date. ISO format with timezone (e.g. 2024-01-01T00:00:00-05:00 for Eastern Time) */ createdEnd?: string isGeneral?: boolean isIm?: boolean isPrivate?: boolean isMpim?: boolean isShared?: boolean isOrgShared?: boolean botIsMember?: boolean isArchived?: boolean } /** * Canonical Tool Core output for the "Query Slack channels" effect (`slack.queryChannels`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type QueryChannelsScriptOutput = Array<{ /** * The Slack channel ID. */ id: string /** * The prefixed channel URI. */ uri: string /** * The user-navigable channel URL. Include this link when telling the user the channel was created. */ url: string /** * The channel name, without a "#" prefix. */ name: string /** * ISO 8601 timestamp of when the channel was created. */ created: string /** * Whether this is the workspace's general channel. */ isGeneral: boolean /** * Whether this is a direct message channel. */ isIm: boolean /** * Whether the channel is private. */ isPrivate: boolean /** * Whether this is a group direct message channel. */ isMpim: boolean /** * Whether the channel is shared between Slack workspaces. */ isShared: boolean /** * Whether the channel is shared across an Enterprise Grid organization. */ isOrgShared: boolean /** * Whether the integration bot user is in the channel. */ botIsMember: boolean /** * Whether the channel is archived. */ isArchived: boolean }> /** * Script input for the "Remove a reaction from a Slack message" effect (`slack.removeReactionFromMessage`), * derived from its Tool Core definition's call_function input projection. * * Remove a reaction from a Slack message */ export type RemoveReactionFromMessageScriptInput = { /** * The URI of the Slack message */ prefixedMessageUri: string reaction: string } /** * Canonical Tool Core output for the "Remove a reaction from a Slack message" effect (`slack.removeReactionFromMessage`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type RemoveReactionFromMessageScriptOutput = { channelName: string prefixedMessageUri: string reaction: string status: "added" | "already_absent" | "already_present" | "removed" message?: string } /** * Script input for the "Reply to Slack thread" effect (`slack.replyInThread`), * derived from its Tool Core definition's call_function input projection. * * Reply in a Slack thread */ export type ReplyInThreadScriptInput = { /** * The file IDs of any files attached to the message. */ attachedFileIds?: Array /** * Raw Slack user ID that should be the only user able to see the reply. Omit for a normal thread reply. */ ephemeralUserId?: string /** * The thread URI to reply to. If there is a Slack message trigger, use the thread-id attribute from the trigger message. */ prefixedThreadUri: string /** * The Slack markdown message to post in the thread. */ message: string /** * Whether to unfurl links in Slack. Defaults to true. */ unfurlLinks?: boolean /** * A confirmation token for sending messages with URLs that require user approval. Do NOT provide unless specifically instructed or unless an error provides the token. */ userConfirmationToken?: string } /** * Canonical Tool Core output for the "Reply to Slack thread" effect (`slack.replyInThread`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type ReplyInThreadScriptOutput = { message: string url: string channelId: string threadId: string slackMessageId: string } /** * Script input for the "Search Slack messages" effect (`slack.search`), * derived from its Tool Core definition's call_function input projection. * * Search Slack via the configured connector. */ export type SearchScriptInput = { /** * A single, focused question to search for. */ question: string /** * Brief keywords capturing the core entities. */ keywords?: string /** * Optional time window. Use only "default", "all_time", a duration matching /^\d+[dwmy]$/ (for example, "7d", "2w", "3m", or "1y"), or a date in "YYYY-MM-DD" format. Do not use natural-language durations or combine units. */ lookback?: string options?: { /** * Preferred Slack channel name. This boosts results from that channel but does not filter the search. Results from other conversations may be returned. Check each result's conversation before using it. */ channel?: string } } /** * Canonical Tool Core output for the "Search Slack messages" effect (`slack.search`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type SearchScriptOutput = { results: Array<{ conversation: { id: string kind: "channel" | "dm" | "groupDm" name: string } messageUrl: string lastEdited: string messages: Array<{ messageUrl: string lastEdited: string text: string user: string }> }> } /** * Script input for the "Update a Slack message" effect (`slack.updateMessage`), * derived from its Tool Core definition's call_function input projection. * * Update a Slack message */ export type UpdateMessageScriptInput = { /** * The URI of the Slack message */ prefixedMessageUri: string /** * Message body in standard Markdown. Never use Notion rich-text XML such as ; write Notion references as Markdown links ([label](https://example.com)). Use Slack mention tokens only when a verified Slack ID is available. */ message: string /** * Whether to unfurl links in Slack. Defaults to true. */ unfurlLinks?: boolean } /** * Canonical Tool Core output for the "Update a Slack message" effect (`slack.updateMessage`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type UpdateMessageScriptOutput = { channelId: string channelUri: string from: | { handle: string id: string type: "user" uri: string } | { type: "bot" } id: string message: string threadId: string timestamp: string uri: string url: string urls: Array channel?: string fileIds?: Array files?: Array } /** * Script input for the "View Slack file URL" effect (`slack.viewFileUrl`), * derived from its Tool Core definition's call_function input projection. * * Return a Slack file URL for script-agent viewing. */ export type ViewFileUrlScriptInput = { /** * Slack private file URL or workspace file permalink to download and attach for viewing. */ url: string } /** * Canonical Tool Core output for the "View Slack file URL" effect (`slack.viewFileUrl`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type ViewFileUrlScriptOutput = { url: string fileName?: string fileUrl?: string } export class SlackConnectionClient { constructor(private readonly invoke: ConnectionActionInvoker) {} addReactionToMessage( args: AddReactionToMessageScriptInput, ): Promise { return this.invoke( "addReactionToMessage", args, ) } createThreadInChannel( args: CreateThreadInChannelScriptInput, ): Promise { return this.invoke( "createThreadInChannel", args, ) } findUserByEmail( args: FindUserByEmailScriptInput, ): Promise { return this.invoke("findUserByEmail", args) } getThreadsInChannelSince( args: GetThreadsInChannelSinceScriptInput, ): Promise { return this.invoke( "getThreadsInChannelSince", args, ) } getUser(args: GetUserScriptInput): Promise { return this.invoke("getUser", args) } getUserMessages( args: GetUserMessagesScriptInput, ): Promise { return this.invoke("getUserMessages", args) } loadMessage(args: LoadMessageScriptInput): Promise { return this.invoke("loadMessage", args) } parseSlackUriOrUrl( args: ParseSlackUriOrUrlScriptInput, ): Promise { return this.invoke( "parseSlackUriOrUrl", args, ) } queryChannels( args: QueryChannelsScriptInput, ): Promise { return this.invoke("queryChannels", args) } removeReactionFromMessage( args: RemoveReactionFromMessageScriptInput, ): Promise { return this.invoke( "removeReactionFromMessage", args, ) } replyInThread( args: ReplyInThreadScriptInput, ): Promise { return this.invoke("replyInThread", args) } search(args: SearchScriptInput): Promise { return this.invoke("search", args) } updateMessage( args: UpdateMessageScriptInput, ): Promise { return this.invoke("updateMessage", args) } viewFileUrl(args: ViewFileUrlScriptInput): Promise { return this.invoke("viewFileUrl", args) } }