simple-support-chat 0.1.0 → 0.2.0
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.
- package/README.md +302 -3
- package/dist/client/index.cjs +118 -20
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +13 -5
- package/dist/client/index.d.ts +13 -5
- package/dist/client/index.js +119 -21
- package/dist/client/index.js.map +1 -1
- package/dist/server/index.cjs +2176 -9
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +189 -1
- package/dist/server/index.d.ts +189 -1
- package/dist/server/index.js +2166 -10
- package/dist/server/index.js.map +1 -1
- package/package.json +87 -85
package/dist/server/index.d.cts
CHANGED
|
@@ -13,6 +13,8 @@ interface SlackConfig {
|
|
|
13
13
|
interface SupportHandlerOptions extends SlackConfig {
|
|
14
14
|
/** Optional callback fired on each message */
|
|
15
15
|
onMessage?: (data: IncomingMessage) => void | Promise<void>;
|
|
16
|
+
/** Optional pluggable storage backend. Defaults to InMemoryStore. */
|
|
17
|
+
store?: SupportChatStore;
|
|
16
18
|
}
|
|
17
19
|
/** User info sent from the client */
|
|
18
20
|
interface MessageUser {
|
|
@@ -63,6 +65,46 @@ interface ExpressResponse {
|
|
|
63
65
|
status(code: number): ExpressResponse;
|
|
64
66
|
json(data: unknown): void;
|
|
65
67
|
}
|
|
68
|
+
/** A reply from a team member in Slack, stored for client polling. */
|
|
69
|
+
interface Reply {
|
|
70
|
+
/** Unique reply ID */
|
|
71
|
+
id: string;
|
|
72
|
+
/** Reply text content */
|
|
73
|
+
text: string;
|
|
74
|
+
/** Display name of the sender */
|
|
75
|
+
sender: string;
|
|
76
|
+
/** ISO 8601 timestamp of the reply */
|
|
77
|
+
timestamp: string;
|
|
78
|
+
/** Slack thread_ts the reply belongs to */
|
|
79
|
+
threadTs: string;
|
|
80
|
+
}
|
|
81
|
+
/** Metadata stored alongside a thread mapping. */
|
|
82
|
+
interface ThreadRecord {
|
|
83
|
+
/** Client session identifier */
|
|
84
|
+
sessionId: string;
|
|
85
|
+
/** Slack thread timestamp */
|
|
86
|
+
threadTs: string;
|
|
87
|
+
/** Optional metadata (user info, context, etc.) */
|
|
88
|
+
metadata?: Record<string, unknown>;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Pluggable storage interface for thread mappings and replies.
|
|
92
|
+
*
|
|
93
|
+
* Implement this interface to persist data to any database.
|
|
94
|
+
* The package ships with `InMemoryStore` as the default for local development.
|
|
95
|
+
*/
|
|
96
|
+
interface SupportChatStore {
|
|
97
|
+
/** Save a thread mapping (session -> Slack thread). */
|
|
98
|
+
saveThread(sessionId: string, threadTs: string, metadata?: Record<string, unknown>): Promise<void>;
|
|
99
|
+
/** Look up a thread by client session ID. Returns null if not found. */
|
|
100
|
+
getThreadBySession(sessionId: string): Promise<ThreadRecord | null>;
|
|
101
|
+
/** Look up a thread by Slack thread timestamp. Returns null if not found. */
|
|
102
|
+
getThreadByTs(threadTs: string): Promise<ThreadRecord | null>;
|
|
103
|
+
/** Save a reply from a team member. */
|
|
104
|
+
saveReply(sessionId: string, reply: Reply): Promise<void>;
|
|
105
|
+
/** Get replies for a session. If `since` (ISO 8601) is provided, only return newer replies. */
|
|
106
|
+
getReplies(sessionId: string, since?: string): Promise<Reply[]>;
|
|
107
|
+
}
|
|
66
108
|
|
|
67
109
|
/**
|
|
68
110
|
* Creates a support chat POST handler that routes messages to Slack threads.
|
|
@@ -114,4 +156,150 @@ declare function validateSlackToken(token: string): Promise<{
|
|
|
114
156
|
error?: string;
|
|
115
157
|
}>;
|
|
116
158
|
|
|
117
|
-
|
|
159
|
+
/** Options for createWebhookHandler */
|
|
160
|
+
interface WebhookHandlerOptions {
|
|
161
|
+
/** Pluggable storage backend (must be the same instance used by createSupportHandler) */
|
|
162
|
+
store: SupportChatStore;
|
|
163
|
+
/** Slack signing secret for request verification */
|
|
164
|
+
signingSecret: string;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Verify Slack request signature.
|
|
168
|
+
*
|
|
169
|
+
* @see https://api.slack.com/authentication/verifying-requests-from-slack
|
|
170
|
+
*/
|
|
171
|
+
declare function verifySlackSignature(signingSecret: string, signature: string, timestamp: string, rawBody: string): boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Creates a Slack webhook handler using the Web API Request/Response standard.
|
|
174
|
+
*
|
|
175
|
+
* Handles:
|
|
176
|
+
* - URL verification challenge (Slack app setup)
|
|
177
|
+
* - Event subscription messages (thread replies from team members)
|
|
178
|
+
*
|
|
179
|
+
* Compatible with Next.js App Router, Remix, Hono, Deno, Bun, etc.
|
|
180
|
+
*
|
|
181
|
+
* @example Next.js App Router
|
|
182
|
+
* ```ts
|
|
183
|
+
* // app/api/support/webhook/route.ts
|
|
184
|
+
* import { createWebhookHandler } from 'simple-support-chat/server';
|
|
185
|
+
* import { store } from '../store';
|
|
186
|
+
*
|
|
187
|
+
* export const POST = createWebhookHandler({
|
|
188
|
+
* store,
|
|
189
|
+
* signingSecret: process.env.SLACK_SIGNING_SECRET!,
|
|
190
|
+
* });
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
193
|
+
declare function createWebhookHandler(options: WebhookHandlerOptions): (request: Request) => Promise<Response>;
|
|
194
|
+
/**
|
|
195
|
+
* Creates a Slack webhook handler for Express/Connect frameworks.
|
|
196
|
+
*
|
|
197
|
+
* IMPORTANT: You must use a raw body parser for the webhook route so that
|
|
198
|
+
* signature verification works correctly. Example:
|
|
199
|
+
*
|
|
200
|
+
* ```ts
|
|
201
|
+
* import express from 'express';
|
|
202
|
+
* import { createExpressWebhookHandler } from 'simple-support-chat/server';
|
|
203
|
+
*
|
|
204
|
+
* const app = express();
|
|
205
|
+
*
|
|
206
|
+
* // Use raw body parser for the webhook route
|
|
207
|
+
* app.post('/api/support/webhook',
|
|
208
|
+
* express.raw({ type: 'application/json' }),
|
|
209
|
+
* createExpressWebhookHandler({
|
|
210
|
+
* store,
|
|
211
|
+
* signingSecret: process.env.SLACK_SIGNING_SECRET!,
|
|
212
|
+
* })
|
|
213
|
+
* );
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
216
|
+
declare function createExpressWebhookHandler(options: WebhookHandlerOptions): (req: ExpressWebhookRequest, res: ExpressResponse) => Promise<void>;
|
|
217
|
+
/** Express request with headers for webhook signature verification */
|
|
218
|
+
interface ExpressWebhookRequest extends ExpressRequest {
|
|
219
|
+
headers?: Record<string, string | string[] | undefined>;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/** Options for createRepliesHandler */
|
|
223
|
+
interface RepliesHandlerOptions {
|
|
224
|
+
/** Pluggable storage backend (must be the same instance used by createSupportHandler) */
|
|
225
|
+
store: SupportChatStore;
|
|
226
|
+
}
|
|
227
|
+
/** Response shape returned by the replies endpoint */
|
|
228
|
+
interface RepliesResponse {
|
|
229
|
+
replies: Reply[];
|
|
230
|
+
lastChecked: string;
|
|
231
|
+
}
|
|
232
|
+
/** Error response from the replies endpoint */
|
|
233
|
+
interface RepliesErrorResponse {
|
|
234
|
+
error: string;
|
|
235
|
+
}
|
|
236
|
+
/** Express-compatible request with query params */
|
|
237
|
+
interface ExpressRepliesRequest {
|
|
238
|
+
query?: Record<string, string | string[] | undefined>;
|
|
239
|
+
method?: string;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Creates a replies polling handler using the Web API Request/Response standard.
|
|
243
|
+
*
|
|
244
|
+
* Accepts GET requests with query parameters:
|
|
245
|
+
* - `sessionId` (required): The client session ID to fetch replies for
|
|
246
|
+
* - `since` (optional): ISO 8601 timestamp to fetch only newer replies
|
|
247
|
+
*
|
|
248
|
+
* Returns JSON: `{ replies: Reply[], lastChecked: string }`
|
|
249
|
+
*
|
|
250
|
+
* Compatible with Next.js App Router, Remix, Hono, Deno, Bun, etc.
|
|
251
|
+
*
|
|
252
|
+
* @example Next.js App Router
|
|
253
|
+
* ```ts
|
|
254
|
+
* // app/api/support/replies/route.ts
|
|
255
|
+
* import { createRepliesHandler } from 'simple-support-chat/server';
|
|
256
|
+
* import { store } from '../store';
|
|
257
|
+
*
|
|
258
|
+
* export const GET = createRepliesHandler({ store });
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
declare function createRepliesHandler(options: RepliesHandlerOptions): (request: Request) => Promise<Response>;
|
|
262
|
+
/**
|
|
263
|
+
* Creates a replies polling handler for Express/Connect frameworks.
|
|
264
|
+
*
|
|
265
|
+
* @example Express
|
|
266
|
+
* ```ts
|
|
267
|
+
* import express from 'express';
|
|
268
|
+
* import { createExpressRepliesHandler } from 'simple-support-chat/server';
|
|
269
|
+
*
|
|
270
|
+
* const app = express();
|
|
271
|
+
* app.get('/api/support/replies', createExpressRepliesHandler({ store }));
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
274
|
+
declare function createExpressRepliesHandler(options: RepliesHandlerOptions): (req: ExpressRepliesRequest, res: ExpressResponse) => Promise<void>;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* In-memory implementation of SupportChatStore.
|
|
278
|
+
*
|
|
279
|
+
* Suitable for local development and testing. Data is lost when the process
|
|
280
|
+
* restarts. For production, implement SupportChatStore with your database
|
|
281
|
+
* of choice (Supabase, Prisma, MongoDB, etc.).
|
|
282
|
+
*/
|
|
283
|
+
declare class InMemoryStore implements SupportChatStore {
|
|
284
|
+
/** sessionId -> ThreadRecord */
|
|
285
|
+
private threads;
|
|
286
|
+
/** threadTs -> sessionId (reverse lookup) */
|
|
287
|
+
private threadTsIndex;
|
|
288
|
+
/** sessionId -> Reply[] */
|
|
289
|
+
private replies;
|
|
290
|
+
saveThread(sessionId: string, threadTs: string, metadata?: Record<string, unknown>): Promise<void>;
|
|
291
|
+
getThreadBySession(sessionId: string): Promise<ThreadRecord | null>;
|
|
292
|
+
getThreadByTs(threadTs: string): Promise<ThreadRecord | null>;
|
|
293
|
+
saveReply(sessionId: string, reply: Reply): Promise<void>;
|
|
294
|
+
getReplies(sessionId: string, since?: string): Promise<Reply[]>;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Convert Slack-style emoji shortcodes (e.g. `:slightly_smiling_face:`) to
|
|
299
|
+
* their Unicode emoji equivalents (e.g. 🙂).
|
|
300
|
+
*
|
|
301
|
+
* Unknown shortcodes are left as-is so nothing is lost in translation.
|
|
302
|
+
*/
|
|
303
|
+
declare function emojify(text: string): string;
|
|
304
|
+
|
|
305
|
+
export { type ErrorResponse, type ExpressRepliesRequest, type ExpressRequest, type ExpressResponse, type ExpressWebhookRequest, type HandlerResponse, InMemoryStore, type IncomingMessage, type MessageContext, type MessageUser, type RepliesErrorResponse, type RepliesHandlerOptions, type RepliesResponse, type Reply, type SlackConfig, type SuccessResponse, type SupportChatStore, type SupportHandlerOptions, type ThreadRecord, type WebhookHandlerOptions, createExpressHandler, createExpressRepliesHandler, createExpressWebhookHandler, createRepliesHandler, createSupportHandler, createWebhookHandler, emojify, validateSlackToken, verifySlackSignature };
|
package/dist/server/index.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ interface SlackConfig {
|
|
|
13
13
|
interface SupportHandlerOptions extends SlackConfig {
|
|
14
14
|
/** Optional callback fired on each message */
|
|
15
15
|
onMessage?: (data: IncomingMessage) => void | Promise<void>;
|
|
16
|
+
/** Optional pluggable storage backend. Defaults to InMemoryStore. */
|
|
17
|
+
store?: SupportChatStore;
|
|
16
18
|
}
|
|
17
19
|
/** User info sent from the client */
|
|
18
20
|
interface MessageUser {
|
|
@@ -63,6 +65,46 @@ interface ExpressResponse {
|
|
|
63
65
|
status(code: number): ExpressResponse;
|
|
64
66
|
json(data: unknown): void;
|
|
65
67
|
}
|
|
68
|
+
/** A reply from a team member in Slack, stored for client polling. */
|
|
69
|
+
interface Reply {
|
|
70
|
+
/** Unique reply ID */
|
|
71
|
+
id: string;
|
|
72
|
+
/** Reply text content */
|
|
73
|
+
text: string;
|
|
74
|
+
/** Display name of the sender */
|
|
75
|
+
sender: string;
|
|
76
|
+
/** ISO 8601 timestamp of the reply */
|
|
77
|
+
timestamp: string;
|
|
78
|
+
/** Slack thread_ts the reply belongs to */
|
|
79
|
+
threadTs: string;
|
|
80
|
+
}
|
|
81
|
+
/** Metadata stored alongside a thread mapping. */
|
|
82
|
+
interface ThreadRecord {
|
|
83
|
+
/** Client session identifier */
|
|
84
|
+
sessionId: string;
|
|
85
|
+
/** Slack thread timestamp */
|
|
86
|
+
threadTs: string;
|
|
87
|
+
/** Optional metadata (user info, context, etc.) */
|
|
88
|
+
metadata?: Record<string, unknown>;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Pluggable storage interface for thread mappings and replies.
|
|
92
|
+
*
|
|
93
|
+
* Implement this interface to persist data to any database.
|
|
94
|
+
* The package ships with `InMemoryStore` as the default for local development.
|
|
95
|
+
*/
|
|
96
|
+
interface SupportChatStore {
|
|
97
|
+
/** Save a thread mapping (session -> Slack thread). */
|
|
98
|
+
saveThread(sessionId: string, threadTs: string, metadata?: Record<string, unknown>): Promise<void>;
|
|
99
|
+
/** Look up a thread by client session ID. Returns null if not found. */
|
|
100
|
+
getThreadBySession(sessionId: string): Promise<ThreadRecord | null>;
|
|
101
|
+
/** Look up a thread by Slack thread timestamp. Returns null if not found. */
|
|
102
|
+
getThreadByTs(threadTs: string): Promise<ThreadRecord | null>;
|
|
103
|
+
/** Save a reply from a team member. */
|
|
104
|
+
saveReply(sessionId: string, reply: Reply): Promise<void>;
|
|
105
|
+
/** Get replies for a session. If `since` (ISO 8601) is provided, only return newer replies. */
|
|
106
|
+
getReplies(sessionId: string, since?: string): Promise<Reply[]>;
|
|
107
|
+
}
|
|
66
108
|
|
|
67
109
|
/**
|
|
68
110
|
* Creates a support chat POST handler that routes messages to Slack threads.
|
|
@@ -114,4 +156,150 @@ declare function validateSlackToken(token: string): Promise<{
|
|
|
114
156
|
error?: string;
|
|
115
157
|
}>;
|
|
116
158
|
|
|
117
|
-
|
|
159
|
+
/** Options for createWebhookHandler */
|
|
160
|
+
interface WebhookHandlerOptions {
|
|
161
|
+
/** Pluggable storage backend (must be the same instance used by createSupportHandler) */
|
|
162
|
+
store: SupportChatStore;
|
|
163
|
+
/** Slack signing secret for request verification */
|
|
164
|
+
signingSecret: string;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Verify Slack request signature.
|
|
168
|
+
*
|
|
169
|
+
* @see https://api.slack.com/authentication/verifying-requests-from-slack
|
|
170
|
+
*/
|
|
171
|
+
declare function verifySlackSignature(signingSecret: string, signature: string, timestamp: string, rawBody: string): boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Creates a Slack webhook handler using the Web API Request/Response standard.
|
|
174
|
+
*
|
|
175
|
+
* Handles:
|
|
176
|
+
* - URL verification challenge (Slack app setup)
|
|
177
|
+
* - Event subscription messages (thread replies from team members)
|
|
178
|
+
*
|
|
179
|
+
* Compatible with Next.js App Router, Remix, Hono, Deno, Bun, etc.
|
|
180
|
+
*
|
|
181
|
+
* @example Next.js App Router
|
|
182
|
+
* ```ts
|
|
183
|
+
* // app/api/support/webhook/route.ts
|
|
184
|
+
* import { createWebhookHandler } from 'simple-support-chat/server';
|
|
185
|
+
* import { store } from '../store';
|
|
186
|
+
*
|
|
187
|
+
* export const POST = createWebhookHandler({
|
|
188
|
+
* store,
|
|
189
|
+
* signingSecret: process.env.SLACK_SIGNING_SECRET!,
|
|
190
|
+
* });
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
193
|
+
declare function createWebhookHandler(options: WebhookHandlerOptions): (request: Request) => Promise<Response>;
|
|
194
|
+
/**
|
|
195
|
+
* Creates a Slack webhook handler for Express/Connect frameworks.
|
|
196
|
+
*
|
|
197
|
+
* IMPORTANT: You must use a raw body parser for the webhook route so that
|
|
198
|
+
* signature verification works correctly. Example:
|
|
199
|
+
*
|
|
200
|
+
* ```ts
|
|
201
|
+
* import express from 'express';
|
|
202
|
+
* import { createExpressWebhookHandler } from 'simple-support-chat/server';
|
|
203
|
+
*
|
|
204
|
+
* const app = express();
|
|
205
|
+
*
|
|
206
|
+
* // Use raw body parser for the webhook route
|
|
207
|
+
* app.post('/api/support/webhook',
|
|
208
|
+
* express.raw({ type: 'application/json' }),
|
|
209
|
+
* createExpressWebhookHandler({
|
|
210
|
+
* store,
|
|
211
|
+
* signingSecret: process.env.SLACK_SIGNING_SECRET!,
|
|
212
|
+
* })
|
|
213
|
+
* );
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
216
|
+
declare function createExpressWebhookHandler(options: WebhookHandlerOptions): (req: ExpressWebhookRequest, res: ExpressResponse) => Promise<void>;
|
|
217
|
+
/** Express request with headers for webhook signature verification */
|
|
218
|
+
interface ExpressWebhookRequest extends ExpressRequest {
|
|
219
|
+
headers?: Record<string, string | string[] | undefined>;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/** Options for createRepliesHandler */
|
|
223
|
+
interface RepliesHandlerOptions {
|
|
224
|
+
/** Pluggable storage backend (must be the same instance used by createSupportHandler) */
|
|
225
|
+
store: SupportChatStore;
|
|
226
|
+
}
|
|
227
|
+
/** Response shape returned by the replies endpoint */
|
|
228
|
+
interface RepliesResponse {
|
|
229
|
+
replies: Reply[];
|
|
230
|
+
lastChecked: string;
|
|
231
|
+
}
|
|
232
|
+
/** Error response from the replies endpoint */
|
|
233
|
+
interface RepliesErrorResponse {
|
|
234
|
+
error: string;
|
|
235
|
+
}
|
|
236
|
+
/** Express-compatible request with query params */
|
|
237
|
+
interface ExpressRepliesRequest {
|
|
238
|
+
query?: Record<string, string | string[] | undefined>;
|
|
239
|
+
method?: string;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Creates a replies polling handler using the Web API Request/Response standard.
|
|
243
|
+
*
|
|
244
|
+
* Accepts GET requests with query parameters:
|
|
245
|
+
* - `sessionId` (required): The client session ID to fetch replies for
|
|
246
|
+
* - `since` (optional): ISO 8601 timestamp to fetch only newer replies
|
|
247
|
+
*
|
|
248
|
+
* Returns JSON: `{ replies: Reply[], lastChecked: string }`
|
|
249
|
+
*
|
|
250
|
+
* Compatible with Next.js App Router, Remix, Hono, Deno, Bun, etc.
|
|
251
|
+
*
|
|
252
|
+
* @example Next.js App Router
|
|
253
|
+
* ```ts
|
|
254
|
+
* // app/api/support/replies/route.ts
|
|
255
|
+
* import { createRepliesHandler } from 'simple-support-chat/server';
|
|
256
|
+
* import { store } from '../store';
|
|
257
|
+
*
|
|
258
|
+
* export const GET = createRepliesHandler({ store });
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
declare function createRepliesHandler(options: RepliesHandlerOptions): (request: Request) => Promise<Response>;
|
|
262
|
+
/**
|
|
263
|
+
* Creates a replies polling handler for Express/Connect frameworks.
|
|
264
|
+
*
|
|
265
|
+
* @example Express
|
|
266
|
+
* ```ts
|
|
267
|
+
* import express from 'express';
|
|
268
|
+
* import { createExpressRepliesHandler } from 'simple-support-chat/server';
|
|
269
|
+
*
|
|
270
|
+
* const app = express();
|
|
271
|
+
* app.get('/api/support/replies', createExpressRepliesHandler({ store }));
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
274
|
+
declare function createExpressRepliesHandler(options: RepliesHandlerOptions): (req: ExpressRepliesRequest, res: ExpressResponse) => Promise<void>;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* In-memory implementation of SupportChatStore.
|
|
278
|
+
*
|
|
279
|
+
* Suitable for local development and testing. Data is lost when the process
|
|
280
|
+
* restarts. For production, implement SupportChatStore with your database
|
|
281
|
+
* of choice (Supabase, Prisma, MongoDB, etc.).
|
|
282
|
+
*/
|
|
283
|
+
declare class InMemoryStore implements SupportChatStore {
|
|
284
|
+
/** sessionId -> ThreadRecord */
|
|
285
|
+
private threads;
|
|
286
|
+
/** threadTs -> sessionId (reverse lookup) */
|
|
287
|
+
private threadTsIndex;
|
|
288
|
+
/** sessionId -> Reply[] */
|
|
289
|
+
private replies;
|
|
290
|
+
saveThread(sessionId: string, threadTs: string, metadata?: Record<string, unknown>): Promise<void>;
|
|
291
|
+
getThreadBySession(sessionId: string): Promise<ThreadRecord | null>;
|
|
292
|
+
getThreadByTs(threadTs: string): Promise<ThreadRecord | null>;
|
|
293
|
+
saveReply(sessionId: string, reply: Reply): Promise<void>;
|
|
294
|
+
getReplies(sessionId: string, since?: string): Promise<Reply[]>;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Convert Slack-style emoji shortcodes (e.g. `:slightly_smiling_face:`) to
|
|
299
|
+
* their Unicode emoji equivalents (e.g. 🙂).
|
|
300
|
+
*
|
|
301
|
+
* Unknown shortcodes are left as-is so nothing is lost in translation.
|
|
302
|
+
*/
|
|
303
|
+
declare function emojify(text: string): string;
|
|
304
|
+
|
|
305
|
+
export { type ErrorResponse, type ExpressRepliesRequest, type ExpressRequest, type ExpressResponse, type ExpressWebhookRequest, type HandlerResponse, InMemoryStore, type IncomingMessage, type MessageContext, type MessageUser, type RepliesErrorResponse, type RepliesHandlerOptions, type RepliesResponse, type Reply, type SlackConfig, type SuccessResponse, type SupportChatStore, type SupportHandlerOptions, type ThreadRecord, type WebhookHandlerOptions, createExpressHandler, createExpressRepliesHandler, createExpressWebhookHandler, createRepliesHandler, createSupportHandler, createWebhookHandler, emojify, validateSlackToken, verifySlackSignature };
|