@botpress/webchat-client 0.1.1 → 0.2.0-beta.1
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/.turbo/turbo-build.log +14 -13
- package/dist/index.d.ts +483 -20
- package/dist/webchat-client.js +3 -2
- package/dist/webchat-client10.js +218 -0
- package/dist/webchat-client2.js +91 -59
- package/dist/webchat-client3.js +48 -28
- package/dist/webchat-client4.js +2 -2
- package/dist/webchat-client5.js +1 -1
- package/dist/webchat-client6.js +8 -19
- package/dist/webchat-client7.js +14 -9
- package/dist/webchat-client8.js +9 -103
- package/dist/webchat-client9.js +88 -201
- package/package.json +2 -2
- package/src/client/client.ts +77 -7
- package/src/client/emitter.ts +27 -0
- package/src/client/index.ts +2 -0
- package/src/client/interceptor.ts +16 -0
- package/src/client/types/error.ts +8 -0
- package/src/client/types/index.ts +2 -0
- package/src/client/types/signals/index.ts +6 -0
- package/src/client/types/signals/messageStatusChanged.ts +219 -0
- package/src/client/types/signals/participantAdded.ts +37 -0
- package/src/client/types/signals/participantRemoved.ts +7 -0
- package/src/client/types/user.ts +4 -0
- package/src/index.ts +8 -1
- package/src/client/eventEmitter.ts +0 -36
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
|
|
2
|
-
> @botpress/webchat-client@0.
|
|
2
|
+
> @botpress/webchat-client@0.2.0-beta.1 build /home/runner/work/genisys/genisys/packages/webchat-client
|
|
3
3
|
> openapi-ts && vite build
|
|
4
4
|
|
|
5
5
|
⏳ Generating from raw OpenAPI specification
|
|
6
6
|
🚀 Done! Your output is in ./src/gen/client
|
|
7
7
|
[36mvite v5.4.10 [32mbuilding for production...[36m[39m
|
|
8
8
|
transforming...
|
|
9
|
-
[32m✓[39m
|
|
9
|
+
[32m✓[39m 17 modules transformed.
|
|
10
10
|
rendering chunks...
|
|
11
11
|
|
|
12
12
|
[vite:dts] Start generate declaration files...
|
|
13
13
|
computing gzip size...
|
|
14
|
-
[2mdist/[22m[36mwebchat-client.js
|
|
15
|
-
[2mdist/[22m[36mwebchat-
|
|
16
|
-
[2mdist/[22m[36mwebchat-client4.js
|
|
17
|
-
[2mdist/[22m[36mwebchat-client6.js
|
|
18
|
-
[2mdist/[22m[36mwebchat-
|
|
19
|
-
[2mdist/[22m[36mwebchat-
|
|
20
|
-
[2mdist/[22m[36mwebchat-
|
|
21
|
-
[2mdist/[22m[36mwebchat-
|
|
22
|
-
[2mdist/[22m[36mwebchat-
|
|
14
|
+
[2mdist/[22m[36mwebchat-client.js [39m[1m[2m 0.17 kB[22m[1m[22m[2m │ gzip: 0.13 kB[22m
|
|
15
|
+
[2mdist/[22m[36mwebchat-client8.js [39m[1m[2m 0.19 kB[22m[1m[22m[2m │ gzip: 0.16 kB[22m
|
|
16
|
+
[2mdist/[22m[36mwebchat-client4.js [39m[1m[2m 0.29 kB[22m[1m[22m[2m │ gzip: 0.18 kB[22m
|
|
17
|
+
[2mdist/[22m[36mwebchat-client6.js [39m[1m[2m 0.30 kB[22m[1m[22m[2m │ gzip: 0.22 kB[22m
|
|
18
|
+
[2mdist/[22m[36mwebchat-client7.js [39m[1m[2m 0.45 kB[22m[1m[22m[2m │ gzip: 0.26 kB[22m
|
|
19
|
+
[2mdist/[22m[36mwebchat-client9.js [39m[1m[2m 2.63 kB[22m[1m[22m[2m │ gzip: 1.15 kB[22m
|
|
20
|
+
[2mdist/[22m[36mwebchat-client3.js [39m[1m[2m 3.30 kB[22m[1m[22m[2m │ gzip: 0.58 kB[22m
|
|
21
|
+
[2mdist/[22m[36mwebchat-client2.js [39m[1m[2m 4.89 kB[22m[1m[22m[2m │ gzip: 1.36 kB[22m
|
|
22
|
+
[2mdist/[22m[36mwebchat-client10.js [39m[1m[2m 8.58 kB[22m[1m[22m[2m │ gzip: 2.91 kB[22m
|
|
23
|
+
[2mdist/[22m[36mwebchat-client5.js [39m[1m[2m10.93 kB[22m[1m[22m[2m │ gzip: 3.47 kB[22m
|
|
23
24
|
[vite:dts] Start rollup declaration files...
|
|
24
25
|
Analysis will use the bundled TypeScript version 5.4.2
|
|
25
26
|
*** The target project appears to use TypeScript 5.6.2 which is newer than the bundled compiler engine; consider upgrading API Extractor.
|
|
26
|
-
[vite:dts] Declaration files built in
|
|
27
|
+
[vite:dts] Declaration files built in 5685ms.
|
|
27
28
|
|
|
28
|
-
[32m✓ built in 6.
|
|
29
|
+
[32m✓ built in 6.04s[39m
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adds feedback to a [Message](#schema_message).
|
|
3
|
+
*/
|
|
4
|
+
declare const addMessageFeedback: <ThrowOnError extends boolean = false>(options: Options<AddMessageFeedbackData, ThrowOnError>) => RequestResult<{
|
|
5
|
+
[key: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[key: string]: never;
|
|
8
|
+
}, ThrowOnError>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Message data
|
|
12
|
+
*/
|
|
13
|
+
export declare type AddMessageFeedbackBody = {
|
|
14
|
+
value: 'positive' | 'negative';
|
|
15
|
+
comment?: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export declare type AddMessageFeedbackData = {
|
|
19
|
+
/**
|
|
20
|
+
* Message data
|
|
21
|
+
*/
|
|
22
|
+
body?: AddMessageFeedbackBody;
|
|
23
|
+
headers: {
|
|
24
|
+
/**
|
|
25
|
+
* Authentication Key
|
|
26
|
+
*/
|
|
27
|
+
'x-user-key': string;
|
|
28
|
+
};
|
|
29
|
+
path: {
|
|
30
|
+
/**
|
|
31
|
+
* Message id
|
|
32
|
+
*/
|
|
33
|
+
id: string;
|
|
34
|
+
};
|
|
35
|
+
query?: never;
|
|
36
|
+
url: '/messages/{id}/feedback';
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export declare type AddMessageFeedbackError = AddMessageFeedbackErrors[keyof AddMessageFeedbackErrors];
|
|
40
|
+
|
|
41
|
+
export declare type AddMessageFeedbackErrors = {
|
|
42
|
+
/**
|
|
43
|
+
* Empty object
|
|
44
|
+
*/
|
|
45
|
+
default: {
|
|
46
|
+
[key: string]: never;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export declare type AddMessageFeedbackResponse = AddMessageFeedbackResponses[keyof AddMessageFeedbackResponses];
|
|
51
|
+
|
|
52
|
+
export declare type AddMessageFeedbackResponses = {
|
|
53
|
+
/**
|
|
54
|
+
* Empty object
|
|
55
|
+
*/
|
|
56
|
+
200: {
|
|
57
|
+
[key: string]: never;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
|
|
1
61
|
/**
|
|
2
62
|
* Add a [Participant](#schema_user) to a [Conversation](#schema_conversation).
|
|
3
63
|
*/
|
|
@@ -127,12 +187,15 @@ export declare type Client = {
|
|
|
127
187
|
deleteMessage: (params: MessageIdParam) => Promise<ClientTypes_2.DeleteMessageResponse>;
|
|
128
188
|
createFile: (params: ClientTypes_2.CreateFileBody) => Promise<ClientTypes_2.CreateFileResponse>;
|
|
129
189
|
createUser: (params: ClientTypes_2.CreateUserBody) => Promise<ClientTypes_2.CreateUserResponse>;
|
|
130
|
-
getUser: (
|
|
190
|
+
getUser: () => Promise<ClientTypes_2.GetUserResponse>;
|
|
131
191
|
updateUser: (params: ClientTypes_2.CreateUserBody) => Promise<ClientTypes_2.UpdateUserResponse>;
|
|
132
192
|
deleteUser: (params: UserIdParam) => Promise<ClientTypes_2.DeleteUserResponse>;
|
|
133
193
|
createEvent: (params: ClientTypes_2.CreateEventBody) => Promise<ClientTypes_2.CreateEventResponse>;
|
|
134
194
|
getEvent: (params: EventIdParam) => Promise<ClientTypes_2.GetEventResponse>;
|
|
135
195
|
listenConversation: (params: ConversationIdParam) => EventEmitter<Record<Event_3['type'], Event_3['data']>>['on'];
|
|
196
|
+
addMessageFeedback: (params: MessageIdParam & ClientTypes_2.AddMessageFeedbackBody) => Promise<ClientTypes_2.AddMessageFeedbackResponse>;
|
|
197
|
+
removeMessageFeedback: (params: MessageIdParam) => Promise<ClientTypes_2.RemoveMessageFeedbackResponse>;
|
|
198
|
+
generateUserKey: (params: ClientTypes_2.GenerateUserKeyBody, adminKey?: string) => Promise<ClientTypes_2.GenerateUserKeyResponse>;
|
|
136
199
|
};
|
|
137
200
|
|
|
138
201
|
declare type Client_2 = Client$1<RequestFn, Config, MethodFn, BuildUrlFn> & {
|
|
@@ -160,7 +223,9 @@ declare namespace ClientTypes_2 {
|
|
|
160
223
|
CreateMessageBody,
|
|
161
224
|
UpdateMessageBody,
|
|
162
225
|
SelectMessageBody,
|
|
226
|
+
AddMessageFeedbackBody,
|
|
163
227
|
CreateUserBody,
|
|
228
|
+
GenerateUserKeyBody,
|
|
164
229
|
UpdateUserBody,
|
|
165
230
|
CreateEventBody,
|
|
166
231
|
CreateFileBody,
|
|
@@ -239,6 +304,16 @@ declare namespace ClientTypes_2 {
|
|
|
239
304
|
SelectMessageError,
|
|
240
305
|
SelectMessageResponses,
|
|
241
306
|
SelectMessageResponse,
|
|
307
|
+
RemoveMessageFeedbackData,
|
|
308
|
+
RemoveMessageFeedbackErrors,
|
|
309
|
+
RemoveMessageFeedbackError,
|
|
310
|
+
RemoveMessageFeedbackResponses,
|
|
311
|
+
RemoveMessageFeedbackResponse,
|
|
312
|
+
AddMessageFeedbackData,
|
|
313
|
+
AddMessageFeedbackErrors,
|
|
314
|
+
AddMessageFeedbackError,
|
|
315
|
+
AddMessageFeedbackResponses,
|
|
316
|
+
AddMessageFeedbackResponse,
|
|
242
317
|
DeleteUserData,
|
|
243
318
|
DeleteUserErrors,
|
|
244
319
|
DeleteUserError,
|
|
@@ -259,6 +334,11 @@ declare namespace ClientTypes_2 {
|
|
|
259
334
|
CreateUserError,
|
|
260
335
|
CreateUserResponses,
|
|
261
336
|
CreateUserResponse,
|
|
337
|
+
GenerateUserKeyData,
|
|
338
|
+
GenerateUserKeyErrors,
|
|
339
|
+
GenerateUserKeyError,
|
|
340
|
+
GenerateUserKeyResponses,
|
|
341
|
+
GenerateUserKeyResponse,
|
|
262
342
|
GetEventData,
|
|
263
343
|
GetEventErrors,
|
|
264
344
|
GetEventError,
|
|
@@ -291,10 +371,13 @@ declare namespace ClientTypes_2 {
|
|
|
291
371
|
updateMessage,
|
|
292
372
|
createMessage,
|
|
293
373
|
selectMessage,
|
|
374
|
+
removeMessageFeedback,
|
|
375
|
+
addMessageFeedback,
|
|
294
376
|
deleteUser,
|
|
295
377
|
getUser,
|
|
296
378
|
updateUser,
|
|
297
379
|
createUser_2 as createUser,
|
|
380
|
+
generateUserKey_2 as generateUserKey,
|
|
298
381
|
getEvent,
|
|
299
382
|
createEvent,
|
|
300
383
|
createFile
|
|
@@ -750,9 +833,6 @@ export declare type CreateMessageBody = {
|
|
|
750
833
|
name: string;
|
|
751
834
|
data?: unknown;
|
|
752
835
|
type: 'custom';
|
|
753
|
-
} | {
|
|
754
|
-
reaction: string;
|
|
755
|
-
type: 'reaction';
|
|
756
836
|
};
|
|
757
837
|
/**
|
|
758
838
|
* ID of the [Conversation](#schema_conversation)
|
|
@@ -806,9 +886,10 @@ export declare type CreateMessageResponses = {
|
|
|
806
886
|
};
|
|
807
887
|
};
|
|
808
888
|
|
|
809
|
-
export declare const createUser: ({ clientId, apiUrl }: {
|
|
889
|
+
export declare const createUser: ({ clientId, apiUrl, adminKey, }: {
|
|
810
890
|
clientId: string;
|
|
811
891
|
apiUrl?: string;
|
|
892
|
+
adminKey?: string;
|
|
812
893
|
}) => Promise<{
|
|
813
894
|
user: ClientTypes_2.User;
|
|
814
895
|
key: string;
|
|
@@ -848,6 +929,12 @@ export declare type CreateUserData = {
|
|
|
848
929
|
* User data
|
|
849
930
|
*/
|
|
850
931
|
body?: CreateUserBody;
|
|
932
|
+
headers?: {
|
|
933
|
+
/**
|
|
934
|
+
* Admin Key for managing users
|
|
935
|
+
*/
|
|
936
|
+
'x-admin-key'?: string;
|
|
937
|
+
};
|
|
851
938
|
path?: never;
|
|
852
939
|
query?: never;
|
|
853
940
|
url: '/users';
|
|
@@ -966,7 +1053,7 @@ export declare type DeleteMessageError = DeleteMessageErrors[keyof DeleteMessage
|
|
|
966
1053
|
|
|
967
1054
|
export declare type DeleteMessageErrors = {
|
|
968
1055
|
/**
|
|
969
|
-
*
|
|
1056
|
+
* Empty object
|
|
970
1057
|
*/
|
|
971
1058
|
default: {
|
|
972
1059
|
[key: string]: never;
|
|
@@ -977,7 +1064,7 @@ export declare type DeleteMessageResponse = DeleteMessageResponses[keyof DeleteM
|
|
|
977
1064
|
|
|
978
1065
|
export declare type DeleteMessageResponses = {
|
|
979
1066
|
/**
|
|
980
|
-
*
|
|
1067
|
+
* Empty object
|
|
981
1068
|
*/
|
|
982
1069
|
200: {
|
|
983
1070
|
[key: string]: never;
|
|
@@ -1068,12 +1155,10 @@ declare type Event_3 = Signal | {
|
|
|
1068
1155
|
data: any;
|
|
1069
1156
|
};
|
|
1070
1157
|
|
|
1071
|
-
declare
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
emit<U extends keyof T>(event: U, arg?: T[U]): void;
|
|
1076
|
-
}
|
|
1158
|
+
declare type EventEmitter<T extends Record<string, unknown>> = {
|
|
1159
|
+
on: <U extends keyof T>(event: U, callback: CallbackFn<T[U]>) => () => void;
|
|
1160
|
+
emit: <U extends keyof T>(event: U, arg?: T[U]) => void;
|
|
1161
|
+
};
|
|
1077
1162
|
|
|
1078
1163
|
declare type EventIdParam = {
|
|
1079
1164
|
eventId: string;
|
|
@@ -1099,6 +1184,77 @@ declare type File_2 = {
|
|
|
1099
1184
|
};
|
|
1100
1185
|
export { File_2 as File }
|
|
1101
1186
|
|
|
1187
|
+
export declare const generateUserKey: ({ adminKey, expiresAt, userId, apiUrl, clientId, }: {
|
|
1188
|
+
adminKey: string;
|
|
1189
|
+
expiresAt: number;
|
|
1190
|
+
userId: string;
|
|
1191
|
+
apiUrl?: string;
|
|
1192
|
+
clientId: string;
|
|
1193
|
+
}) => Promise<{
|
|
1194
|
+
key: string;
|
|
1195
|
+
}>;
|
|
1196
|
+
|
|
1197
|
+
/**
|
|
1198
|
+
* Generates a new user authentication key. Can only be called by an administrator and when an admin key is configured.
|
|
1199
|
+
*/
|
|
1200
|
+
declare const generateUserKey_2: <ThrowOnError extends boolean = false>(options?: Options<GenerateUserKeyData, ThrowOnError>) => RequestResult<{
|
|
1201
|
+
key: string;
|
|
1202
|
+
}, {
|
|
1203
|
+
key: string;
|
|
1204
|
+
}, ThrowOnError>;
|
|
1205
|
+
|
|
1206
|
+
/**
|
|
1207
|
+
* User Key Data
|
|
1208
|
+
*/
|
|
1209
|
+
export declare type GenerateUserKeyBody = {
|
|
1210
|
+
/**
|
|
1211
|
+
* The ID of the user to generate a key for
|
|
1212
|
+
*/
|
|
1213
|
+
id: string;
|
|
1214
|
+
/**
|
|
1215
|
+
* The expiration date of the key in milliseconds since midnight, January 1, 1970 UTC. If not provided, the key will never expire.
|
|
1216
|
+
*/
|
|
1217
|
+
expiresAt?: number;
|
|
1218
|
+
};
|
|
1219
|
+
|
|
1220
|
+
export declare type GenerateUserKeyData = {
|
|
1221
|
+
/**
|
|
1222
|
+
* User Key Data
|
|
1223
|
+
*/
|
|
1224
|
+
body?: GenerateUserKeyBody;
|
|
1225
|
+
headers?: {
|
|
1226
|
+
/**
|
|
1227
|
+
* Admin Key for managing users
|
|
1228
|
+
*/
|
|
1229
|
+
'x-admin-key'?: string;
|
|
1230
|
+
};
|
|
1231
|
+
path?: never;
|
|
1232
|
+
query?: never;
|
|
1233
|
+
url: '/users/key';
|
|
1234
|
+
};
|
|
1235
|
+
|
|
1236
|
+
export declare type GenerateUserKeyError = GenerateUserKeyErrors[keyof GenerateUserKeyErrors];
|
|
1237
|
+
|
|
1238
|
+
export declare type GenerateUserKeyErrors = {
|
|
1239
|
+
/**
|
|
1240
|
+
* Returns a user key
|
|
1241
|
+
*/
|
|
1242
|
+
default: {
|
|
1243
|
+
key: string;
|
|
1244
|
+
};
|
|
1245
|
+
};
|
|
1246
|
+
|
|
1247
|
+
export declare type GenerateUserKeyResponse = GenerateUserKeyResponses[keyof GenerateUserKeyResponses];
|
|
1248
|
+
|
|
1249
|
+
export declare type GenerateUserKeyResponses = {
|
|
1250
|
+
/**
|
|
1251
|
+
* Returns a user key
|
|
1252
|
+
*/
|
|
1253
|
+
200: {
|
|
1254
|
+
key: string;
|
|
1255
|
+
};
|
|
1256
|
+
};
|
|
1257
|
+
|
|
1102
1258
|
/**
|
|
1103
1259
|
* Retrieves the [Conversation](#schema_conversation) object for a valid identifier.
|
|
1104
1260
|
*/
|
|
@@ -1343,6 +1499,13 @@ export declare type GetUserResponses = {
|
|
|
1343
1499
|
};
|
|
1344
1500
|
};
|
|
1345
1501
|
|
|
1502
|
+
export declare type IntegrationError = {
|
|
1503
|
+
id: string;
|
|
1504
|
+
code: number;
|
|
1505
|
+
type: string;
|
|
1506
|
+
message: string;
|
|
1507
|
+
};
|
|
1508
|
+
|
|
1346
1509
|
declare class Interceptors<Interceptor> {
|
|
1347
1510
|
_fns: Interceptor[];
|
|
1348
1511
|
constructor();
|
|
@@ -1773,9 +1936,6 @@ export declare type Message = {
|
|
|
1773
1936
|
name: string;
|
|
1774
1937
|
data?: unknown;
|
|
1775
1938
|
type: 'custom';
|
|
1776
|
-
} | {
|
|
1777
|
-
reaction: string;
|
|
1778
|
-
type: 'reaction';
|
|
1779
1939
|
};
|
|
1780
1940
|
/**
|
|
1781
1941
|
* ID of the [User](#schema_user)
|
|
@@ -1797,6 +1957,13 @@ export declare type Message = {
|
|
|
1797
1957
|
* ID of the user who selected this message. Undefined if not selected.
|
|
1798
1958
|
*/
|
|
1799
1959
|
selectedBy?: string;
|
|
1960
|
+
/**
|
|
1961
|
+
* Feedback of the message
|
|
1962
|
+
*/
|
|
1963
|
+
feedback?: {
|
|
1964
|
+
value: 'positive' | 'negative';
|
|
1965
|
+
comment?: string;
|
|
1966
|
+
};
|
|
1800
1967
|
};
|
|
1801
1968
|
|
|
1802
1969
|
declare type MessageCreated = {
|
|
@@ -1984,6 +2151,205 @@ declare type MessageIdParam = {
|
|
|
1984
2151
|
messageId: string;
|
|
1985
2152
|
};
|
|
1986
2153
|
|
|
2154
|
+
declare type MessageStatusChanged = {
|
|
2155
|
+
type: 'message_status_changed';
|
|
2156
|
+
data: {
|
|
2157
|
+
/**
|
|
2158
|
+
* The Message object represents a message in a [Conversation](#schema_conversation) for a specific [User](#schema_user).
|
|
2159
|
+
*/
|
|
2160
|
+
message: {
|
|
2161
|
+
/**
|
|
2162
|
+
* Id of the [Message](#schema_message)
|
|
2163
|
+
*/
|
|
2164
|
+
id: string;
|
|
2165
|
+
/**
|
|
2166
|
+
* Creation date of the [Message](#schema_message) in ISO 8601 format
|
|
2167
|
+
*/
|
|
2168
|
+
createdAt: string;
|
|
2169
|
+
/**
|
|
2170
|
+
* Payload is the content of the message.
|
|
2171
|
+
*/
|
|
2172
|
+
payload: {
|
|
2173
|
+
audioUrl: string;
|
|
2174
|
+
type: 'audio';
|
|
2175
|
+
[k: string]: any;
|
|
2176
|
+
} | {
|
|
2177
|
+
title: string;
|
|
2178
|
+
subtitle?: string;
|
|
2179
|
+
imageUrl?: string;
|
|
2180
|
+
actions: {
|
|
2181
|
+
action: 'postback' | 'url' | 'say';
|
|
2182
|
+
label: string;
|
|
2183
|
+
value: string;
|
|
2184
|
+
[k: string]: any;
|
|
2185
|
+
}[];
|
|
2186
|
+
type: 'card';
|
|
2187
|
+
[k: string]: any;
|
|
2188
|
+
} | {
|
|
2189
|
+
items: {
|
|
2190
|
+
title: string;
|
|
2191
|
+
subtitle?: string;
|
|
2192
|
+
imageUrl?: string;
|
|
2193
|
+
actions: {
|
|
2194
|
+
action: 'postback' | 'url' | 'say';
|
|
2195
|
+
label: string;
|
|
2196
|
+
value: string;
|
|
2197
|
+
[k: string]: any;
|
|
2198
|
+
}[];
|
|
2199
|
+
[k: string]: any;
|
|
2200
|
+
}[];
|
|
2201
|
+
type: 'carousel';
|
|
2202
|
+
[k: string]: any;
|
|
2203
|
+
} | {
|
|
2204
|
+
text: string;
|
|
2205
|
+
options: {
|
|
2206
|
+
label: string;
|
|
2207
|
+
value: string;
|
|
2208
|
+
[k: string]: any;
|
|
2209
|
+
}[];
|
|
2210
|
+
disableFreeText?: boolean;
|
|
2211
|
+
type: 'choice';
|
|
2212
|
+
[k: string]: any;
|
|
2213
|
+
} | {
|
|
2214
|
+
text: string;
|
|
2215
|
+
options: {
|
|
2216
|
+
label: string;
|
|
2217
|
+
value: string;
|
|
2218
|
+
[k: string]: any;
|
|
2219
|
+
}[];
|
|
2220
|
+
disableFreeText?: boolean;
|
|
2221
|
+
type: 'dropdown';
|
|
2222
|
+
[k: string]: any;
|
|
2223
|
+
} | {
|
|
2224
|
+
fileUrl: string;
|
|
2225
|
+
title?: string;
|
|
2226
|
+
type: 'file';
|
|
2227
|
+
[k: string]: any;
|
|
2228
|
+
} | {
|
|
2229
|
+
imageUrl: string;
|
|
2230
|
+
type: 'image';
|
|
2231
|
+
[k: string]: any;
|
|
2232
|
+
} | {
|
|
2233
|
+
latitude: number;
|
|
2234
|
+
longitude: number;
|
|
2235
|
+
address?: string;
|
|
2236
|
+
title?: string;
|
|
2237
|
+
type: 'location';
|
|
2238
|
+
[k: string]: any;
|
|
2239
|
+
} | {
|
|
2240
|
+
text: string;
|
|
2241
|
+
value?: string;
|
|
2242
|
+
type: 'text';
|
|
2243
|
+
[k: string]: any;
|
|
2244
|
+
} | {
|
|
2245
|
+
videoUrl: string;
|
|
2246
|
+
type: 'video';
|
|
2247
|
+
[k: string]: any;
|
|
2248
|
+
} | {
|
|
2249
|
+
items: ({
|
|
2250
|
+
type: 'text';
|
|
2251
|
+
payload: {
|
|
2252
|
+
text: string;
|
|
2253
|
+
value?: string;
|
|
2254
|
+
[k: string]: any;
|
|
2255
|
+
};
|
|
2256
|
+
[k: string]: any;
|
|
2257
|
+
} | {
|
|
2258
|
+
type: 'markdown';
|
|
2259
|
+
payload: {
|
|
2260
|
+
markdown: string;
|
|
2261
|
+
[k: string]: any;
|
|
2262
|
+
};
|
|
2263
|
+
[k: string]: any;
|
|
2264
|
+
} | {
|
|
2265
|
+
type: 'image';
|
|
2266
|
+
payload: {
|
|
2267
|
+
imageUrl: string;
|
|
2268
|
+
[k: string]: any;
|
|
2269
|
+
};
|
|
2270
|
+
[k: string]: any;
|
|
2271
|
+
} | {
|
|
2272
|
+
type: 'audio';
|
|
2273
|
+
payload: {
|
|
2274
|
+
audioUrl: string;
|
|
2275
|
+
[k: string]: any;
|
|
2276
|
+
};
|
|
2277
|
+
[k: string]: any;
|
|
2278
|
+
} | {
|
|
2279
|
+
type: 'video';
|
|
2280
|
+
payload: {
|
|
2281
|
+
videoUrl: string;
|
|
2282
|
+
[k: string]: any;
|
|
2283
|
+
};
|
|
2284
|
+
[k: string]: any;
|
|
2285
|
+
} | {
|
|
2286
|
+
type: 'file';
|
|
2287
|
+
payload: {
|
|
2288
|
+
fileUrl: string;
|
|
2289
|
+
title?: string;
|
|
2290
|
+
[k: string]: any;
|
|
2291
|
+
};
|
|
2292
|
+
[k: string]: any;
|
|
2293
|
+
} | {
|
|
2294
|
+
type: 'location';
|
|
2295
|
+
payload: {
|
|
2296
|
+
latitude: number;
|
|
2297
|
+
longitude: number;
|
|
2298
|
+
address?: string;
|
|
2299
|
+
title?: string;
|
|
2300
|
+
[k: string]: any;
|
|
2301
|
+
};
|
|
2302
|
+
[k: string]: any;
|
|
2303
|
+
})[];
|
|
2304
|
+
type: 'bloc';
|
|
2305
|
+
[k: string]: any;
|
|
2306
|
+
} | {
|
|
2307
|
+
markdown: string;
|
|
2308
|
+
type: 'markdown';
|
|
2309
|
+
[k: string]: any;
|
|
2310
|
+
} | {
|
|
2311
|
+
url: string;
|
|
2312
|
+
name: string;
|
|
2313
|
+
data?: any;
|
|
2314
|
+
type: 'custom';
|
|
2315
|
+
[k: string]: any;
|
|
2316
|
+
};
|
|
2317
|
+
/**
|
|
2318
|
+
* ID of the [User](#schema_user)
|
|
2319
|
+
*/
|
|
2320
|
+
userId: string;
|
|
2321
|
+
/**
|
|
2322
|
+
* ID of the [Conversation](#schema_conversation)
|
|
2323
|
+
*/
|
|
2324
|
+
conversationId: string;
|
|
2325
|
+
/**
|
|
2326
|
+
* Metadata of the message
|
|
2327
|
+
*/
|
|
2328
|
+
metadata?: {
|
|
2329
|
+
[k: string]: any;
|
|
2330
|
+
};
|
|
2331
|
+
/**
|
|
2332
|
+
* ID of the message this message is replying to
|
|
2333
|
+
*/
|
|
2334
|
+
replyTo?: string;
|
|
2335
|
+
/**
|
|
2336
|
+
* ID of the user who selected this message. Undefined if not selected.
|
|
2337
|
+
*/
|
|
2338
|
+
selectedBy?: string;
|
|
2339
|
+
/**
|
|
2340
|
+
* Feedback of the message
|
|
2341
|
+
*/
|
|
2342
|
+
feedback?: {
|
|
2343
|
+
value: 'positive' | 'negative';
|
|
2344
|
+
comment?: string;
|
|
2345
|
+
};
|
|
2346
|
+
};
|
|
2347
|
+
oldStatus?: 'scheduled' | 'pending' | 'processing' | 'processed' | 'failed' | 'skipped';
|
|
2348
|
+
newStatus: 'scheduled' | 'pending' | 'processing' | 'processed' | 'failed' | 'skipped';
|
|
2349
|
+
failureReason?: string;
|
|
2350
|
+
};
|
|
2351
|
+
};
|
|
2352
|
+
|
|
1987
2353
|
declare type MessageUpdated = {
|
|
1988
2354
|
type: 'message_updated';
|
|
1989
2355
|
/**
|
|
@@ -2197,6 +2563,52 @@ declare type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
|
|
|
2197
2563
|
|
|
2198
2564
|
declare type Options_2<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = OmitKeys<RequestOptions<ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & Omit<TData, 'url'>;
|
|
2199
2565
|
|
|
2566
|
+
declare type ParticipantAdded = {
|
|
2567
|
+
type: 'participant_added';
|
|
2568
|
+
data: {
|
|
2569
|
+
conversationId: string;
|
|
2570
|
+
/**
|
|
2571
|
+
* The user object represents someone interacting with the bot within a specific integration. The same person interacting with a bot in slack and messenger will be represented with two different users.
|
|
2572
|
+
*/
|
|
2573
|
+
participant: {
|
|
2574
|
+
/**
|
|
2575
|
+
* Name of the [User](#schema_user)
|
|
2576
|
+
*/
|
|
2577
|
+
name?: string;
|
|
2578
|
+
/**
|
|
2579
|
+
* Picture url of the [User](#schema_user)
|
|
2580
|
+
*/
|
|
2581
|
+
pictureUrl?: string;
|
|
2582
|
+
/**
|
|
2583
|
+
* User data
|
|
2584
|
+
*/
|
|
2585
|
+
data?: {
|
|
2586
|
+
[k: string]: any;
|
|
2587
|
+
};
|
|
2588
|
+
/**
|
|
2589
|
+
* Id of the [User](#schema_user)
|
|
2590
|
+
*/
|
|
2591
|
+
id: string;
|
|
2592
|
+
/**
|
|
2593
|
+
* Creation date of the [User](#schema_user) in ISO 8601 format
|
|
2594
|
+
*/
|
|
2595
|
+
createdAt: string;
|
|
2596
|
+
/**
|
|
2597
|
+
* Updating date of the [User](#schema_user) in ISO 8601 format
|
|
2598
|
+
*/
|
|
2599
|
+
updatedAt: string;
|
|
2600
|
+
};
|
|
2601
|
+
};
|
|
2602
|
+
};
|
|
2603
|
+
|
|
2604
|
+
declare type ParticipantRemoved = {
|
|
2605
|
+
type: 'participant_removed';
|
|
2606
|
+
data: {
|
|
2607
|
+
conversationId: string;
|
|
2608
|
+
participantId: string;
|
|
2609
|
+
};
|
|
2610
|
+
};
|
|
2611
|
+
|
|
2200
2612
|
declare type QuerySerializer = (query: Record<string, unknown>) => string;
|
|
2201
2613
|
|
|
2202
2614
|
declare interface QuerySerializerOptions {
|
|
@@ -2205,6 +2617,55 @@ declare interface QuerySerializerOptions {
|
|
|
2205
2617
|
object?: SerializerOptions<ObjectStyle>;
|
|
2206
2618
|
}
|
|
2207
2619
|
|
|
2620
|
+
/**
|
|
2621
|
+
* Removes feedback from a [Message](#schema_message).
|
|
2622
|
+
*/
|
|
2623
|
+
declare const removeMessageFeedback: <ThrowOnError extends boolean = false>(options: Options<RemoveMessageFeedbackData, ThrowOnError>) => RequestResult<{
|
|
2624
|
+
[key: string]: never;
|
|
2625
|
+
}, {
|
|
2626
|
+
[key: string]: never;
|
|
2627
|
+
}, ThrowOnError>;
|
|
2628
|
+
|
|
2629
|
+
export declare type RemoveMessageFeedbackData = {
|
|
2630
|
+
body?: never;
|
|
2631
|
+
headers: {
|
|
2632
|
+
/**
|
|
2633
|
+
* Authentication Key
|
|
2634
|
+
*/
|
|
2635
|
+
'x-user-key': string;
|
|
2636
|
+
};
|
|
2637
|
+
path: {
|
|
2638
|
+
/**
|
|
2639
|
+
* Message id
|
|
2640
|
+
*/
|
|
2641
|
+
id: string;
|
|
2642
|
+
};
|
|
2643
|
+
query?: never;
|
|
2644
|
+
url: '/messages/{id}/feedback';
|
|
2645
|
+
};
|
|
2646
|
+
|
|
2647
|
+
export declare type RemoveMessageFeedbackError = RemoveMessageFeedbackErrors[keyof RemoveMessageFeedbackErrors];
|
|
2648
|
+
|
|
2649
|
+
export declare type RemoveMessageFeedbackErrors = {
|
|
2650
|
+
/**
|
|
2651
|
+
* Empty object
|
|
2652
|
+
*/
|
|
2653
|
+
default: {
|
|
2654
|
+
[key: string]: never;
|
|
2655
|
+
};
|
|
2656
|
+
};
|
|
2657
|
+
|
|
2658
|
+
export declare type RemoveMessageFeedbackResponse = RemoveMessageFeedbackResponses[keyof RemoveMessageFeedbackResponses];
|
|
2659
|
+
|
|
2660
|
+
export declare type RemoveMessageFeedbackResponses = {
|
|
2661
|
+
/**
|
|
2662
|
+
* Empty object
|
|
2663
|
+
*/
|
|
2664
|
+
200: {
|
|
2665
|
+
[key: string]: never;
|
|
2666
|
+
};
|
|
2667
|
+
};
|
|
2668
|
+
|
|
2208
2669
|
/**
|
|
2209
2670
|
* Remove a [Participant](#schema_user) from a [Conversation](#schema_conversation).
|
|
2210
2671
|
*/
|
|
@@ -2364,7 +2825,7 @@ declare interface SerializerOptions<T> {
|
|
|
2364
2825
|
style: T;
|
|
2365
2826
|
}
|
|
2366
2827
|
|
|
2367
|
-
declare type Signal = MessageCreated | MessageUpdated | WebchatVisibility | WebchatConfig | Custom | TypingStarted | TypingStopped;
|
|
2828
|
+
declare type Signal = MessageCreated | MessageUpdated | WebchatVisibility | WebchatConfig | Custom | TypingStarted | TypingStopped | ParticipantAdded | ParticipantRemoved | MessageStatusChanged;
|
|
2368
2829
|
|
|
2369
2830
|
declare interface TDataShape {
|
|
2370
2831
|
body?: unknown;
|
|
@@ -2514,9 +2975,6 @@ export declare type UpdateMessageBody = {
|
|
|
2514
2975
|
name: string;
|
|
2515
2976
|
data?: unknown;
|
|
2516
2977
|
type: 'custom';
|
|
2517
|
-
} | {
|
|
2518
|
-
reaction: string;
|
|
2519
|
-
type: 'reaction';
|
|
2520
2978
|
};
|
|
2521
2979
|
/**
|
|
2522
2980
|
* Metadata of the message
|
|
@@ -2662,6 +3120,11 @@ export declare type User = {
|
|
|
2662
3120
|
updatedAt: string;
|
|
2663
3121
|
};
|
|
2664
3122
|
|
|
3123
|
+
export declare type UserCredentials = {
|
|
3124
|
+
userId: string;
|
|
3125
|
+
userToken: string;
|
|
3126
|
+
};
|
|
3127
|
+
|
|
2665
3128
|
declare type UserIdParam = {
|
|
2666
3129
|
userId: string;
|
|
2667
3130
|
};
|