@botpress/webchat-client 0.1.1 → 0.2.0-beta.2
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 +485 -20
- package/dist/webchat-client.js +3 -2
- package/dist/webchat-client10.js +218 -0
- package/dist/webchat-client2.js +81 -54
- 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 +72 -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.2 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.75 kB[22m[1m[22m[2m │ gzip: 1.30 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 5038ms.
|
|
27
28
|
|
|
28
|
-
[32m✓ built in
|
|
29
|
+
[32m✓ built in 5.45s[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,17 @@ 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 & {
|
|
199
|
+
adminKey: string;
|
|
200
|
+
}) => Promise<ClientTypes_2.GenerateUserKeyResponse>;
|
|
136
201
|
};
|
|
137
202
|
|
|
138
203
|
declare type Client_2 = Client$1<RequestFn, Config, MethodFn, BuildUrlFn> & {
|
|
@@ -160,7 +225,9 @@ declare namespace ClientTypes_2 {
|
|
|
160
225
|
CreateMessageBody,
|
|
161
226
|
UpdateMessageBody,
|
|
162
227
|
SelectMessageBody,
|
|
228
|
+
AddMessageFeedbackBody,
|
|
163
229
|
CreateUserBody,
|
|
230
|
+
GenerateUserKeyBody,
|
|
164
231
|
UpdateUserBody,
|
|
165
232
|
CreateEventBody,
|
|
166
233
|
CreateFileBody,
|
|
@@ -239,6 +306,16 @@ declare namespace ClientTypes_2 {
|
|
|
239
306
|
SelectMessageError,
|
|
240
307
|
SelectMessageResponses,
|
|
241
308
|
SelectMessageResponse,
|
|
309
|
+
RemoveMessageFeedbackData,
|
|
310
|
+
RemoveMessageFeedbackErrors,
|
|
311
|
+
RemoveMessageFeedbackError,
|
|
312
|
+
RemoveMessageFeedbackResponses,
|
|
313
|
+
RemoveMessageFeedbackResponse,
|
|
314
|
+
AddMessageFeedbackData,
|
|
315
|
+
AddMessageFeedbackErrors,
|
|
316
|
+
AddMessageFeedbackError,
|
|
317
|
+
AddMessageFeedbackResponses,
|
|
318
|
+
AddMessageFeedbackResponse,
|
|
242
319
|
DeleteUserData,
|
|
243
320
|
DeleteUserErrors,
|
|
244
321
|
DeleteUserError,
|
|
@@ -259,6 +336,11 @@ declare namespace ClientTypes_2 {
|
|
|
259
336
|
CreateUserError,
|
|
260
337
|
CreateUserResponses,
|
|
261
338
|
CreateUserResponse,
|
|
339
|
+
GenerateUserKeyData,
|
|
340
|
+
GenerateUserKeyErrors,
|
|
341
|
+
GenerateUserKeyError,
|
|
342
|
+
GenerateUserKeyResponses,
|
|
343
|
+
GenerateUserKeyResponse,
|
|
262
344
|
GetEventData,
|
|
263
345
|
GetEventErrors,
|
|
264
346
|
GetEventError,
|
|
@@ -291,10 +373,13 @@ declare namespace ClientTypes_2 {
|
|
|
291
373
|
updateMessage,
|
|
292
374
|
createMessage,
|
|
293
375
|
selectMessage,
|
|
376
|
+
removeMessageFeedback,
|
|
377
|
+
addMessageFeedback,
|
|
294
378
|
deleteUser,
|
|
295
379
|
getUser,
|
|
296
380
|
updateUser,
|
|
297
381
|
createUser_2 as createUser,
|
|
382
|
+
generateUserKey_2 as generateUserKey,
|
|
298
383
|
getEvent,
|
|
299
384
|
createEvent,
|
|
300
385
|
createFile
|
|
@@ -750,9 +835,6 @@ export declare type CreateMessageBody = {
|
|
|
750
835
|
name: string;
|
|
751
836
|
data?: unknown;
|
|
752
837
|
type: 'custom';
|
|
753
|
-
} | {
|
|
754
|
-
reaction: string;
|
|
755
|
-
type: 'reaction';
|
|
756
838
|
};
|
|
757
839
|
/**
|
|
758
840
|
* ID of the [Conversation](#schema_conversation)
|
|
@@ -806,9 +888,10 @@ export declare type CreateMessageResponses = {
|
|
|
806
888
|
};
|
|
807
889
|
};
|
|
808
890
|
|
|
809
|
-
export declare const createUser: ({ clientId, apiUrl }: {
|
|
891
|
+
export declare const createUser: ({ clientId, apiUrl, adminKey, }: {
|
|
810
892
|
clientId: string;
|
|
811
893
|
apiUrl?: string;
|
|
894
|
+
adminKey?: string;
|
|
812
895
|
}) => Promise<{
|
|
813
896
|
user: ClientTypes_2.User;
|
|
814
897
|
key: string;
|
|
@@ -848,6 +931,12 @@ export declare type CreateUserData = {
|
|
|
848
931
|
* User data
|
|
849
932
|
*/
|
|
850
933
|
body?: CreateUserBody;
|
|
934
|
+
headers?: {
|
|
935
|
+
/**
|
|
936
|
+
* Admin Key for managing users
|
|
937
|
+
*/
|
|
938
|
+
'x-admin-key'?: string;
|
|
939
|
+
};
|
|
851
940
|
path?: never;
|
|
852
941
|
query?: never;
|
|
853
942
|
url: '/users';
|
|
@@ -966,7 +1055,7 @@ export declare type DeleteMessageError = DeleteMessageErrors[keyof DeleteMessage
|
|
|
966
1055
|
|
|
967
1056
|
export declare type DeleteMessageErrors = {
|
|
968
1057
|
/**
|
|
969
|
-
*
|
|
1058
|
+
* Empty object
|
|
970
1059
|
*/
|
|
971
1060
|
default: {
|
|
972
1061
|
[key: string]: never;
|
|
@@ -977,7 +1066,7 @@ export declare type DeleteMessageResponse = DeleteMessageResponses[keyof DeleteM
|
|
|
977
1066
|
|
|
978
1067
|
export declare type DeleteMessageResponses = {
|
|
979
1068
|
/**
|
|
980
|
-
*
|
|
1069
|
+
* Empty object
|
|
981
1070
|
*/
|
|
982
1071
|
200: {
|
|
983
1072
|
[key: string]: never;
|
|
@@ -1068,12 +1157,10 @@ declare type Event_3 = Signal | {
|
|
|
1068
1157
|
data: any;
|
|
1069
1158
|
};
|
|
1070
1159
|
|
|
1071
|
-
declare
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
emit<U extends keyof T>(event: U, arg?: T[U]): void;
|
|
1076
|
-
}
|
|
1160
|
+
declare type EventEmitter<T extends Record<string, unknown>> = {
|
|
1161
|
+
on: <U extends keyof T>(event: U, callback: CallbackFn<T[U]>) => () => void;
|
|
1162
|
+
emit: <U extends keyof T>(event: U, arg?: T[U]) => void;
|
|
1163
|
+
};
|
|
1077
1164
|
|
|
1078
1165
|
declare type EventIdParam = {
|
|
1079
1166
|
eventId: string;
|
|
@@ -1099,6 +1186,77 @@ declare type File_2 = {
|
|
|
1099
1186
|
};
|
|
1100
1187
|
export { File_2 as File }
|
|
1101
1188
|
|
|
1189
|
+
export declare const generateUserKey: ({ adminKey, expiresAt, userId, apiUrl, clientId, }: {
|
|
1190
|
+
adminKey: string;
|
|
1191
|
+
expiresAt: number;
|
|
1192
|
+
userId: string;
|
|
1193
|
+
apiUrl?: string;
|
|
1194
|
+
clientId: string;
|
|
1195
|
+
}) => Promise<{
|
|
1196
|
+
key: string;
|
|
1197
|
+
}>;
|
|
1198
|
+
|
|
1199
|
+
/**
|
|
1200
|
+
* Generates a new user authentication key. Can only be called by an administrator and when an admin key is configured.
|
|
1201
|
+
*/
|
|
1202
|
+
declare const generateUserKey_2: <ThrowOnError extends boolean = false>(options?: Options<GenerateUserKeyData, ThrowOnError>) => RequestResult<{
|
|
1203
|
+
key: string;
|
|
1204
|
+
}, {
|
|
1205
|
+
key: string;
|
|
1206
|
+
}, ThrowOnError>;
|
|
1207
|
+
|
|
1208
|
+
/**
|
|
1209
|
+
* User Key Data
|
|
1210
|
+
*/
|
|
1211
|
+
export declare type GenerateUserKeyBody = {
|
|
1212
|
+
/**
|
|
1213
|
+
* The ID of the user to generate a key for
|
|
1214
|
+
*/
|
|
1215
|
+
id: string;
|
|
1216
|
+
/**
|
|
1217
|
+
* The expiration date of the key in milliseconds since midnight, January 1, 1970 UTC. If not provided, the key will never expire.
|
|
1218
|
+
*/
|
|
1219
|
+
expiresAt?: number;
|
|
1220
|
+
};
|
|
1221
|
+
|
|
1222
|
+
export declare type GenerateUserKeyData = {
|
|
1223
|
+
/**
|
|
1224
|
+
* User Key Data
|
|
1225
|
+
*/
|
|
1226
|
+
body?: GenerateUserKeyBody;
|
|
1227
|
+
headers?: {
|
|
1228
|
+
/**
|
|
1229
|
+
* Admin Key for managing users
|
|
1230
|
+
*/
|
|
1231
|
+
'x-admin-key'?: string;
|
|
1232
|
+
};
|
|
1233
|
+
path?: never;
|
|
1234
|
+
query?: never;
|
|
1235
|
+
url: '/users/key';
|
|
1236
|
+
};
|
|
1237
|
+
|
|
1238
|
+
export declare type GenerateUserKeyError = GenerateUserKeyErrors[keyof GenerateUserKeyErrors];
|
|
1239
|
+
|
|
1240
|
+
export declare type GenerateUserKeyErrors = {
|
|
1241
|
+
/**
|
|
1242
|
+
* Returns a user key
|
|
1243
|
+
*/
|
|
1244
|
+
default: {
|
|
1245
|
+
key: string;
|
|
1246
|
+
};
|
|
1247
|
+
};
|
|
1248
|
+
|
|
1249
|
+
export declare type GenerateUserKeyResponse = GenerateUserKeyResponses[keyof GenerateUserKeyResponses];
|
|
1250
|
+
|
|
1251
|
+
export declare type GenerateUserKeyResponses = {
|
|
1252
|
+
/**
|
|
1253
|
+
* Returns a user key
|
|
1254
|
+
*/
|
|
1255
|
+
200: {
|
|
1256
|
+
key: string;
|
|
1257
|
+
};
|
|
1258
|
+
};
|
|
1259
|
+
|
|
1102
1260
|
/**
|
|
1103
1261
|
* Retrieves the [Conversation](#schema_conversation) object for a valid identifier.
|
|
1104
1262
|
*/
|
|
@@ -1343,6 +1501,13 @@ export declare type GetUserResponses = {
|
|
|
1343
1501
|
};
|
|
1344
1502
|
};
|
|
1345
1503
|
|
|
1504
|
+
export declare type IntegrationError = {
|
|
1505
|
+
id: string;
|
|
1506
|
+
code: number;
|
|
1507
|
+
type: string;
|
|
1508
|
+
message: string;
|
|
1509
|
+
};
|
|
1510
|
+
|
|
1346
1511
|
declare class Interceptors<Interceptor> {
|
|
1347
1512
|
_fns: Interceptor[];
|
|
1348
1513
|
constructor();
|
|
@@ -1773,9 +1938,6 @@ export declare type Message = {
|
|
|
1773
1938
|
name: string;
|
|
1774
1939
|
data?: unknown;
|
|
1775
1940
|
type: 'custom';
|
|
1776
|
-
} | {
|
|
1777
|
-
reaction: string;
|
|
1778
|
-
type: 'reaction';
|
|
1779
1941
|
};
|
|
1780
1942
|
/**
|
|
1781
1943
|
* ID of the [User](#schema_user)
|
|
@@ -1797,6 +1959,13 @@ export declare type Message = {
|
|
|
1797
1959
|
* ID of the user who selected this message. Undefined if not selected.
|
|
1798
1960
|
*/
|
|
1799
1961
|
selectedBy?: string;
|
|
1962
|
+
/**
|
|
1963
|
+
* Feedback of the message
|
|
1964
|
+
*/
|
|
1965
|
+
feedback?: {
|
|
1966
|
+
value: 'positive' | 'negative';
|
|
1967
|
+
comment?: string;
|
|
1968
|
+
};
|
|
1800
1969
|
};
|
|
1801
1970
|
|
|
1802
1971
|
declare type MessageCreated = {
|
|
@@ -1984,6 +2153,205 @@ declare type MessageIdParam = {
|
|
|
1984
2153
|
messageId: string;
|
|
1985
2154
|
};
|
|
1986
2155
|
|
|
2156
|
+
declare type MessageStatusChanged = {
|
|
2157
|
+
type: 'message_status_changed';
|
|
2158
|
+
data: {
|
|
2159
|
+
/**
|
|
2160
|
+
* The Message object represents a message in a [Conversation](#schema_conversation) for a specific [User](#schema_user).
|
|
2161
|
+
*/
|
|
2162
|
+
message: {
|
|
2163
|
+
/**
|
|
2164
|
+
* Id of the [Message](#schema_message)
|
|
2165
|
+
*/
|
|
2166
|
+
id: string;
|
|
2167
|
+
/**
|
|
2168
|
+
* Creation date of the [Message](#schema_message) in ISO 8601 format
|
|
2169
|
+
*/
|
|
2170
|
+
createdAt: string;
|
|
2171
|
+
/**
|
|
2172
|
+
* Payload is the content of the message.
|
|
2173
|
+
*/
|
|
2174
|
+
payload: {
|
|
2175
|
+
audioUrl: string;
|
|
2176
|
+
type: 'audio';
|
|
2177
|
+
[k: string]: any;
|
|
2178
|
+
} | {
|
|
2179
|
+
title: string;
|
|
2180
|
+
subtitle?: string;
|
|
2181
|
+
imageUrl?: string;
|
|
2182
|
+
actions: {
|
|
2183
|
+
action: 'postback' | 'url' | 'say';
|
|
2184
|
+
label: string;
|
|
2185
|
+
value: string;
|
|
2186
|
+
[k: string]: any;
|
|
2187
|
+
}[];
|
|
2188
|
+
type: 'card';
|
|
2189
|
+
[k: string]: any;
|
|
2190
|
+
} | {
|
|
2191
|
+
items: {
|
|
2192
|
+
title: string;
|
|
2193
|
+
subtitle?: string;
|
|
2194
|
+
imageUrl?: string;
|
|
2195
|
+
actions: {
|
|
2196
|
+
action: 'postback' | 'url' | 'say';
|
|
2197
|
+
label: string;
|
|
2198
|
+
value: string;
|
|
2199
|
+
[k: string]: any;
|
|
2200
|
+
}[];
|
|
2201
|
+
[k: string]: any;
|
|
2202
|
+
}[];
|
|
2203
|
+
type: 'carousel';
|
|
2204
|
+
[k: string]: any;
|
|
2205
|
+
} | {
|
|
2206
|
+
text: string;
|
|
2207
|
+
options: {
|
|
2208
|
+
label: string;
|
|
2209
|
+
value: string;
|
|
2210
|
+
[k: string]: any;
|
|
2211
|
+
}[];
|
|
2212
|
+
disableFreeText?: boolean;
|
|
2213
|
+
type: 'choice';
|
|
2214
|
+
[k: string]: any;
|
|
2215
|
+
} | {
|
|
2216
|
+
text: string;
|
|
2217
|
+
options: {
|
|
2218
|
+
label: string;
|
|
2219
|
+
value: string;
|
|
2220
|
+
[k: string]: any;
|
|
2221
|
+
}[];
|
|
2222
|
+
disableFreeText?: boolean;
|
|
2223
|
+
type: 'dropdown';
|
|
2224
|
+
[k: string]: any;
|
|
2225
|
+
} | {
|
|
2226
|
+
fileUrl: string;
|
|
2227
|
+
title?: string;
|
|
2228
|
+
type: 'file';
|
|
2229
|
+
[k: string]: any;
|
|
2230
|
+
} | {
|
|
2231
|
+
imageUrl: string;
|
|
2232
|
+
type: 'image';
|
|
2233
|
+
[k: string]: any;
|
|
2234
|
+
} | {
|
|
2235
|
+
latitude: number;
|
|
2236
|
+
longitude: number;
|
|
2237
|
+
address?: string;
|
|
2238
|
+
title?: string;
|
|
2239
|
+
type: 'location';
|
|
2240
|
+
[k: string]: any;
|
|
2241
|
+
} | {
|
|
2242
|
+
text: string;
|
|
2243
|
+
value?: string;
|
|
2244
|
+
type: 'text';
|
|
2245
|
+
[k: string]: any;
|
|
2246
|
+
} | {
|
|
2247
|
+
videoUrl: string;
|
|
2248
|
+
type: 'video';
|
|
2249
|
+
[k: string]: any;
|
|
2250
|
+
} | {
|
|
2251
|
+
items: ({
|
|
2252
|
+
type: 'text';
|
|
2253
|
+
payload: {
|
|
2254
|
+
text: string;
|
|
2255
|
+
value?: string;
|
|
2256
|
+
[k: string]: any;
|
|
2257
|
+
};
|
|
2258
|
+
[k: string]: any;
|
|
2259
|
+
} | {
|
|
2260
|
+
type: 'markdown';
|
|
2261
|
+
payload: {
|
|
2262
|
+
markdown: string;
|
|
2263
|
+
[k: string]: any;
|
|
2264
|
+
};
|
|
2265
|
+
[k: string]: any;
|
|
2266
|
+
} | {
|
|
2267
|
+
type: 'image';
|
|
2268
|
+
payload: {
|
|
2269
|
+
imageUrl: string;
|
|
2270
|
+
[k: string]: any;
|
|
2271
|
+
};
|
|
2272
|
+
[k: string]: any;
|
|
2273
|
+
} | {
|
|
2274
|
+
type: 'audio';
|
|
2275
|
+
payload: {
|
|
2276
|
+
audioUrl: string;
|
|
2277
|
+
[k: string]: any;
|
|
2278
|
+
};
|
|
2279
|
+
[k: string]: any;
|
|
2280
|
+
} | {
|
|
2281
|
+
type: 'video';
|
|
2282
|
+
payload: {
|
|
2283
|
+
videoUrl: string;
|
|
2284
|
+
[k: string]: any;
|
|
2285
|
+
};
|
|
2286
|
+
[k: string]: any;
|
|
2287
|
+
} | {
|
|
2288
|
+
type: 'file';
|
|
2289
|
+
payload: {
|
|
2290
|
+
fileUrl: string;
|
|
2291
|
+
title?: string;
|
|
2292
|
+
[k: string]: any;
|
|
2293
|
+
};
|
|
2294
|
+
[k: string]: any;
|
|
2295
|
+
} | {
|
|
2296
|
+
type: 'location';
|
|
2297
|
+
payload: {
|
|
2298
|
+
latitude: number;
|
|
2299
|
+
longitude: number;
|
|
2300
|
+
address?: string;
|
|
2301
|
+
title?: string;
|
|
2302
|
+
[k: string]: any;
|
|
2303
|
+
};
|
|
2304
|
+
[k: string]: any;
|
|
2305
|
+
})[];
|
|
2306
|
+
type: 'bloc';
|
|
2307
|
+
[k: string]: any;
|
|
2308
|
+
} | {
|
|
2309
|
+
markdown: string;
|
|
2310
|
+
type: 'markdown';
|
|
2311
|
+
[k: string]: any;
|
|
2312
|
+
} | {
|
|
2313
|
+
url: string;
|
|
2314
|
+
name: string;
|
|
2315
|
+
data?: any;
|
|
2316
|
+
type: 'custom';
|
|
2317
|
+
[k: string]: any;
|
|
2318
|
+
};
|
|
2319
|
+
/**
|
|
2320
|
+
* ID of the [User](#schema_user)
|
|
2321
|
+
*/
|
|
2322
|
+
userId: string;
|
|
2323
|
+
/**
|
|
2324
|
+
* ID of the [Conversation](#schema_conversation)
|
|
2325
|
+
*/
|
|
2326
|
+
conversationId: string;
|
|
2327
|
+
/**
|
|
2328
|
+
* Metadata of the message
|
|
2329
|
+
*/
|
|
2330
|
+
metadata?: {
|
|
2331
|
+
[k: string]: any;
|
|
2332
|
+
};
|
|
2333
|
+
/**
|
|
2334
|
+
* ID of the message this message is replying to
|
|
2335
|
+
*/
|
|
2336
|
+
replyTo?: string;
|
|
2337
|
+
/**
|
|
2338
|
+
* ID of the user who selected this message. Undefined if not selected.
|
|
2339
|
+
*/
|
|
2340
|
+
selectedBy?: string;
|
|
2341
|
+
/**
|
|
2342
|
+
* Feedback of the message
|
|
2343
|
+
*/
|
|
2344
|
+
feedback?: {
|
|
2345
|
+
value: 'positive' | 'negative';
|
|
2346
|
+
comment?: string;
|
|
2347
|
+
};
|
|
2348
|
+
};
|
|
2349
|
+
oldStatus?: 'scheduled' | 'pending' | 'processing' | 'processed' | 'failed' | 'skipped';
|
|
2350
|
+
newStatus: 'scheduled' | 'pending' | 'processing' | 'processed' | 'failed' | 'skipped';
|
|
2351
|
+
failureReason?: string;
|
|
2352
|
+
};
|
|
2353
|
+
};
|
|
2354
|
+
|
|
1987
2355
|
declare type MessageUpdated = {
|
|
1988
2356
|
type: 'message_updated';
|
|
1989
2357
|
/**
|
|
@@ -2197,6 +2565,52 @@ declare type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
|
|
|
2197
2565
|
|
|
2198
2566
|
declare type Options_2<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = OmitKeys<RequestOptions<ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & Omit<TData, 'url'>;
|
|
2199
2567
|
|
|
2568
|
+
declare type ParticipantAdded = {
|
|
2569
|
+
type: 'participant_added';
|
|
2570
|
+
data: {
|
|
2571
|
+
conversationId: string;
|
|
2572
|
+
/**
|
|
2573
|
+
* 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.
|
|
2574
|
+
*/
|
|
2575
|
+
participant: {
|
|
2576
|
+
/**
|
|
2577
|
+
* Name of the [User](#schema_user)
|
|
2578
|
+
*/
|
|
2579
|
+
name?: string;
|
|
2580
|
+
/**
|
|
2581
|
+
* Picture url of the [User](#schema_user)
|
|
2582
|
+
*/
|
|
2583
|
+
pictureUrl?: string;
|
|
2584
|
+
/**
|
|
2585
|
+
* User data
|
|
2586
|
+
*/
|
|
2587
|
+
data?: {
|
|
2588
|
+
[k: string]: any;
|
|
2589
|
+
};
|
|
2590
|
+
/**
|
|
2591
|
+
* Id of the [User](#schema_user)
|
|
2592
|
+
*/
|
|
2593
|
+
id: string;
|
|
2594
|
+
/**
|
|
2595
|
+
* Creation date of the [User](#schema_user) in ISO 8601 format
|
|
2596
|
+
*/
|
|
2597
|
+
createdAt: string;
|
|
2598
|
+
/**
|
|
2599
|
+
* Updating date of the [User](#schema_user) in ISO 8601 format
|
|
2600
|
+
*/
|
|
2601
|
+
updatedAt: string;
|
|
2602
|
+
};
|
|
2603
|
+
};
|
|
2604
|
+
};
|
|
2605
|
+
|
|
2606
|
+
declare type ParticipantRemoved = {
|
|
2607
|
+
type: 'participant_removed';
|
|
2608
|
+
data: {
|
|
2609
|
+
conversationId: string;
|
|
2610
|
+
participantId: string;
|
|
2611
|
+
};
|
|
2612
|
+
};
|
|
2613
|
+
|
|
2200
2614
|
declare type QuerySerializer = (query: Record<string, unknown>) => string;
|
|
2201
2615
|
|
|
2202
2616
|
declare interface QuerySerializerOptions {
|
|
@@ -2205,6 +2619,55 @@ declare interface QuerySerializerOptions {
|
|
|
2205
2619
|
object?: SerializerOptions<ObjectStyle>;
|
|
2206
2620
|
}
|
|
2207
2621
|
|
|
2622
|
+
/**
|
|
2623
|
+
* Removes feedback from a [Message](#schema_message).
|
|
2624
|
+
*/
|
|
2625
|
+
declare const removeMessageFeedback: <ThrowOnError extends boolean = false>(options: Options<RemoveMessageFeedbackData, ThrowOnError>) => RequestResult<{
|
|
2626
|
+
[key: string]: never;
|
|
2627
|
+
}, {
|
|
2628
|
+
[key: string]: never;
|
|
2629
|
+
}, ThrowOnError>;
|
|
2630
|
+
|
|
2631
|
+
export declare type RemoveMessageFeedbackData = {
|
|
2632
|
+
body?: never;
|
|
2633
|
+
headers: {
|
|
2634
|
+
/**
|
|
2635
|
+
* Authentication Key
|
|
2636
|
+
*/
|
|
2637
|
+
'x-user-key': string;
|
|
2638
|
+
};
|
|
2639
|
+
path: {
|
|
2640
|
+
/**
|
|
2641
|
+
* Message id
|
|
2642
|
+
*/
|
|
2643
|
+
id: string;
|
|
2644
|
+
};
|
|
2645
|
+
query?: never;
|
|
2646
|
+
url: '/messages/{id}/feedback';
|
|
2647
|
+
};
|
|
2648
|
+
|
|
2649
|
+
export declare type RemoveMessageFeedbackError = RemoveMessageFeedbackErrors[keyof RemoveMessageFeedbackErrors];
|
|
2650
|
+
|
|
2651
|
+
export declare type RemoveMessageFeedbackErrors = {
|
|
2652
|
+
/**
|
|
2653
|
+
* Empty object
|
|
2654
|
+
*/
|
|
2655
|
+
default: {
|
|
2656
|
+
[key: string]: never;
|
|
2657
|
+
};
|
|
2658
|
+
};
|
|
2659
|
+
|
|
2660
|
+
export declare type RemoveMessageFeedbackResponse = RemoveMessageFeedbackResponses[keyof RemoveMessageFeedbackResponses];
|
|
2661
|
+
|
|
2662
|
+
export declare type RemoveMessageFeedbackResponses = {
|
|
2663
|
+
/**
|
|
2664
|
+
* Empty object
|
|
2665
|
+
*/
|
|
2666
|
+
200: {
|
|
2667
|
+
[key: string]: never;
|
|
2668
|
+
};
|
|
2669
|
+
};
|
|
2670
|
+
|
|
2208
2671
|
/**
|
|
2209
2672
|
* Remove a [Participant](#schema_user) from a [Conversation](#schema_conversation).
|
|
2210
2673
|
*/
|
|
@@ -2364,7 +2827,7 @@ declare interface SerializerOptions<T> {
|
|
|
2364
2827
|
style: T;
|
|
2365
2828
|
}
|
|
2366
2829
|
|
|
2367
|
-
declare type Signal = MessageCreated | MessageUpdated | WebchatVisibility | WebchatConfig | Custom | TypingStarted | TypingStopped;
|
|
2830
|
+
declare type Signal = MessageCreated | MessageUpdated | WebchatVisibility | WebchatConfig | Custom | TypingStarted | TypingStopped | ParticipantAdded | ParticipantRemoved | MessageStatusChanged;
|
|
2368
2831
|
|
|
2369
2832
|
declare interface TDataShape {
|
|
2370
2833
|
body?: unknown;
|
|
@@ -2514,9 +2977,6 @@ export declare type UpdateMessageBody = {
|
|
|
2514
2977
|
name: string;
|
|
2515
2978
|
data?: unknown;
|
|
2516
2979
|
type: 'custom';
|
|
2517
|
-
} | {
|
|
2518
|
-
reaction: string;
|
|
2519
|
-
type: 'reaction';
|
|
2520
2980
|
};
|
|
2521
2981
|
/**
|
|
2522
2982
|
* Metadata of the message
|
|
@@ -2662,6 +3122,11 @@ export declare type User = {
|
|
|
2662
3122
|
updatedAt: string;
|
|
2663
3123
|
};
|
|
2664
3124
|
|
|
3125
|
+
export declare type UserCredentials = {
|
|
3126
|
+
userId: string;
|
|
3127
|
+
userToken: string;
|
|
3128
|
+
};
|
|
3129
|
+
|
|
2665
3130
|
declare type UserIdParam = {
|
|
2666
3131
|
userId: string;
|
|
2667
3132
|
};
|