@squidcloud/slack-client 1.0.146-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,98 @@
1
+ import { AiFileUrl } from '../../../../internal-common/src/public-types/ai-agent.public-types';
2
+ import { IntegrationId } from '../../../../internal-common/src/public-types/communication.public-types';
3
+ /** Slack conversation/channel ID */
4
+ export type ConversationId = string;
5
+ /** List of conversations types. */
6
+ export declare const RECIPIENT_TYPES: readonly ["channel", "user", "group"];
7
+ /** Types of conversations. */
8
+ export type RecipientType = (typeof RECIPIENT_TYPES)[number];
9
+ /**
10
+ * Fuzzy search result mapping the user query to matching user IDs.
11
+ */
12
+ export interface FuzzyUserSearchResult {
13
+ /** Query for a particular user */
14
+ userQuery: string;
15
+ /** User IDs for users that match the given query. */
16
+ userId: string | undefined;
17
+ }
18
+ /**
19
+ * Slack file upload response.
20
+ */
21
+ export interface FileUploadResponse {
22
+ ok: boolean;
23
+ error?: string;
24
+ }
25
+ /**
26
+ * User profile object.
27
+ */
28
+ export interface SlackUser {
29
+ id: string;
30
+ name?: string;
31
+ profile?: {
32
+ display_name?: string;
33
+ email?: string;
34
+ };
35
+ }
36
+ /**
37
+ * Request to send a message in Slack.
38
+ */
39
+ export interface SendSlackMessageRequest {
40
+ /**
41
+ * The recipient of the Slack message. Can be the channel name, username, email address, or
42
+ * comma-separated list of usernames/emails (if the recipient type is a group). Usernames will
43
+ * be fuzzy searched.
44
+ */
45
+ recipient: string;
46
+ /** The message to send. */
47
+ message: string;
48
+ /**
49
+ * Indicates the type of recipient.
50
+ * - For public and private channels, use "channel".
51
+ * - For direct messages, use "user".
52
+ * - For chat groups, use "group".
53
+ */
54
+ recipientType: RecipientType;
55
+ /** Which Slack integration instance to send the message to. */
56
+ integrationId: string;
57
+ /**
58
+ * Slack replies operate on passing in the timestamp of the parent/root message of a thread.
59
+ * You may pass in the timestamp in 4 possible formats:
60
+ * - Permalink (non-thread): https://yourinstance.slack.com/archives/C000AB0ABCDE/p1759525914304959
61
+ * - Permalink (threaded): https://yourinstance.slack.com/archives/C000AB0ABCDE/p1759734921171239?thread_ts=1759525914.304959&cid=C000AB0ABCDE
62
+ * - Unix time (seconds with floating point): 1759525914.304959
63
+ * - Unix time (microseconds): 1759525914304959
64
+ */
65
+ replyParentTs?: string;
66
+ /** AiFileUrl objects referring to files you want to attach to the message. */
67
+ attachments?: AiFileUrl[];
68
+ }
69
+ /**
70
+ * Request to search for messages related to a given prompt.
71
+ */
72
+ export interface SearchSlackMessagesRequest {
73
+ /** The search query */
74
+ prompt: string;
75
+ /** Which Slack integration instance to search. */
76
+ integrationId: IntegrationId;
77
+ /** Restrict the search to the given channels names, comma-separated. */
78
+ channelNames?: string;
79
+ }
80
+ /**
81
+ * Message search result chunk.
82
+ */
83
+ export interface SearchSlackMessagesResultChunk {
84
+ /**
85
+ * Conversation messages.
86
+ * Contains an arbitrary subset of messages in sequential & chronological order, where the
87
+ * matching messages are contained within the subset.
88
+ */
89
+ messages: string;
90
+ /** Channel/conversation name the messages came from. */
91
+ conversationName?: string;
92
+ /** Conversation Type (typically channel). */
93
+ conversationType?: RecipientType;
94
+ /** Thread ID if these messages are part of a thread. */
95
+ threadId?: string;
96
+ /** The day date (in UTC) that the conversation took place. */
97
+ timestamp?: Date;
98
+ }
@@ -0,0 +1 @@
1
+ export * from './slack-client';
@@ -0,0 +1,39 @@
1
+ import { Squid } from '@squidcloud/client';
2
+ import { SearchSlackMessagesRequest, SearchSlackMessagesResultChunk, SendSlackMessageRequest } from '../../common/src/slack-types';
3
+ /**
4
+ * Client for interacting with the Slack connector.
5
+ */
6
+ export declare class SquidSlackClient {
7
+ private readonly squid;
8
+ private readonly integrationId;
9
+ /**
10
+ * Creates a new Slack client instance.
11
+ *
12
+ * @param squid - Squid client instance. Provide an instance that includes the Squid API key.
13
+ * @param integrationId - The ID of the Slack integration in the Squid console
14
+ */
15
+ constructor(squid: Squid, integrationId: string);
16
+ /**
17
+ * Send a message to the given Slack integration.
18
+ *
19
+ * Supports sending files as well, and to channels, groups, or direct message (to a single user).
20
+ *
21
+ * The message can be a reply to a thread via the `replyParentTs` field in `SendSlackMessageRequest`
22
+ * by giving it a permalink to the message you want to reply to. See `SendSlackMessageRequest` for
23
+ * more details.
24
+ *
25
+ * The provided `squid` instance requires your Squid API key to use this function.
26
+ *
27
+ * @param request Request parameters for sending a message to Slack.
28
+ */
29
+ sendMessage(request: Omit<SendSlackMessageRequest, 'integrationId'>): Promise<void>;
30
+ /**
31
+ * Search for messages related to the given prompt query string.
32
+ *
33
+ * The provided `squid` instance requires your Squid API key to use this function.
34
+ *
35
+ * @param request Request parameters for searching within a Slack integration instance.
36
+ * @returns Array of chunks of messages that contain messages related to the query.
37
+ */
38
+ searchMessages(request: Omit<SearchSlackMessagesRequest, 'integrationId'>): Promise<SearchSlackMessagesResultChunk[]>;
39
+ }
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ (()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{SquidSlackClient:()=>n});class n{constructor(e,t){this.squid=e,this.integrationId=t}async sendMessage(e){const t={...e,integrationId:this.integrationId};return this.squid.executeFunction("sendMessageToSlack",t)}async searchMessages(e){const t={...e,integrationId:this.integrationId};return this.squid.executeFunction("searchMessagesInSlack",t)}}var r=exports;for(var s in t)r[s]=t[s];t.__esModule&&Object.defineProperty(r,"__esModule",{value:!0})})();