@botpress/webchat-client 0.4.0 → 0.6.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/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Adds feedback to a [Message](#schema_message).
3
3
  */
4
- declare const addMessageFeedback: <ThrowOnError extends boolean = false>(options: Options<AddMessageFeedbackData, ThrowOnError>) => RequestResult<{
5
- [key: string]: never;
4
+ declare const addMessageFeedback: <ThrowOnError extends boolean = false>(options: Options<AddMessageFeedbackData, ThrowOnError>) => RequestResult< {
5
+ [key: string]: never;
6
6
  }, {
7
- [key: string]: never;
7
+ [key: string]: never;
8
8
  }, ThrowOnError>;
9
9
 
10
10
  /**
@@ -61,10 +61,10 @@ export declare type AddMessageFeedbackResponses = {
61
61
  /**
62
62
  * Add a [Participant](#schema_user) to a [Conversation](#schema_conversation).
63
63
  */
64
- declare const addParticipant: <ThrowOnError extends boolean = false>(options: Options<AddParticipantData, ThrowOnError>) => RequestResult<{
65
- participant: User;
64
+ declare const addParticipant: <ThrowOnError extends boolean = false>(options: Options<AddParticipantData, ThrowOnError>) => RequestResult< {
65
+ participant: User;
66
66
  }, {
67
- participant: User;
67
+ participant: User;
68
68
  }, ThrowOnError>;
69
69
 
70
70
  /**
@@ -187,7 +187,7 @@ export declare type Client = {
187
187
  deleteMessage: (params: MessageIdParam) => Promise<ClientTypes_2.DeleteMessageResponse>;
188
188
  createFile: (params: ClientTypes_2.CreateFileBody) => Promise<ClientTypes_2.CreateFileResponse>;
189
189
  getUser: () => Promise<ClientTypes_2.GetUserResponse>;
190
- updateUser: (params: ClientTypes_2.CreateUserBody) => Promise<ClientTypes_2.UpdateUserResponse>;
190
+ updateUser: (params: ClientTypes_2.UpdateUserBody) => Promise<ClientTypes_2.UpdateUserResponse>;
191
191
  deleteUser: (params: UserIdParam) => Promise<ClientTypes_2.DeleteUserResponse>;
192
192
  createEvent: (params: ClientTypes_2.CreateEventBody) => Promise<ClientTypes_2.CreateEventResponse>;
193
193
  getEvent: (params: EventIdParam) => Promise<ClientTypes_2.GetEventResponse>;
@@ -513,6 +513,7 @@ export declare type Conversation = {
513
513
  */
514
514
  payload: {
515
515
  audioUrl: string;
516
+ fileId?: string;
516
517
  type: 'audio';
517
518
  } | {
518
519
  title: string;
@@ -555,9 +556,11 @@ export declare type Conversation = {
555
556
  } | {
556
557
  fileUrl: string;
557
558
  title?: string;
559
+ fileId?: string;
558
560
  type: 'file';
559
561
  } | {
560
562
  imageUrl: string;
563
+ fileId?: string;
561
564
  type: 'image';
562
565
  } | {
563
566
  latitude: number;
@@ -571,6 +574,7 @@ export declare type Conversation = {
571
574
  type: 'text';
572
575
  } | {
573
576
  videoUrl: string;
577
+ fileId?: string;
574
578
  type: 'video';
575
579
  } | {
576
580
  items: Array<{
@@ -588,22 +592,26 @@ export declare type Conversation = {
588
592
  type: 'image';
589
593
  payload: {
590
594
  imageUrl: string;
595
+ fileId?: string;
591
596
  };
592
597
  } | {
593
598
  type: 'audio';
594
599
  payload: {
595
600
  audioUrl: string;
601
+ fileId?: string;
596
602
  };
597
603
  } | {
598
604
  type: 'video';
599
605
  payload: {
600
606
  videoUrl: string;
607
+ fileId?: string;
601
608
  };
602
609
  } | {
603
610
  type: 'file';
604
611
  payload: {
605
612
  fileUrl: string;
606
613
  title?: string;
614
+ fileId?: string;
607
615
  };
608
616
  } | {
609
617
  type: 'location';
@@ -658,20 +666,26 @@ declare type ConversationIdParam = {
658
666
  conversationId: string;
659
667
  };
660
668
 
661
- export declare const createClient: ({ userKey, clientId, apiUrl, customHeaders, }: {
669
+ export declare const createClient: ({ userKey, clientId, apiUrl, customHeaders, advancedOptions, }: {
662
670
  userKey: string;
663
671
  clientId: string;
664
672
  apiUrl?: string;
665
673
  customHeaders?: Record<string, string>;
674
+ advancedOptions?: {
675
+ eventSource?: (params: {
676
+ url: string;
677
+ headers: Record<string, string>;
678
+ }) => EventSourceLike;
679
+ };
666
680
  }) => Client;
667
681
 
668
682
  /**
669
683
  * Creates a new [Conversation](#schema_conversation)
670
684
  */
671
- declare const createConversation: <ThrowOnError extends boolean = false>(options: Options<CreateConversationData, ThrowOnError>) => RequestResult<{
672
- conversation: Conversation;
685
+ declare const createConversation: <ThrowOnError extends boolean = false>(options: Options<CreateConversationData, ThrowOnError>) => RequestResult< {
686
+ conversation: Conversation;
673
687
  }, {
674
- conversation: Conversation;
688
+ conversation: Conversation;
675
689
  }, ThrowOnError>;
676
690
 
677
691
  /**
@@ -722,10 +736,10 @@ export declare type CreateConversationResponses = {
722
736
  /**
723
737
  * Creates a new [Event](#schema_event)
724
738
  */
725
- declare const createEvent: <ThrowOnError extends boolean = false>(options: Options<CreateEventData, ThrowOnError>) => RequestResult<{
726
- event: Event_2;
739
+ declare const createEvent: <ThrowOnError extends boolean = false>(options: Options<CreateEventData, ThrowOnError>) => RequestResult< {
740
+ event: Event_2;
727
741
  }, {
728
- event: Event_2;
742
+ event: Event_2;
729
743
  }, ThrowOnError>;
730
744
 
731
745
  /**
@@ -797,10 +811,10 @@ export declare type CreateEventResponses = {
797
811
  /**
798
812
  * Creates a new file and returns it's upload URL.
799
813
  */
800
- declare const createFile: <ThrowOnError extends boolean = false>(options: Options<CreateFileData, ThrowOnError>) => RequestResult<{
801
- file: File_2;
814
+ declare const createFile: <ThrowOnError extends boolean = false>(options: Options<CreateFileData, ThrowOnError>) => RequestResult< {
815
+ file: File_2;
802
816
  }, {
803
- file: File_2;
817
+ file: File_2;
804
818
  }, ThrowOnError>;
805
819
 
806
820
  /**
@@ -880,10 +894,10 @@ export declare type CreateFileResponses = {
880
894
  /**
881
895
  * Creates a new [Message](#schema_message)
882
896
  */
883
- declare const createMessage: <ThrowOnError extends boolean = false>(options: Options<CreateMessageData, ThrowOnError>) => RequestResult<{
884
- message: Message;
897
+ declare const createMessage: <ThrowOnError extends boolean = false>(options: Options<CreateMessageData, ThrowOnError>) => RequestResult< {
898
+ message: Message;
885
899
  }, {
886
- message: Message;
900
+ message: Message;
887
901
  }, ThrowOnError>;
888
902
 
889
903
  /**
@@ -895,6 +909,7 @@ export declare type CreateMessageBody = {
895
909
  */
896
910
  payload: {
897
911
  audioUrl: string;
912
+ fileId?: string;
898
913
  type: 'audio';
899
914
  } | {
900
915
  title: string;
@@ -937,9 +952,11 @@ export declare type CreateMessageBody = {
937
952
  } | {
938
953
  fileUrl: string;
939
954
  title?: string;
955
+ fileId?: string;
940
956
  type: 'file';
941
957
  } | {
942
958
  imageUrl: string;
959
+ fileId?: string;
943
960
  type: 'image';
944
961
  } | {
945
962
  latitude: number;
@@ -953,6 +970,7 @@ export declare type CreateMessageBody = {
953
970
  type: 'text';
954
971
  } | {
955
972
  videoUrl: string;
973
+ fileId?: string;
956
974
  type: 'video';
957
975
  } | {
958
976
  items: Array<{
@@ -970,22 +988,26 @@ export declare type CreateMessageBody = {
970
988
  type: 'image';
971
989
  payload: {
972
990
  imageUrl: string;
991
+ fileId?: string;
973
992
  };
974
993
  } | {
975
994
  type: 'audio';
976
995
  payload: {
977
996
  audioUrl: string;
997
+ fileId?: string;
978
998
  };
979
999
  } | {
980
1000
  type: 'video';
981
1001
  payload: {
982
1002
  videoUrl: string;
1003
+ fileId?: string;
983
1004
  };
984
1005
  } | {
985
1006
  type: 'file';
986
1007
  payload: {
987
1008
  fileUrl: string;
988
1009
  title?: string;
1010
+ fileId?: string;
989
1011
  };
990
1012
  } | {
991
1013
  type: 'location';
@@ -1071,12 +1093,12 @@ export declare const createUser: ({ clientId, apiUrl, adminSecret, customHeaders
1071
1093
  /**
1072
1094
  * Creates a new [User](#schema_user)
1073
1095
  */
1074
- declare const createUser_2: <ThrowOnError extends boolean = false>(options?: Options<CreateUserData, ThrowOnError>) => RequestResult<{
1075
- user: User;
1076
- key: string;
1096
+ declare const createUser_2: <ThrowOnError extends boolean = false>(options?: Options<CreateUserData, ThrowOnError>) => RequestResult< {
1097
+ user: User;
1098
+ key: string;
1077
1099
  }, {
1078
- user: User;
1079
- key: string;
1100
+ user: User;
1101
+ key: string;
1080
1102
  }, ThrowOnError>;
1081
1103
 
1082
1104
  /**
@@ -1092,9 +1114,9 @@ export declare type CreateUserBody = {
1092
1114
  */
1093
1115
  pictureUrl?: string;
1094
1116
  /**
1095
- * User data
1117
+ * User data. An object or a signed JWT token
1096
1118
  */
1097
- userData?: {};
1119
+ userData?: {} | string;
1098
1120
  };
1099
1121
 
1100
1122
  export declare type CreateUserData = {
@@ -1149,10 +1171,10 @@ declare type Custom = {
1149
1171
  /**
1150
1172
  * Permanently deletes a [Conversation](#schema_conversation). It cannot be undone. Also immediately deletes corresponding [Messages](#schema_message).
1151
1173
  */
1152
- declare const deleteConversation: <ThrowOnError extends boolean = false>(options: Options<DeleteConversationData, ThrowOnError>) => RequestResult<{
1153
- [key: string]: never;
1174
+ declare const deleteConversation: <ThrowOnError extends boolean = false>(options: Options<DeleteConversationData, ThrowOnError>) => RequestResult< {
1175
+ [key: string]: never;
1154
1176
  }, {
1155
- [key: string]: never;
1177
+ [key: string]: never;
1156
1178
  }, ThrowOnError>;
1157
1179
 
1158
1180
  export declare type DeleteConversationData = {
@@ -1198,10 +1220,10 @@ export declare type DeleteConversationResponses = {
1198
1220
  /**
1199
1221
  * Permanently deletes a [Message](#schema_message). It cannot be undone.
1200
1222
  */
1201
- declare const deleteMessage: <ThrowOnError extends boolean = false>(options: Options<DeleteMessageData, ThrowOnError>) => RequestResult<{
1202
- [key: string]: never;
1223
+ declare const deleteMessage: <ThrowOnError extends boolean = false>(options: Options<DeleteMessageData, ThrowOnError>) => RequestResult< {
1224
+ [key: string]: never;
1203
1225
  }, {
1204
- [key: string]: never;
1226
+ [key: string]: never;
1205
1227
  }, ThrowOnError>;
1206
1228
 
1207
1229
  export declare type DeleteMessageData = {
@@ -1247,10 +1269,10 @@ export declare type DeleteMessageResponses = {
1247
1269
  /**
1248
1270
  * Permanently deletes a [User](#schema_user). It cannot be undone.
1249
1271
  */
1250
- declare const deleteUser: <ThrowOnError extends boolean = false>(options: Options<DeleteUserData, ThrowOnError>) => RequestResult<{
1251
- [key: string]: never;
1272
+ declare const deleteUser: <ThrowOnError extends boolean = false>(options: Options<DeleteUserData, ThrowOnError>) => RequestResult< {
1273
+ [key: string]: never;
1252
1274
  }, {
1253
- [key: string]: never;
1275
+ [key: string]: never;
1254
1276
  }, ThrowOnError>;
1255
1277
 
1256
1278
  export declare type DeleteUserData = {
@@ -1341,6 +1363,11 @@ declare type EventMap = {
1341
1363
  [E in Event_3 as E['type']]: E['data'];
1342
1364
  };
1343
1365
 
1366
+ declare interface EventSourceLike {
1367
+ close(): void;
1368
+ addEventListener(event: string, handler: (event: any) => void): void;
1369
+ }
1370
+
1344
1371
  declare type File_2 = {
1345
1372
  id: string;
1346
1373
  botId: string;
@@ -1374,10 +1401,10 @@ export declare const generateUserKey: ({ adminSecret, expiresAt, userId, apiUrl,
1374
1401
  /**
1375
1402
  * Generates a new user authentication key. Can only be called by an administrator and when an admin key is configured.
1376
1403
  */
1377
- declare const generateUserKey_2: <ThrowOnError extends boolean = false>(options?: Options<GenerateUserKeyData, ThrowOnError>) => RequestResult<{
1378
- key: string;
1404
+ declare const generateUserKey_2: <ThrowOnError extends boolean = false>(options?: Options<GenerateUserKeyData, ThrowOnError>) => RequestResult< {
1405
+ key: string;
1379
1406
  }, {
1380
- key: string;
1407
+ key: string;
1381
1408
  }, ThrowOnError>;
1382
1409
 
1383
1410
  /**
@@ -1435,10 +1462,10 @@ export declare type GenerateUserKeyResponses = {
1435
1462
  /**
1436
1463
  * Retrieves the [Conversation](#schema_conversation) object for a valid identifier.
1437
1464
  */
1438
- declare const getConversation: <ThrowOnError extends boolean = false>(options: Options<GetConversationData, ThrowOnError>) => RequestResult<{
1439
- conversation: Conversation;
1465
+ declare const getConversation: <ThrowOnError extends boolean = false>(options: Options<GetConversationData, ThrowOnError>) => RequestResult< {
1466
+ conversation: Conversation;
1440
1467
  }, {
1441
- conversation: Conversation;
1468
+ conversation: Conversation;
1442
1469
  }, ThrowOnError>;
1443
1470
 
1444
1471
  export declare type GetConversationData = {
@@ -1484,10 +1511,10 @@ export declare type GetConversationResponses = {
1484
1511
  /**
1485
1512
  * Retrieves the [Event](#schema_event) object for a valid identifier.
1486
1513
  */
1487
- declare const getEvent: <ThrowOnError extends boolean = false>(options: Options<GetEventData, ThrowOnError>) => RequestResult<{
1488
- event: Event_2;
1514
+ declare const getEvent: <ThrowOnError extends boolean = false>(options: Options<GetEventData, ThrowOnError>) => RequestResult< {
1515
+ event: Event_2;
1489
1516
  }, {
1490
- event: Event_2;
1517
+ event: Event_2;
1491
1518
  }, ThrowOnError>;
1492
1519
 
1493
1520
  export declare type GetEventData = {
@@ -1533,10 +1560,10 @@ export declare type GetEventResponses = {
1533
1560
  /**
1534
1561
  * Retrieves the [Message](#schema_message) object for a valid identifier.
1535
1562
  */
1536
- declare const getMessage: <ThrowOnError extends boolean = false>(options: Options<GetMessageData, ThrowOnError>) => RequestResult<{
1537
- message: Message;
1563
+ declare const getMessage: <ThrowOnError extends boolean = false>(options: Options<GetMessageData, ThrowOnError>) => RequestResult< {
1564
+ message: Message;
1538
1565
  }, {
1539
- message: Message;
1566
+ message: Message;
1540
1567
  }, ThrowOnError>;
1541
1568
 
1542
1569
  export declare type GetMessageData = {
@@ -1582,10 +1609,10 @@ export declare type GetMessageResponses = {
1582
1609
  /**
1583
1610
  * Retrieves a [Participant](#schema_user) from a [Conversation](#schema_conversation).
1584
1611
  */
1585
- declare const getParticipant: <ThrowOnError extends boolean = false>(options: Options<GetParticipantData, ThrowOnError>) => RequestResult<{
1586
- participant: User;
1612
+ declare const getParticipant: <ThrowOnError extends boolean = false>(options: Options<GetParticipantData, ThrowOnError>) => RequestResult< {
1613
+ participant: User;
1587
1614
  }, {
1588
- participant: User;
1615
+ participant: User;
1589
1616
  }, ThrowOnError>;
1590
1617
 
1591
1618
  export declare type GetParticipantData = {
@@ -1635,10 +1662,10 @@ export declare type GetParticipantResponses = {
1635
1662
  /**
1636
1663
  * Retrieves the [User](#schema_user) object for a valid identifier.
1637
1664
  */
1638
- declare const getUser: <ThrowOnError extends boolean = false>(options: Options<GetUserData, ThrowOnError>) => RequestResult<{
1639
- user: User;
1665
+ declare const getUser: <ThrowOnError extends boolean = false>(options: Options<GetUserData, ThrowOnError>) => RequestResult< {
1666
+ user: User;
1640
1667
  }, {
1641
- user: User;
1668
+ user: User;
1642
1669
  }, ThrowOnError>;
1643
1670
 
1644
1671
  export declare type GetUserData = {
@@ -1699,10 +1726,10 @@ export declare const initialize: ({ conversationId, userToken, clientId, apiUrl,
1699
1726
  /**
1700
1727
  * Creates a SSE stream to receive messages and events. The first event will be a payload containing the conversation details.
1701
1728
  */
1702
- declare const initializeConversation: <ThrowOnError extends boolean = false>(options?: Options<InitializeConversationData, ThrowOnError>) => RequestResult<{
1703
- [key: string]: never;
1729
+ declare const initializeConversation: <ThrowOnError extends boolean = false>(options?: Options<InitializeConversationData, ThrowOnError>) => RequestResult< {
1730
+ [key: string]: never;
1704
1731
  }, {
1705
- [key: string]: never;
1732
+ [key: string]: never;
1706
1733
  }, ThrowOnError>;
1707
1734
 
1708
1735
  export declare type InitializeConversationData = {
@@ -1772,16 +1799,16 @@ declare class Interceptors<Interceptor> {
1772
1799
  /**
1773
1800
  * Retrieves the conversation's [Messages](#schema_message)
1774
1801
  */
1775
- declare const listConversationMessages: <ThrowOnError extends boolean = false>(options: Options<ListConversationMessagesData, ThrowOnError>) => RequestResult<{
1776
- messages: Array<Message>;
1777
- meta: {
1778
- nextToken?: string;
1779
- };
1802
+ declare const listConversationMessages: <ThrowOnError extends boolean = false>(options: Options<ListConversationMessagesData, ThrowOnError>) => RequestResult< {
1803
+ messages: Array<Message>;
1804
+ meta: {
1805
+ nextToken?: string;
1806
+ };
1780
1807
  }, {
1781
- messages: Array<Message>;
1782
- meta: {
1783
- nextToken?: string;
1784
- };
1808
+ messages: Array<Message>;
1809
+ meta: {
1810
+ nextToken?: string;
1811
+ };
1785
1812
  }, ThrowOnError>;
1786
1813
 
1787
1814
  export declare type ListConversationMessagesData = {
@@ -1844,276 +1871,292 @@ export declare type ListConversationMessagesResponses = {
1844
1871
  /**
1845
1872
  * Returns a list of [Conversation](#schema_conversation) objects
1846
1873
  */
1847
- declare const listConversations: <ThrowOnError extends boolean = false>(options: Options<ListConversationsData, ThrowOnError>) => RequestResult<{
1848
- conversations: Array<{
1849
- id: string;
1850
- createdAt: string;
1851
- updatedAt: string;
1852
- lastMessage?: {
1853
- id: string;
1854
- createdAt: string;
1855
- payload: {
1856
- audioUrl: string;
1857
- type: "audio";
1858
- } | {
1859
- title: string;
1860
- subtitle?: string;
1861
- imageUrl?: string;
1862
- actions: Array<{
1863
- action: "postback" | "url" | "say";
1864
- label: string;
1865
- value: string;
1866
- }>;
1867
- type: "card";
1868
- } | {
1869
- items: Array<{
1870
- title: string;
1871
- subtitle?: string;
1872
- imageUrl?: string;
1873
- actions: Array<{
1874
- action: "postback" | "url" | "say";
1875
- label: string;
1876
- value: string;
1877
- }>;
1878
- }>;
1879
- type: "carousel";
1880
- } | {
1881
- text: string;
1882
- options: Array<{
1883
- label: string;
1884
- value: string;
1885
- }>;
1886
- disableFreeText?: boolean;
1887
- type: "choice";
1888
- } | {
1889
- text: string;
1890
- options: Array<{
1891
- label: string;
1892
- value: string;
1893
- }>;
1894
- disableFreeText?: boolean;
1895
- type: "dropdown";
1896
- } | {
1897
- fileUrl: string;
1898
- title?: string;
1899
- type: "file";
1900
- } | {
1901
- imageUrl: string;
1902
- type: "image";
1903
- } | {
1904
- latitude: number;
1905
- longitude: number;
1906
- address?: string;
1907
- title?: string;
1908
- type: "location";
1909
- } | {
1910
- text: string;
1911
- value?: string;
1912
- type: "text";
1913
- } | {
1914
- videoUrl: string;
1915
- type: "video";
1916
- } | {
1917
- items: Array<{
1918
- type: "text";
1919
- payload: {
1920
- text: string;
1921
- value?: string;
1922
- };
1923
- } | {
1924
- type: "markdown";
1925
- payload: {
1926
- markdown: string;
1927
- };
1928
- } | {
1929
- type: "image";
1930
- payload: {
1931
- imageUrl: string;
1932
- };
1933
- } | {
1934
- type: "audio";
1935
- payload: {
1936
- audioUrl: string;
1937
- };
1938
- } | {
1939
- type: "video";
1940
- payload: {
1941
- videoUrl: string;
1942
- };
1943
- } | {
1944
- type: "file";
1945
- payload: {
1946
- fileUrl: string;
1947
- title?: string;
1948
- };
1949
- } | {
1950
- type: "location";
1951
- payload: {
1952
- latitude: number;
1953
- longitude: number;
1954
- address?: string;
1955
- title?: string;
1956
- };
1957
- }>;
1958
- type: "bloc";
1959
- } | {
1960
- markdown: string;
1961
- type: "markdown";
1962
- } | {
1963
- url: string;
1964
- name: string;
1965
- data?: unknown;
1966
- type: "custom";
1967
- };
1968
- userId: string;
1969
- conversationId: string;
1970
- metadata?: {};
1971
- replyTo?: string;
1972
- selectedBy?: string;
1973
- feedback?: {
1974
- value: "positive" | "negative";
1975
- comment?: string;
1976
- };
1977
- };
1978
- }>;
1979
- meta: {
1980
- nextToken?: string;
1981
- };
1874
+ declare const listConversations: <ThrowOnError extends boolean = false>(options: Options<ListConversationsData, ThrowOnError>) => RequestResult< {
1875
+ conversations: Array<{
1876
+ id: string;
1877
+ createdAt: string;
1878
+ updatedAt: string;
1879
+ lastMessage?: {
1880
+ id: string;
1881
+ createdAt: string;
1882
+ payload: {
1883
+ audioUrl: string;
1884
+ fileId?: string;
1885
+ type: "audio";
1886
+ } | {
1887
+ title: string;
1888
+ subtitle?: string;
1889
+ imageUrl?: string;
1890
+ actions: Array<{
1891
+ action: "postback" | "url" | "say";
1892
+ label: string;
1893
+ value: string;
1894
+ }>;
1895
+ type: "card";
1896
+ } | {
1897
+ items: Array<{
1898
+ title: string;
1899
+ subtitle?: string;
1900
+ imageUrl?: string;
1901
+ actions: Array<{
1902
+ action: "postback" | "url" | "say";
1903
+ label: string;
1904
+ value: string;
1905
+ }>;
1906
+ }>;
1907
+ type: "carousel";
1908
+ } | {
1909
+ text: string;
1910
+ options: Array<{
1911
+ label: string;
1912
+ value: string;
1913
+ }>;
1914
+ disableFreeText?: boolean;
1915
+ type: "choice";
1916
+ } | {
1917
+ text: string;
1918
+ options: Array<{
1919
+ label: string;
1920
+ value: string;
1921
+ }>;
1922
+ disableFreeText?: boolean;
1923
+ type: "dropdown";
1924
+ } | {
1925
+ fileUrl: string;
1926
+ title?: string;
1927
+ fileId?: string;
1928
+ type: "file";
1929
+ } | {
1930
+ imageUrl: string;
1931
+ fileId?: string;
1932
+ type: "image";
1933
+ } | {
1934
+ latitude: number;
1935
+ longitude: number;
1936
+ address?: string;
1937
+ title?: string;
1938
+ type: "location";
1939
+ } | {
1940
+ text: string;
1941
+ value?: string;
1942
+ type: "text";
1943
+ } | {
1944
+ videoUrl: string;
1945
+ fileId?: string;
1946
+ type: "video";
1947
+ } | {
1948
+ items: Array<{
1949
+ type: "text";
1950
+ payload: {
1951
+ text: string;
1952
+ value?: string;
1953
+ };
1954
+ } | {
1955
+ type: "markdown";
1956
+ payload: {
1957
+ markdown: string;
1958
+ };
1959
+ } | {
1960
+ type: "image";
1961
+ payload: {
1962
+ imageUrl: string;
1963
+ fileId?: string;
1964
+ };
1965
+ } | {
1966
+ type: "audio";
1967
+ payload: {
1968
+ audioUrl: string;
1969
+ fileId?: string;
1970
+ };
1971
+ } | {
1972
+ type: "video";
1973
+ payload: {
1974
+ videoUrl: string;
1975
+ fileId?: string;
1976
+ };
1977
+ } | {
1978
+ type: "file";
1979
+ payload: {
1980
+ fileUrl: string;
1981
+ title?: string;
1982
+ fileId?: string;
1983
+ };
1984
+ } | {
1985
+ type: "location";
1986
+ payload: {
1987
+ latitude: number;
1988
+ longitude: number;
1989
+ address?: string;
1990
+ title?: string;
1991
+ };
1992
+ }>;
1993
+ type: "bloc";
1994
+ } | {
1995
+ markdown: string;
1996
+ type: "markdown";
1997
+ } | {
1998
+ url: string;
1999
+ name: string;
2000
+ data?: unknown;
2001
+ type: "custom";
2002
+ };
2003
+ userId: string;
2004
+ conversationId: string;
2005
+ metadata?: {};
2006
+ replyTo?: string;
2007
+ selectedBy?: string;
2008
+ feedback?: {
2009
+ value: "positive" | "negative";
2010
+ comment?: string;
2011
+ };
2012
+ };
2013
+ }>;
2014
+ meta: {
2015
+ nextToken?: string;
2016
+ };
1982
2017
  }, {
1983
- conversations: Array<{
1984
- id: string;
1985
- createdAt: string;
1986
- updatedAt: string;
1987
- lastMessage?: {
1988
- id: string;
1989
- createdAt: string;
1990
- payload: {
1991
- audioUrl: string;
1992
- type: "audio";
1993
- } | {
1994
- title: string;
1995
- subtitle?: string;
1996
- imageUrl?: string;
1997
- actions: Array<{
1998
- action: "postback" | "url" | "say";
1999
- label: string;
2000
- value: string;
2001
- }>;
2002
- type: "card";
2003
- } | {
2004
- items: Array<{
2005
- title: string;
2006
- subtitle?: string;
2007
- imageUrl?: string;
2008
- actions: Array<{
2009
- action: "postback" | "url" | "say";
2010
- label: string;
2011
- value: string;
2012
- }>;
2013
- }>;
2014
- type: "carousel";
2015
- } | {
2016
- text: string;
2017
- options: Array<{
2018
- label: string;
2019
- value: string;
2020
- }>;
2021
- disableFreeText?: boolean;
2022
- type: "choice";
2023
- } | {
2024
- text: string;
2025
- options: Array<{
2026
- label: string;
2027
- value: string;
2028
- }>;
2029
- disableFreeText?: boolean;
2030
- type: "dropdown";
2031
- } | {
2032
- fileUrl: string;
2033
- title?: string;
2034
- type: "file";
2035
- } | {
2036
- imageUrl: string;
2037
- type: "image";
2038
- } | {
2039
- latitude: number;
2040
- longitude: number;
2041
- address?: string;
2042
- title?: string;
2043
- type: "location";
2044
- } | {
2045
- text: string;
2046
- value?: string;
2047
- type: "text";
2048
- } | {
2049
- videoUrl: string;
2050
- type: "video";
2051
- } | {
2052
- items: Array<{
2053
- type: "text";
2054
- payload: {
2055
- text: string;
2056
- value?: string;
2057
- };
2058
- } | {
2059
- type: "markdown";
2060
- payload: {
2061
- markdown: string;
2062
- };
2063
- } | {
2064
- type: "image";
2065
- payload: {
2066
- imageUrl: string;
2067
- };
2068
- } | {
2069
- type: "audio";
2070
- payload: {
2071
- audioUrl: string;
2072
- };
2073
- } | {
2074
- type: "video";
2075
- payload: {
2076
- videoUrl: string;
2077
- };
2078
- } | {
2079
- type: "file";
2080
- payload: {
2081
- fileUrl: string;
2082
- title?: string;
2083
- };
2084
- } | {
2085
- type: "location";
2086
- payload: {
2087
- latitude: number;
2088
- longitude: number;
2089
- address?: string;
2090
- title?: string;
2091
- };
2092
- }>;
2093
- type: "bloc";
2094
- } | {
2095
- markdown: string;
2096
- type: "markdown";
2097
- } | {
2098
- url: string;
2099
- name: string;
2100
- data?: unknown;
2101
- type: "custom";
2102
- };
2103
- userId: string;
2104
- conversationId: string;
2105
- metadata?: {};
2106
- replyTo?: string;
2107
- selectedBy?: string;
2108
- feedback?: {
2109
- value: "positive" | "negative";
2110
- comment?: string;
2111
- };
2112
- };
2113
- }>;
2114
- meta: {
2115
- nextToken?: string;
2116
- };
2018
+ conversations: Array<{
2019
+ id: string;
2020
+ createdAt: string;
2021
+ updatedAt: string;
2022
+ lastMessage?: {
2023
+ id: string;
2024
+ createdAt: string;
2025
+ payload: {
2026
+ audioUrl: string;
2027
+ fileId?: string;
2028
+ type: "audio";
2029
+ } | {
2030
+ title: string;
2031
+ subtitle?: string;
2032
+ imageUrl?: string;
2033
+ actions: Array<{
2034
+ action: "postback" | "url" | "say";
2035
+ label: string;
2036
+ value: string;
2037
+ }>;
2038
+ type: "card";
2039
+ } | {
2040
+ items: Array<{
2041
+ title: string;
2042
+ subtitle?: string;
2043
+ imageUrl?: string;
2044
+ actions: Array<{
2045
+ action: "postback" | "url" | "say";
2046
+ label: string;
2047
+ value: string;
2048
+ }>;
2049
+ }>;
2050
+ type: "carousel";
2051
+ } | {
2052
+ text: string;
2053
+ options: Array<{
2054
+ label: string;
2055
+ value: string;
2056
+ }>;
2057
+ disableFreeText?: boolean;
2058
+ type: "choice";
2059
+ } | {
2060
+ text: string;
2061
+ options: Array<{
2062
+ label: string;
2063
+ value: string;
2064
+ }>;
2065
+ disableFreeText?: boolean;
2066
+ type: "dropdown";
2067
+ } | {
2068
+ fileUrl: string;
2069
+ title?: string;
2070
+ fileId?: string;
2071
+ type: "file";
2072
+ } | {
2073
+ imageUrl: string;
2074
+ fileId?: string;
2075
+ type: "image";
2076
+ } | {
2077
+ latitude: number;
2078
+ longitude: number;
2079
+ address?: string;
2080
+ title?: string;
2081
+ type: "location";
2082
+ } | {
2083
+ text: string;
2084
+ value?: string;
2085
+ type: "text";
2086
+ } | {
2087
+ videoUrl: string;
2088
+ fileId?: string;
2089
+ type: "video";
2090
+ } | {
2091
+ items: Array<{
2092
+ type: "text";
2093
+ payload: {
2094
+ text: string;
2095
+ value?: string;
2096
+ };
2097
+ } | {
2098
+ type: "markdown";
2099
+ payload: {
2100
+ markdown: string;
2101
+ };
2102
+ } | {
2103
+ type: "image";
2104
+ payload: {
2105
+ imageUrl: string;
2106
+ fileId?: string;
2107
+ };
2108
+ } | {
2109
+ type: "audio";
2110
+ payload: {
2111
+ audioUrl: string;
2112
+ fileId?: string;
2113
+ };
2114
+ } | {
2115
+ type: "video";
2116
+ payload: {
2117
+ videoUrl: string;
2118
+ fileId?: string;
2119
+ };
2120
+ } | {
2121
+ type: "file";
2122
+ payload: {
2123
+ fileUrl: string;
2124
+ title?: string;
2125
+ fileId?: string;
2126
+ };
2127
+ } | {
2128
+ type: "location";
2129
+ payload: {
2130
+ latitude: number;
2131
+ longitude: number;
2132
+ address?: string;
2133
+ title?: string;
2134
+ };
2135
+ }>;
2136
+ type: "bloc";
2137
+ } | {
2138
+ markdown: string;
2139
+ type: "markdown";
2140
+ } | {
2141
+ url: string;
2142
+ name: string;
2143
+ data?: unknown;
2144
+ type: "custom";
2145
+ };
2146
+ userId: string;
2147
+ conversationId: string;
2148
+ metadata?: {};
2149
+ replyTo?: string;
2150
+ selectedBy?: string;
2151
+ feedback?: {
2152
+ value: "positive" | "negative";
2153
+ comment?: string;
2154
+ };
2155
+ };
2156
+ }>;
2157
+ meta: {
2158
+ nextToken?: string;
2159
+ };
2117
2160
  }, ThrowOnError>;
2118
2161
 
2119
2162
  export declare type ListConversationsData = {
@@ -2171,6 +2214,7 @@ export declare type ListConversationsErrors = {
2171
2214
  */
2172
2215
  payload: {
2173
2216
  audioUrl: string;
2217
+ fileId?: string;
2174
2218
  type: 'audio';
2175
2219
  } | {
2176
2220
  title: string;
@@ -2213,9 +2257,11 @@ export declare type ListConversationsErrors = {
2213
2257
  } | {
2214
2258
  fileUrl: string;
2215
2259
  title?: string;
2260
+ fileId?: string;
2216
2261
  type: 'file';
2217
2262
  } | {
2218
2263
  imageUrl: string;
2264
+ fileId?: string;
2219
2265
  type: 'image';
2220
2266
  } | {
2221
2267
  latitude: number;
@@ -2229,6 +2275,7 @@ export declare type ListConversationsErrors = {
2229
2275
  type: 'text';
2230
2276
  } | {
2231
2277
  videoUrl: string;
2278
+ fileId?: string;
2232
2279
  type: 'video';
2233
2280
  } | {
2234
2281
  items: Array<{
@@ -2246,22 +2293,26 @@ export declare type ListConversationsErrors = {
2246
2293
  type: 'image';
2247
2294
  payload: {
2248
2295
  imageUrl: string;
2296
+ fileId?: string;
2249
2297
  };
2250
2298
  } | {
2251
2299
  type: 'audio';
2252
2300
  payload: {
2253
2301
  audioUrl: string;
2302
+ fileId?: string;
2254
2303
  };
2255
2304
  } | {
2256
2305
  type: 'video';
2257
2306
  payload: {
2258
2307
  videoUrl: string;
2308
+ fileId?: string;
2259
2309
  };
2260
2310
  } | {
2261
2311
  type: 'file';
2262
2312
  payload: {
2263
2313
  fileUrl: string;
2264
2314
  title?: string;
2315
+ fileId?: string;
2265
2316
  };
2266
2317
  } | {
2267
2318
  type: 'location';
@@ -2357,6 +2408,7 @@ export declare type ListConversationsResponses = {
2357
2408
  */
2358
2409
  payload: {
2359
2410
  audioUrl: string;
2411
+ fileId?: string;
2360
2412
  type: 'audio';
2361
2413
  } | {
2362
2414
  title: string;
@@ -2399,9 +2451,11 @@ export declare type ListConversationsResponses = {
2399
2451
  } | {
2400
2452
  fileUrl: string;
2401
2453
  title?: string;
2454
+ fileId?: string;
2402
2455
  type: 'file';
2403
2456
  } | {
2404
2457
  imageUrl: string;
2458
+ fileId?: string;
2405
2459
  type: 'image';
2406
2460
  } | {
2407
2461
  latitude: number;
@@ -2415,6 +2469,7 @@ export declare type ListConversationsResponses = {
2415
2469
  type: 'text';
2416
2470
  } | {
2417
2471
  videoUrl: string;
2472
+ fileId?: string;
2418
2473
  type: 'video';
2419
2474
  } | {
2420
2475
  items: Array<{
@@ -2432,22 +2487,26 @@ export declare type ListConversationsResponses = {
2432
2487
  type: 'image';
2433
2488
  payload: {
2434
2489
  imageUrl: string;
2490
+ fileId?: string;
2435
2491
  };
2436
2492
  } | {
2437
2493
  type: 'audio';
2438
2494
  payload: {
2439
2495
  audioUrl: string;
2496
+ fileId?: string;
2440
2497
  };
2441
2498
  } | {
2442
2499
  type: 'video';
2443
2500
  payload: {
2444
2501
  videoUrl: string;
2502
+ fileId?: string;
2445
2503
  };
2446
2504
  } | {
2447
2505
  type: 'file';
2448
2506
  payload: {
2449
2507
  fileUrl: string;
2450
2508
  title?: string;
2509
+ fileId?: string;
2451
2510
  };
2452
2511
  } | {
2453
2512
  type: 'location';
@@ -2509,10 +2568,10 @@ export declare type ListConversationsResponses = {
2509
2568
  /**
2510
2569
  * Creates a SSE stream to receive messages and events from a conversation
2511
2570
  */
2512
- declare const listenConversation: <ThrowOnError extends boolean = false>(options: Options<ListenConversationData, ThrowOnError>) => RequestResult<{
2513
- [key: string]: never;
2571
+ declare const listenConversation: <ThrowOnError extends boolean = false>(options: Options<ListenConversationData, ThrowOnError>) => RequestResult< {
2572
+ [key: string]: never;
2514
2573
  }, {
2515
- [key: string]: never;
2574
+ [key: string]: never;
2516
2575
  }, ThrowOnError>;
2517
2576
 
2518
2577
  export declare type ListenConversationData = {
@@ -2558,16 +2617,16 @@ export declare type ListenConversationResponses = {
2558
2617
  /**
2559
2618
  * Retrieves a list of [Participants](#schema_user) for a given [Conversation](#schema_conversation).
2560
2619
  */
2561
- declare const listParticipants: <ThrowOnError extends boolean = false>(options: Options<ListParticipantsData, ThrowOnError>) => RequestResult<{
2562
- participants: Array<User>;
2563
- meta: {
2564
- nextToken?: string;
2565
- };
2620
+ declare const listParticipants: <ThrowOnError extends boolean = false>(options: Options<ListParticipantsData, ThrowOnError>) => RequestResult< {
2621
+ participants: Array<User>;
2622
+ meta: {
2623
+ nextToken?: string;
2624
+ };
2566
2625
  }, {
2567
- participants: Array<User>;
2568
- meta: {
2569
- nextToken?: string;
2570
- };
2626
+ participants: Array<User>;
2627
+ meta: {
2628
+ nextToken?: string;
2629
+ };
2571
2630
  }, ThrowOnError>;
2572
2631
 
2573
2632
  export declare type ListParticipantsData = {
@@ -2644,6 +2703,7 @@ export declare type Message = {
2644
2703
  */
2645
2704
  payload: {
2646
2705
  audioUrl: string;
2706
+ fileId?: string;
2647
2707
  type: 'audio';
2648
2708
  } | {
2649
2709
  title: string;
@@ -2686,9 +2746,11 @@ export declare type Message = {
2686
2746
  } | {
2687
2747
  fileUrl: string;
2688
2748
  title?: string;
2749
+ fileId?: string;
2689
2750
  type: 'file';
2690
2751
  } | {
2691
2752
  imageUrl: string;
2753
+ fileId?: string;
2692
2754
  type: 'image';
2693
2755
  } | {
2694
2756
  latitude: number;
@@ -2702,6 +2764,7 @@ export declare type Message = {
2702
2764
  type: 'text';
2703
2765
  } | {
2704
2766
  videoUrl: string;
2767
+ fileId?: string;
2705
2768
  type: 'video';
2706
2769
  } | {
2707
2770
  items: Array<{
@@ -2719,22 +2782,26 @@ export declare type Message = {
2719
2782
  type: 'image';
2720
2783
  payload: {
2721
2784
  imageUrl: string;
2785
+ fileId?: string;
2722
2786
  };
2723
2787
  } | {
2724
2788
  type: 'audio';
2725
2789
  payload: {
2726
2790
  audioUrl: string;
2791
+ fileId?: string;
2727
2792
  };
2728
2793
  } | {
2729
2794
  type: 'video';
2730
2795
  payload: {
2731
2796
  videoUrl: string;
2797
+ fileId?: string;
2732
2798
  };
2733
2799
  } | {
2734
2800
  type: 'file';
2735
2801
  payload: {
2736
2802
  fileUrl: string;
2737
2803
  title?: string;
2804
+ fileId?: string;
2738
2805
  };
2739
2806
  } | {
2740
2807
  type: 'location';
@@ -3444,10 +3511,10 @@ declare interface QuerySerializerOptions {
3444
3511
  /**
3445
3512
  * Removes feedback from a [Message](#schema_message).
3446
3513
  */
3447
- declare const removeMessageFeedback: <ThrowOnError extends boolean = false>(options: Options<RemoveMessageFeedbackData, ThrowOnError>) => RequestResult<{
3448
- [key: string]: never;
3514
+ declare const removeMessageFeedback: <ThrowOnError extends boolean = false>(options: Options<RemoveMessageFeedbackData, ThrowOnError>) => RequestResult< {
3515
+ [key: string]: never;
3449
3516
  }, {
3450
- [key: string]: never;
3517
+ [key: string]: never;
3451
3518
  }, ThrowOnError>;
3452
3519
 
3453
3520
  export declare type RemoveMessageFeedbackData = {
@@ -3493,10 +3560,10 @@ export declare type RemoveMessageFeedbackResponses = {
3493
3560
  /**
3494
3561
  * Remove a [Participant](#schema_user) from a [Conversation](#schema_conversation).
3495
3562
  */
3496
- declare const removeParticipant: <ThrowOnError extends boolean = false>(options: Options<RemoveParticipantData, ThrowOnError>) => RequestResult<{
3497
- [key: string]: never;
3563
+ declare const removeParticipant: <ThrowOnError extends boolean = false>(options: Options<RemoveParticipantData, ThrowOnError>) => RequestResult< {
3564
+ [key: string]: never;
3498
3565
  }, {
3499
- [key: string]: never;
3566
+ [key: string]: never;
3500
3567
  }, ThrowOnError>;
3501
3568
 
3502
3569
  export declare type RemoveParticipantData = {
@@ -3585,10 +3652,10 @@ declare type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, o
3585
3652
  /**
3586
3653
  * Updates a [Message](#schema_message) sent by any user to mark it as already selected. A message can only be selected once.
3587
3654
  */
3588
- declare const selectMessage: <ThrowOnError extends boolean = false>(options: Options<SelectMessageData, ThrowOnError>) => RequestResult<{
3589
- [key: string]: never;
3655
+ declare const selectMessage: <ThrowOnError extends boolean = false>(options: Options<SelectMessageData, ThrowOnError>) => RequestResult< {
3656
+ [key: string]: never;
3590
3657
  }, {
3591
- [key: string]: never;
3658
+ [key: string]: never;
3592
3659
  }, ThrowOnError>;
3593
3660
 
3594
3661
  /**
@@ -3648,10 +3715,10 @@ export declare const sendPerfMetrics: (clientId: string, body: ClientTypes_2.Sen
3648
3715
  /**
3649
3716
  * Sends performance metrics to the server.
3650
3717
  */
3651
- declare const sendPerfMetrics_2: <ThrowOnError extends boolean = false>(options?: Options<SendPerfMetricsData, ThrowOnError>) => RequestResult<{
3652
- [key: string]: never;
3718
+ declare const sendPerfMetrics_2: <ThrowOnError extends boolean = false>(options?: Options<SendPerfMetricsData, ThrowOnError>) => RequestResult< {
3719
+ [key: string]: never;
3653
3720
  }, {
3654
- [key: string]: never;
3721
+ [key: string]: never;
3655
3722
  }, ThrowOnError>;
3656
3723
 
3657
3724
  /**
@@ -3728,10 +3795,10 @@ declare type TypingStopped = {
3728
3795
  /**
3729
3796
  * Updates a [Message](#schema_message). The bot won't be aware of the changes.
3730
3797
  */
3731
- declare const updateMessage: <ThrowOnError extends boolean = false>(options: Options<UpdateMessageData, ThrowOnError>) => RequestResult<{
3732
- message: Message;
3798
+ declare const updateMessage: <ThrowOnError extends boolean = false>(options: Options<UpdateMessageData, ThrowOnError>) => RequestResult< {
3799
+ message: Message;
3733
3800
  }, {
3734
- message: Message;
3801
+ message: Message;
3735
3802
  }, ThrowOnError>;
3736
3803
 
3737
3804
  /**
@@ -3743,6 +3810,7 @@ export declare type UpdateMessageBody = {
3743
3810
  */
3744
3811
  payload?: {
3745
3812
  audioUrl: string;
3813
+ fileId?: string;
3746
3814
  type: 'audio';
3747
3815
  } | {
3748
3816
  title: string;
@@ -3785,9 +3853,11 @@ export declare type UpdateMessageBody = {
3785
3853
  } | {
3786
3854
  fileUrl: string;
3787
3855
  title?: string;
3856
+ fileId?: string;
3788
3857
  type: 'file';
3789
3858
  } | {
3790
3859
  imageUrl: string;
3860
+ fileId?: string;
3791
3861
  type: 'image';
3792
3862
  } | {
3793
3863
  latitude: number;
@@ -3801,6 +3871,7 @@ export declare type UpdateMessageBody = {
3801
3871
  type: 'text';
3802
3872
  } | {
3803
3873
  videoUrl: string;
3874
+ fileId?: string;
3804
3875
  type: 'video';
3805
3876
  } | {
3806
3877
  items: Array<{
@@ -3818,22 +3889,26 @@ export declare type UpdateMessageBody = {
3818
3889
  type: 'image';
3819
3890
  payload: {
3820
3891
  imageUrl: string;
3892
+ fileId?: string;
3821
3893
  };
3822
3894
  } | {
3823
3895
  type: 'audio';
3824
3896
  payload: {
3825
3897
  audioUrl: string;
3898
+ fileId?: string;
3826
3899
  };
3827
3900
  } | {
3828
3901
  type: 'video';
3829
3902
  payload: {
3830
3903
  videoUrl: string;
3904
+ fileId?: string;
3831
3905
  };
3832
3906
  } | {
3833
3907
  type: 'file';
3834
3908
  payload: {
3835
3909
  fileUrl: string;
3836
3910
  title?: string;
3911
+ fileId?: string;
3837
3912
  };
3838
3913
  } | {
3839
3914
  type: 'location';
@@ -3906,10 +3981,10 @@ export declare type UpdateMessageResponses = {
3906
3981
  /**
3907
3982
  * Update [User](#schema_user)
3908
3983
  */
3909
- declare const updateUser: <ThrowOnError extends boolean = false>(options: Options<UpdateUserData, ThrowOnError>) => RequestResult<{
3910
- user: User;
3984
+ declare const updateUser: <ThrowOnError extends boolean = false>(options: Options<UpdateUserData, ThrowOnError>) => RequestResult< {
3985
+ user: User;
3911
3986
  }, {
3912
- user: User;
3987
+ user: User;
3913
3988
  }, ThrowOnError>;
3914
3989
 
3915
3990
  /**
@@ -3925,9 +4000,9 @@ export declare type UpdateUserBody = {
3925
4000
  */
3926
4001
  pictureUrl?: string;
3927
4002
  /**
3928
- * User data
4003
+ * User data. An object or a signed JWT token
3929
4004
  */
3930
- userData?: {} | null;
4005
+ userData?: {} | string | null;
3931
4006
  };
3932
4007
 
3933
4008
  export declare type UpdateUserData = {