@livechatta/sdk 0.0.0-stage → 1.0.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/CHANGELOG.md +218 -0
- package/LICENSE +21 -0
- package/README.md +2558 -2
- package/bin/chatta.mjs +7 -0
- package/bin/lib/cli.d.mts +46 -0
- package/bin/lib/cli.mjs +2088 -0
- package/dist/cjs/livechatta.cjs.js +7258 -0
- package/dist/cjs/livechatta.cjs.js.map +1 -0
- package/dist/cjs/livechatta.cjs.min.js +2 -0
- package/dist/cjs/livechatta.cjs.min.js.map +1 -0
- package/dist/esm/livechatta.esm.js +7077 -0
- package/dist/esm/livechatta.esm.js.map +1 -0
- package/dist/esm/livechatta.esm.min.js +2 -0
- package/dist/esm/livechatta.esm.min.js.map +1 -0
- package/dist/platforms/android/LiveChattaClient.kt +367 -0
- package/dist/platforms/android/LiveChattaHttpAPI.kt +2630 -0
- package/dist/platforms/android/LiveChattaJson.kt +83 -0
- package/dist/platforms/android/LiveChattaModels.kt +22805 -0
- package/dist/platforms/android/LiveChattaSentFrom.kt +30 -0
- package/dist/platforms/android/LiveChattaSocketAPI.kt +2113 -0
- package/dist/platforms/android/LiveChattaTyped.kt +239 -0
- package/dist/platforms/android/LiveChattaWebView.kt +158 -0
- package/dist/platforms/angular/livechatta-bridge.service.d.ts +35 -0
- package/dist/platforms/angular/livechatta-bridge.service.js +1 -0
- package/dist/platforms/angular/livechatta-bridge.service.js.map +1 -0
- package/dist/platforms/angular/livechatta-embed.component.d.ts +46 -0
- package/dist/platforms/angular/livechatta-embed.component.js +1 -0
- package/dist/platforms/angular/livechatta-embed.component.js.map +1 -0
- package/dist/platforms/angular/livechatta.service.d.ts +66 -0
- package/dist/platforms/angular/livechatta.service.js +1 -0
- package/dist/platforms/angular/livechatta.service.js.map +1 -0
- package/dist/platforms/capacitor/CapacitorBridge.d.ts +27 -0
- package/dist/platforms/capacitor/CapacitorBridge.js +1 -0
- package/dist/platforms/capacitor/CapacitorBridge.js.map +1 -0
- package/dist/platforms/capacitor/CapacitorDeepLinks.d.ts +23 -0
- package/dist/platforms/capacitor/CapacitorDeepLinks.js +1 -0
- package/dist/platforms/capacitor/CapacitorDeepLinks.js.map +1 -0
- package/dist/platforms/capacitor/CapacitorPermissions.d.ts +29 -0
- package/dist/platforms/capacitor/CapacitorPermissions.js +1 -0
- package/dist/platforms/capacitor/CapacitorPermissions.js.map +1 -0
- package/dist/platforms/capacitor/CapacitorPush.d.ts +33 -0
- package/dist/platforms/capacitor/CapacitorPush.js +1 -0
- package/dist/platforms/capacitor/CapacitorPush.js.map +1 -0
- package/dist/platforms/capacitor/index.d.ts +24 -0
- package/dist/platforms/capacitor/index.js +1 -0
- package/dist/platforms/capacitor/index.js.map +1 -0
- package/dist/platforms/flutter/livechatta_client.dart +359 -0
- package/dist/platforms/flutter/livechatta_http_api.dart +1942 -0
- package/dist/platforms/flutter/livechatta_json.dart +57 -0
- package/dist/platforms/flutter/livechatta_models.dart +23531 -0
- package/dist/platforms/flutter/livechatta_sent_from.dart +35 -0
- package/dist/platforms/flutter/livechatta_socket_api.dart +1504 -0
- package/dist/platforms/flutter/livechatta_typed.dart +234 -0
- package/dist/platforms/flutter/livechatta_webview.dart +190 -0
- package/dist/platforms/ios/LiveChattaClient.swift +374 -0
- package/dist/platforms/ios/LiveChattaHttpAPI.swift +2431 -0
- package/dist/platforms/ios/LiveChattaJSON.swift +84 -0
- package/dist/platforms/ios/LiveChattaModels.swift +27050 -0
- package/dist/platforms/ios/LiveChattaSentFrom.swift +32 -0
- package/dist/platforms/ios/LiveChattaSocketAPI.swift +1446 -0
- package/dist/platforms/ios/LiveChattaTyped.swift +268 -0
- package/dist/platforms/ios/LiveChattaWebView.swift +191 -0
- package/dist/platforms/nuxt/LiveChattaView.d.ts +1 -0
- package/dist/platforms/nuxt/LiveChattaView.js +1 -0
- package/dist/platforms/nuxt/LiveChattaView.js.map +1 -0
- package/dist/platforms/nuxt/useChattaBridge.d.ts +9 -0
- package/dist/platforms/nuxt/useChattaBridge.js +1 -0
- package/dist/platforms/nuxt/useChattaBridge.js.map +1 -0
- package/dist/platforms/nuxt/useLiveChatta.d.ts +63 -0
- package/dist/platforms/nuxt/useLiveChatta.js +1 -0
- package/dist/platforms/nuxt/useLiveChatta.js.map +1 -0
- package/dist/platforms/react/LiveChattaView.d.ts +58 -0
- package/dist/platforms/react/LiveChattaView.js +1 -0
- package/dist/platforms/react/LiveChattaView.js.map +1 -0
- package/dist/platforms/react/useChattaBridge.d.ts +1 -0
- package/dist/platforms/react/useChattaBridge.js +1 -0
- package/dist/platforms/react/useChattaBridge.js.map +1 -0
- package/dist/platforms/react/useChattaDeepLink.d.ts +2 -0
- package/dist/platforms/react/useChattaDeepLink.js +1 -0
- package/dist/platforms/react/useChattaDeepLink.js.map +1 -0
- package/dist/platforms/react/useChattaPermissions.d.ts +9 -0
- package/dist/platforms/react/useChattaPermissions.js +1 -0
- package/dist/platforms/react/useChattaPermissions.js.map +1 -0
- package/dist/platforms/react/useChattaUnread.d.ts +1 -0
- package/dist/platforms/react/useChattaUnread.js +1 -0
- package/dist/platforms/react/useChattaUnread.js.map +1 -0
- package/dist/platforms/react/useLiveChatta.d.ts +29 -0
- package/dist/platforms/react/useLiveChatta.js +1 -0
- package/dist/platforms/react/useLiveChatta.js.map +1 -0
- package/dist/platforms/react-native/LiveChattaView.d.ts +52 -0
- package/dist/platforms/react-native/LiveChattaView.js +1 -0
- package/dist/platforms/react-native/LiveChattaView.js.map +1 -0
- package/dist/platforms/react-native/useChattaBridge.d.ts +12 -0
- package/dist/platforms/react-native/useChattaBridge.js +1 -0
- package/dist/platforms/react-native/useChattaBridge.js.map +1 -0
- package/dist/platforms/react-native/useLiveChatta.d.ts +29 -0
- package/dist/platforms/react-native/useLiveChatta.js +1 -0
- package/dist/platforms/react-native/useLiveChatta.js.map +1 -0
- package/dist/platforms/svelte/LiveChattaEmbed.d.ts +54 -0
- package/dist/platforms/svelte/LiveChattaEmbed.js +1 -0
- package/dist/platforms/svelte/LiveChattaEmbed.js.map +1 -0
- package/dist/platforms/svelte/chattaBridgeStore.d.ts +19 -0
- package/dist/platforms/svelte/chattaBridgeStore.js +1 -0
- package/dist/platforms/svelte/chattaBridgeStore.js.map +1 -0
- package/dist/platforms/svelte/useLiveChatta.d.ts +61 -0
- package/dist/platforms/svelte/useLiveChatta.js +1 -0
- package/dist/platforms/svelte/useLiveChatta.js.map +1 -0
- package/dist/platforms/tauri/TauriBridge.d.ts +34 -0
- package/dist/platforms/tauri/TauriBridge.js +1 -0
- package/dist/platforms/tauri/TauriBridge.js.map +1 -0
- package/dist/platforms/tauri/TauriDeepLinks.d.ts +29 -0
- package/dist/platforms/tauri/TauriDeepLinks.js +1 -0
- package/dist/platforms/tauri/TauriDeepLinks.js.map +1 -0
- package/dist/platforms/tauri/TauriPermissions.d.ts +21 -0
- package/dist/platforms/tauri/TauriPermissions.js +1 -0
- package/dist/platforms/tauri/TauriPermissions.js.map +1 -0
- package/dist/platforms/tauri/TauriUpdater.d.ts +31 -0
- package/dist/platforms/tauri/TauriUpdater.js +1 -0
- package/dist/platforms/tauri/TauriUpdater.js.map +1 -0
- package/dist/platforms/tauri/index.d.ts +22 -0
- package/dist/platforms/tauri/index.js +1 -0
- package/dist/platforms/tauri/index.js.map +1 -0
- package/dist/platforms/vue/LiveChattaView.d.ts +1 -0
- package/dist/platforms/vue/LiveChattaView.js +1 -0
- package/dist/platforms/vue/LiveChattaView.js.map +1 -0
- package/dist/platforms/vue/useChattaBridge.d.ts +11 -0
- package/dist/platforms/vue/useChattaBridge.js +1 -0
- package/dist/platforms/vue/useChattaBridge.js.map +1 -0
- package/dist/platforms/vue/useChattaDeepLink.d.ts +2 -0
- package/dist/platforms/vue/useChattaDeepLink.js +1 -0
- package/dist/platforms/vue/useChattaDeepLink.js.map +1 -0
- package/dist/platforms/vue/useChattaPermissions.d.ts +9 -0
- package/dist/platforms/vue/useChattaPermissions.js +1 -0
- package/dist/platforms/vue/useChattaPermissions.js.map +1 -0
- package/dist/platforms/vue/useChattaUnread.d.ts +8 -0
- package/dist/platforms/vue/useChattaUnread.js +1 -0
- package/dist/platforms/vue/useChattaUnread.js.map +1 -0
- package/dist/platforms/vue/useLiveChatta.d.ts +58 -0
- package/dist/platforms/vue/useLiveChatta.js +1 -0
- package/dist/platforms/vue/useLiveChatta.js.map +1 -0
- package/dist/platforms/web/LiveChattaEmbed.d.ts +94 -0
- package/dist/platforms/web/LiveChattaEmbed.js +1 -0
- package/dist/platforms/web/LiveChattaEmbed.js.map +1 -0
- package/dist/platforms/web/bridge.d.ts +8 -0
- package/dist/platforms/web/bridge.js +1 -0
- package/dist/platforms/web/bridge.js.map +1 -0
- package/dist/platforms/web/permissions.d.ts +8 -0
- package/dist/platforms/web/permissions.js +1 -0
- package/dist/platforms/web/permissions.js.map +1 -0
- package/dist/types/billing.d.ts +355 -0
- package/dist/types/billing.js +53 -0
- package/dist/types/billing.js.map +1 -0
- package/dist/types/calendar.d.ts +132 -0
- package/dist/types/calendar.js +15 -0
- package/dist/types/calendar.js.map +1 -0
- package/dist/types/chat-core.d.ts +901 -0
- package/dist/types/chat-core.js +98 -0
- package/dist/types/chat-core.js.map +1 -0
- package/dist/types/chat-features.d.ts +775 -0
- package/dist/types/chat-features.js +50 -0
- package/dist/types/chat-features.js.map +1 -0
- package/dist/types/content.d.ts +138 -0
- package/dist/types/content.js +2 -0
- package/dist/types/content.js.map +1 -0
- package/dist/types/core/AutoRefresh.d.ts +68 -0
- package/dist/types/core/Bridge.d.ts +124 -0
- package/dist/types/core/Config.d.ts +26 -0
- package/dist/types/core/DeepLinks.d.ts +38 -0
- package/dist/types/core/EventBus.d.ts +15 -0
- package/dist/types/core/GrantStore.d.ts +29 -0
- package/dist/types/core/LiveChatta.d.ts +128 -0
- package/dist/types/core/Permissions.d.ts +34 -0
- package/dist/types/core/TokenManager.d.ts +25 -0
- package/dist/types/core/events.d.ts +140 -0
- package/dist/types/csat.d.ts +110 -0
- package/dist/types/csat.js +12 -0
- package/dist/types/csat.js.map +1 -0
- package/dist/types/events.d.ts +242 -0
- package/dist/types/events.js +275 -0
- package/dist/types/events.js.map +1 -0
- package/dist/types/extras.d.ts +353 -0
- package/dist/types/extras.js +31 -0
- package/dist/types/extras.js.map +1 -0
- package/dist/types/http/HttpAPI.d.ts +944 -0
- package/dist/types/http/HttpTransport.d.ts +66 -0
- package/dist/types/http/incomingWebhook.d.ts +17 -0
- package/dist/types/incoming-webhooks.d.ts +78 -0
- package/dist/types/incoming-webhooks.js +16 -0
- package/dist/types/incoming-webhooks.js.map +1 -0
- package/dist/types/index.d.ts +15 -0
- package/dist/types/index.js +16 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/liveflex.d.ts +578 -0
- package/dist/types/liveflex.js +7 -0
- package/dist/types/liveflex.js.map +1 -0
- package/dist/types/models.d.ts +1753 -0
- package/dist/types/models.js +148 -0
- package/dist/types/models.js.map +1 -0
- package/dist/types/options.d.ts +190 -0
- package/dist/types/options.js +43 -0
- package/dist/types/options.js.map +1 -0
- package/dist/types/shared-channels.d.ts +236 -0
- package/dist/types/shared-channels.js +50 -0
- package/dist/types/shared-channels.js.map +1 -0
- package/dist/types/socket/SocketAPI.d.ts +1026 -0
- package/dist/types/socket/SocketTransport.d.ts +44 -0
- package/dist/types/types/billing.d.ts +355 -0
- package/dist/types/types/calendar.d.ts +132 -0
- package/dist/types/types/chat-core.d.ts +901 -0
- package/dist/types/types/chat-features.d.ts +775 -0
- package/dist/types/types/content.d.ts +138 -0
- package/dist/types/types/csat.d.ts +110 -0
- package/dist/types/types/events.d.ts +242 -0
- package/dist/types/types/extras.d.ts +353 -0
- package/dist/types/types/incoming-webhooks.d.ts +78 -0
- package/dist/types/types/index.d.ts +15 -0
- package/dist/types/types/liveflex.d.ts +578 -0
- package/dist/types/types/models.d.ts +1753 -0
- package/dist/types/types/options.d.ts +190 -0
- package/dist/types/types/shared-channels.d.ts +236 -0
- package/dist/types/types/workspace-gifs.d.ts +95 -0
- package/dist/types/types/workspace.d.ts +390 -0
- package/dist/types/ui/EmbedConfig.d.ts +38 -0
- package/dist/types/ui/EmbedUI.d.ts +44 -0
- package/dist/types/ui/Launcher.d.ts +122 -0
- package/dist/types/ui/brand.d.ts +27 -0
- package/dist/types/ui/embedMessages.d.ts +23 -0
- package/dist/types/ui/hours.d.ts +35 -0
- package/dist/types/ui/prechat.d.ts +35 -0
- package/dist/types/ui/widgetConfig.d.ts +4 -0
- package/dist/types/utils/crypto.d.ts +6 -0
- package/dist/types/utils/hmac.d.ts +40 -0
- package/dist/types/utils/permissions.d.ts +5 -0
- package/dist/types/utils/platform.d.ts +18 -0
- package/dist/types/utils/visitor.d.ts +2 -0
- package/dist/types/workspace-gifs.d.ts +95 -0
- package/dist/types/workspace-gifs.js +3 -0
- package/dist/types/workspace-gifs.js.map +1 -0
- package/dist/types/workspace.d.ts +390 -0
- package/dist/types/workspace.js +13 -0
- package/dist/types/workspace.js.map +1 -0
- package/dist/umd/livechatta.umd.js +7262 -0
- package/dist/umd/livechatta.umd.js.map +1 -0
- package/dist/umd/livechatta.umd.min.js +2 -0
- package/dist/umd/livechatta.umd.min.js.map +1 -0
- package/package.json +278 -4
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Config } from '../core/Config';
|
|
2
|
+
import type { TokenManager } from '../core/TokenManager';
|
|
3
|
+
import type { EventBus } from '../core/EventBus';
|
|
4
|
+
import type { HttpHeaders, HttpRequestOptions, QueryParams } from '../types/models';
|
|
5
|
+
/** Server `code` on a <500 error body; only UPPER_SNAKE values pass (same rule as the backend). */
|
|
6
|
+
export declare function serverErrorCode(body: unknown): string | undefined;
|
|
7
|
+
export declare class LiveChattaError extends Error {
|
|
8
|
+
readonly statusCode: number;
|
|
9
|
+
readonly code?: string | undefined;
|
|
10
|
+
/** Raw server error body when available (e.g. the socket `chat-error` body of a denied ack). */
|
|
11
|
+
readonly details?: unknown | undefined;
|
|
12
|
+
/** Set to `'socket'` on a denied socket ack; unset for HTTP errors. */
|
|
13
|
+
readonly transport?: "socket" | undefined;
|
|
14
|
+
constructor(message: string, statusCode: number, code?: string | undefined,
|
|
15
|
+
/** Raw server error body when available (e.g. the socket `chat-error` body of a denied ack). */
|
|
16
|
+
details?: unknown | undefined,
|
|
17
|
+
/** Set to `'socket'` on a denied socket ack; unset for HTTP errors. */
|
|
18
|
+
transport?: "socket" | undefined);
|
|
19
|
+
}
|
|
20
|
+
/** True for an error from a denied socket ack (`transport: 'socket'`; older builds had `code: 'SOCKET_ERROR'`). */
|
|
21
|
+
export declare function isSocketError(err: unknown): err is LiveChattaError;
|
|
22
|
+
export declare class HttpTransport {
|
|
23
|
+
private readonly config;
|
|
24
|
+
private readonly tokenManager?;
|
|
25
|
+
private readonly eventBus?;
|
|
26
|
+
private maxRetries;
|
|
27
|
+
private timeout;
|
|
28
|
+
private ownerToken;
|
|
29
|
+
private memberToken;
|
|
30
|
+
constructor(config: Config, tokenManager?: TokenManager | undefined, eventBus?: EventBus | undefined);
|
|
31
|
+
/** Chat-member token (JWT) used by member routes; null clears it. */
|
|
32
|
+
setMemberToken(token: string | null): void;
|
|
33
|
+
hasMemberToken(): boolean;
|
|
34
|
+
/** Bearer token for an auth mode, or null when it isn't configured. */
|
|
35
|
+
private bearerFor;
|
|
36
|
+
/** Owner account token (JWT) used only by owner-console calls; null clears it. */
|
|
37
|
+
setOwnerToken(token: string | null): void;
|
|
38
|
+
hasOwnerToken(): boolean;
|
|
39
|
+
private buildHeaders;
|
|
40
|
+
private baseFor;
|
|
41
|
+
private buildQueryString;
|
|
42
|
+
request<T = any>(method: string, path: string, options?: HttpRequestOptions): Promise<T>;
|
|
43
|
+
private _doRequest;
|
|
44
|
+
get<T = any>(path: string, query?: QueryParams): Promise<T>;
|
|
45
|
+
post<T = any>(path: string, body?: any, query?: QueryParams): Promise<T>;
|
|
46
|
+
put<T = any>(path: string, body?: any, query?: QueryParams): Promise<T>;
|
|
47
|
+
patch<T = any>(path: string, body?: any, query?: QueryParams): Promise<T>;
|
|
48
|
+
delete<T = any>(path: string, query?: QueryParams): Promise<T>;
|
|
49
|
+
/** Owner-console route under `/api/v1` with the Bearer owner token. */
|
|
50
|
+
owner<T = any>(method: string, path: string, options?: {
|
|
51
|
+
body?: unknown;
|
|
52
|
+
query?: QueryParams;
|
|
53
|
+
noRetry?: boolean;
|
|
54
|
+
headers?: HttpHeaders;
|
|
55
|
+
}): Promise<T>;
|
|
56
|
+
/** User route under `/api/v1`: 'member' = member token only, 'user' = member, else owner token. */
|
|
57
|
+
user<T = any>(method: string, path: string, options?: {
|
|
58
|
+
body?: unknown;
|
|
59
|
+
query?: QueryParams;
|
|
60
|
+
auth?: 'member' | 'user';
|
|
61
|
+
noRetry?: boolean;
|
|
62
|
+
}): Promise<T>;
|
|
63
|
+
/** Absolute URL under `/api/v1` (base 'api') or the site root, with a query string. No request is made. */
|
|
64
|
+
urlFor(base: 'api' | 'root', path: string, query?: QueryParams): string;
|
|
65
|
+
private log;
|
|
66
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IncomingWebhookMessagePayload } from '../types/incoming-webhooks';
|
|
2
|
+
export interface PostIncomingWebhookOptions {
|
|
3
|
+
/** Request timeout in milliseconds (default 15000). */
|
|
4
|
+
timeoutMs?: number;
|
|
5
|
+
/** Replace the global `fetch` (tests, proxies). */
|
|
6
|
+
fetch?: typeof fetch;
|
|
7
|
+
}
|
|
8
|
+
/** The URL chatta hands out: `https://<host>/hooks/in/lhk_<43 characters>`. Plain http only for a local server. */
|
|
9
|
+
export declare const INCOMING_WEBHOOK_URL_RE: RegExp;
|
|
10
|
+
/**
|
|
11
|
+
* POST a message to the secret URL of an incoming webhook. Resolves `{ ok: true }` on a 200.
|
|
12
|
+
* Never retried (a retry could post twice). Errors are a `LiveChattaError`: `code` is the server's (`RATE_LIMITED`,
|
|
13
|
+
* `CONVERSATION_LOCKED`, `NO_TEXT`, ...), and a 429 carries `details.retryAfter` in seconds. The URL is never put in an error.
|
|
14
|
+
*/
|
|
15
|
+
export declare function postIncomingWebhook(url: string, payload: IncomingWebhookMessagePayload | string, options?: PostIncomingWebhookOptions): Promise<{
|
|
16
|
+
ok: true;
|
|
17
|
+
}>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export type IncomingWebhookStatus = 'active' | 'revoked';
|
|
2
|
+
/** Limits the server enforces (it answers 400, 429 or 413 past them). */
|
|
3
|
+
export declare const INCOMING_WEBHOOK_LIMITS: {
|
|
4
|
+
readonly nameMax: 60;
|
|
5
|
+
readonly botNameMax: 40;
|
|
6
|
+
readonly textMax: 7500;
|
|
7
|
+
readonly iconUrlMax: 500;
|
|
8
|
+
readonly activePerConversation: 10;
|
|
9
|
+
readonly blocksMax: 20;
|
|
10
|
+
readonly attachmentsMax: 10;
|
|
11
|
+
readonly postsPerMinutePerUrl: 150;
|
|
12
|
+
readonly bodyMaxBytes: number;
|
|
13
|
+
readonly listPageSize: 20;
|
|
14
|
+
};
|
|
15
|
+
/** One hook. The secret and its hash are never returned; `url` is set only by create and regenerate, once. */
|
|
16
|
+
export interface IncomingWebhook {
|
|
17
|
+
id: string;
|
|
18
|
+
conversationId: string;
|
|
19
|
+
chatLinkId: string;
|
|
20
|
+
name: string;
|
|
21
|
+
/** The name shown on its posts (defaults to `name`). */
|
|
22
|
+
botName: string;
|
|
23
|
+
/** https picture shown on its posts, or an empty string. */
|
|
24
|
+
botAvatar: string;
|
|
25
|
+
status: IncomingWebhookStatus;
|
|
26
|
+
/** The last four characters of the secret, to tell hooks apart. */
|
|
27
|
+
tokenHint: string;
|
|
28
|
+
createdBy: string;
|
|
29
|
+
createdByName: string;
|
|
30
|
+
createdAt: string;
|
|
31
|
+
lastUsedAt: string | null;
|
|
32
|
+
/** Posts delivered. */
|
|
33
|
+
messageCount: number;
|
|
34
|
+
/** Posts refused (bad body, over a limit, locked or expired). */
|
|
35
|
+
rejectedCount: number;
|
|
36
|
+
revokedAt: string | null;
|
|
37
|
+
regeneratedAt: string | null;
|
|
38
|
+
/** The full secret URL (`https://<host>/hooks/in/lhk_...`). Present once: store it now. */
|
|
39
|
+
url?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface IncomingWebhookPage {
|
|
42
|
+
results: IncomingWebhook[];
|
|
43
|
+
nextCursor: string | null;
|
|
44
|
+
prevCursor: string | null;
|
|
45
|
+
hasMore: boolean;
|
|
46
|
+
hasPrev: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface IncomingWebhooksQuery {
|
|
49
|
+
/** Default `active`. */
|
|
50
|
+
status?: IncomingWebhookStatus | 'all';
|
|
51
|
+
nextCursor?: string;
|
|
52
|
+
/** 1 to 20. */
|
|
53
|
+
limit?: number;
|
|
54
|
+
}
|
|
55
|
+
export interface CreateIncomingWebhookPayload {
|
|
56
|
+
name: string;
|
|
57
|
+
/** Name shown on its posts; defaults to `name`. */
|
|
58
|
+
botName?: string;
|
|
59
|
+
/** https picture URL shown on its posts. */
|
|
60
|
+
botAvatar?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface UpdateIncomingWebhookPayload {
|
|
63
|
+
name?: string;
|
|
64
|
+
botName?: string;
|
|
65
|
+
botAvatar?: string;
|
|
66
|
+
}
|
|
67
|
+
/** Body of `POST /hooks/in/:token`. `text` is needed unless `blocks` or `attachments` carry some. */
|
|
68
|
+
export interface IncomingWebhookMessagePayload {
|
|
69
|
+
text?: string;
|
|
70
|
+
/** Name for this post only (40 characters). */
|
|
71
|
+
username?: string;
|
|
72
|
+
/** Picture for this post only (https). */
|
|
73
|
+
icon_url?: string;
|
|
74
|
+
/** A simple subset of Slack blocks (header, section, context, divider; up to 20). */
|
|
75
|
+
blocks?: Array<Record<string, unknown>>;
|
|
76
|
+
/** A simple subset of Slack attachments (title, title_link, text, fields, footer; up to 10). */
|
|
77
|
+
attachments?: Array<Record<string, unknown>>;
|
|
78
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Incoming webhooks: a secret URL per group or channel that posts a message as an app (chatta `POST /hooks/in/:token`).
|
|
2
|
+
// The management calls use the API key; the URL itself needs no credential.
|
|
3
|
+
/** Limits the server enforces (it answers 400, 429 or 413 past them). */
|
|
4
|
+
export const INCOMING_WEBHOOK_LIMITS = {
|
|
5
|
+
nameMax: 60,
|
|
6
|
+
botNameMax: 40,
|
|
7
|
+
textMax: 7500,
|
|
8
|
+
iconUrlMax: 500,
|
|
9
|
+
activePerConversation: 10,
|
|
10
|
+
blocksMax: 20,
|
|
11
|
+
attachmentsMax: 10,
|
|
12
|
+
postsPerMinutePerUrl: 150,
|
|
13
|
+
bodyMaxBytes: 64 * 1024,
|
|
14
|
+
listPageSize: 20,
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=incoming-webhooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"incoming-webhooks.js","sourceRoot":"","sources":["../../src/types/incoming-webhooks.ts"],"names":[],"mappings":"AAAA,wHAAwH;AACxH,4EAA4E;AAI5E,yEAAyE;AACzE,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,OAAO,EAAE,EAAE;IACX,UAAU,EAAE,EAAE;IACd,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,GAAG;IACf,qBAAqB,EAAE,EAAE;IACzB,SAAS,EAAE,EAAE;IACb,cAAc,EAAE,EAAE;IAClB,oBAAoB,EAAE,GAAG;IACzB,YAAY,EAAE,EAAE,GAAG,IAAI;IACvB,YAAY,EAAE,EAAE;CACR,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './events';
|
|
2
|
+
export * from './models';
|
|
3
|
+
export * from './options';
|
|
4
|
+
export * from './content';
|
|
5
|
+
export * from './chat-features';
|
|
6
|
+
export * from './chat-core';
|
|
7
|
+
export * from './workspace';
|
|
8
|
+
export * from './billing';
|
|
9
|
+
export * from './extras';
|
|
10
|
+
export * from './liveflex';
|
|
11
|
+
export * from './calendar';
|
|
12
|
+
export * from './workspace-gifs';
|
|
13
|
+
export * from './shared-channels';
|
|
14
|
+
export * from './incoming-webhooks';
|
|
15
|
+
export * from './csat';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from './events';
|
|
2
|
+
export * from './models';
|
|
3
|
+
export * from './options';
|
|
4
|
+
export * from './content';
|
|
5
|
+
export * from './chat-features';
|
|
6
|
+
export * from './chat-core';
|
|
7
|
+
export * from './workspace';
|
|
8
|
+
export * from './billing';
|
|
9
|
+
export * from './extras';
|
|
10
|
+
export * from './liveflex';
|
|
11
|
+
export * from './calendar';
|
|
12
|
+
export * from './workspace-gifs';
|
|
13
|
+
export * from './shared-channels';
|
|
14
|
+
export * from './incoming-webhooks';
|
|
15
|
+
export * from './csat';
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,QAAQ,CAAC"}
|