getricky 0.1.3 → 0.1.5

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.
@@ -128,6 +128,25 @@ export class RickyApi extends HeyApiClient {
128
128
  ...options
129
129
  });
130
130
  }
131
+ /**
132
+ * Create a contact field
133
+ *
134
+ * Adds a custom field to every contact, after the existing ones. A name already in use, in any case, answers `409 conflict`.
135
+ *
136
+ * Scope: `contacts:write`.
137
+ */
138
+ createContactField(options) {
139
+ return (options.client ?? this.client).post({
140
+ responseStyle: 'data',
141
+ security: [{ scheme: 'bearer', type: 'http' }],
142
+ url: '/contact-fields',
143
+ ...options,
144
+ headers: {
145
+ 'Content-Type': 'application/json',
146
+ ...options.headers
147
+ }
148
+ });
149
+ }
131
150
  /**
132
151
  * List conversations
133
152
  *
@@ -344,7 +363,7 @@ export class RickyApi extends HeyApiClient {
344
363
  *
345
364
  * Creates a contact tag. Apply it with `tag_ids` on a contact. A name already in use, in any case, answers `409 conflict`.
346
365
  *
347
- * Scope: `contacts:write`.
366
+ * Scope: `tags:write` or, on older keys, `contacts:write`.
348
367
  */
349
368
  createTag(options) {
350
369
  return (options.client ?? this.client).post({
@@ -734,4 +753,604 @@ export class RickyApi extends HeyApiClient {
734
753
  ...options
735
754
  });
736
755
  }
756
+ /**
757
+ * List agents
758
+ *
759
+ * Active agents, newest first. Archived agents are not listed.
760
+ *
761
+ * Scope: `agents:read`.
762
+ */
763
+ listAgents(options) {
764
+ return (options?.client ?? this.client).get({
765
+ responseStyle: 'data',
766
+ security: [{ scheme: 'bearer', type: 'http' }],
767
+ url: '/agents',
768
+ ...options
769
+ });
770
+ }
771
+ /**
772
+ * Create an agent
773
+ *
774
+ * Creates an AI agent with its instructions, model, voice and capabilities. It answers no conversation until you assign it to one or make it a channel default in Ricky.
775
+ *
776
+ * Scope: `agents:write`.
777
+ */
778
+ createAgent(options) {
779
+ return (options.client ?? this.client).post({
780
+ responseStyle: 'data',
781
+ security: [{ scheme: 'bearer', type: 'http' }],
782
+ url: '/agents',
783
+ ...options,
784
+ headers: {
785
+ 'Content-Type': 'application/json',
786
+ ...options.headers
787
+ }
788
+ });
789
+ }
790
+ /**
791
+ * Archive an agent
792
+ *
793
+ * Archives the agent and answers it as it was, with `archived_at`. Its conversations stop being answered by it and workflows that assign it are paused. Archiving twice answers `404`.
794
+ *
795
+ * Scope: `agents:write`.
796
+ */
797
+ archiveAgent(options) {
798
+ return (options.client ?? this.client).delete({
799
+ responseStyle: 'data',
800
+ security: [{ scheme: 'bearer', type: 'http' }],
801
+ url: '/agents/{agent_id}',
802
+ ...options
803
+ });
804
+ }
805
+ /**
806
+ * Get an agent
807
+ *
808
+ * One active agent with its full settings.
809
+ *
810
+ * Scope: `agents:read`.
811
+ */
812
+ getAgent(options) {
813
+ return (options.client ?? this.client).get({
814
+ responseStyle: 'data',
815
+ security: [{ scheme: 'bearer', type: 'http' }],
816
+ url: '/agents/{agent_id}',
817
+ ...options
818
+ });
819
+ }
820
+ /**
821
+ * Update an agent
822
+ *
823
+ * Changes only the fields in the body. `capabilities` and `handoff_user_ids` replace their whole sets.
824
+ *
825
+ * Scope: `agents:write`.
826
+ */
827
+ updateAgent(options) {
828
+ return (options.client ?? this.client).patch({
829
+ responseStyle: 'data',
830
+ security: [{ scheme: 'bearer', type: 'http' }],
831
+ url: '/agents/{agent_id}',
832
+ ...options,
833
+ headers: {
834
+ 'Content-Type': 'application/json',
835
+ ...options.headers
836
+ }
837
+ });
838
+ }
839
+ /**
840
+ * Get agent options
841
+ *
842
+ * The models, voices and capabilities an agent can be configured with.
843
+ *
844
+ * Scope: `agents:read`.
845
+ */
846
+ getAgentOptions(options) {
847
+ return (options?.client ?? this.client).get({
848
+ responseStyle: 'data',
849
+ security: [{ scheme: 'bearer', type: 'http' }],
850
+ url: '/agent-options',
851
+ ...options
852
+ });
853
+ }
854
+ /**
855
+ * Set the AI agent of a conversation
856
+ *
857
+ * Makes an agent answer the conversation, or turns the AI off with `null`. Either way the conversation is no longer assigned to a member; the contact owner stays.
858
+ *
859
+ * Scope: `conversations:write`.
860
+ */
861
+ assignConversationAgent(options) {
862
+ return (options.client ?? this.client).patch({
863
+ responseStyle: 'data',
864
+ security: [{ scheme: 'bearer', type: 'http' }],
865
+ url: '/conversations/{conversation_id}/agent',
866
+ ...options,
867
+ headers: {
868
+ 'Content-Type': 'application/json',
869
+ ...options.headers
870
+ }
871
+ });
872
+ }
873
+ /**
874
+ * List locations
875
+ *
876
+ * Branches and places, newest first.
877
+ *
878
+ * Scope: `knowledge:read`.
879
+ */
880
+ listKnowledgeLocations(options) {
881
+ return (options?.client ?? this.client).get({
882
+ responseStyle: 'data',
883
+ security: [{ scheme: 'bearer', type: 'http' }],
884
+ url: '/knowledge/locations',
885
+ ...options
886
+ });
887
+ }
888
+ /**
889
+ * Create a location
890
+ *
891
+ * Adds a branch or place the agents can share.
892
+ *
893
+ * Scope: `knowledge:write`.
894
+ */
895
+ createKnowledgeLocation(options) {
896
+ return (options.client ?? this.client).post({
897
+ responseStyle: 'data',
898
+ security: [{ scheme: 'bearer', type: 'http' }],
899
+ url: '/knowledge/locations',
900
+ ...options,
901
+ headers: {
902
+ 'Content-Type': 'application/json',
903
+ ...options.headers
904
+ }
905
+ });
906
+ }
907
+ /**
908
+ * Delete a location
909
+ *
910
+ * Deletes it for good and answers it as it was.
911
+ *
912
+ * Scope: `knowledge:write`.
913
+ */
914
+ deleteKnowledgeLocation(options) {
915
+ return (options.client ?? this.client).delete({
916
+ responseStyle: 'data',
917
+ security: [{ scheme: 'bearer', type: 'http' }],
918
+ url: '/knowledge/locations/{location_id}',
919
+ ...options
920
+ });
921
+ }
922
+ /**
923
+ * Get a location
924
+ *
925
+ * One location.
926
+ *
927
+ * Scope: `knowledge:read`.
928
+ */
929
+ getKnowledgeLocation(options) {
930
+ return (options.client ?? this.client).get({
931
+ responseStyle: 'data',
932
+ security: [{ scheme: 'bearer', type: 'http' }],
933
+ url: '/knowledge/locations/{location_id}',
934
+ ...options
935
+ });
936
+ }
937
+ /**
938
+ * Update a location
939
+ *
940
+ * Changes only the fields in the body.
941
+ *
942
+ * Scope: `knowledge:write`.
943
+ */
944
+ updateKnowledgeLocation(options) {
945
+ return (options.client ?? this.client).patch({
946
+ responseStyle: 'data',
947
+ security: [{ scheme: 'bearer', type: 'http' }],
948
+ url: '/knowledge/locations/{location_id}',
949
+ ...options,
950
+ headers: {
951
+ 'Content-Type': 'application/json',
952
+ ...options.headers
953
+ }
954
+ });
955
+ }
956
+ /**
957
+ * List directory contacts
958
+ *
959
+ * Contact cards of the knowledge directory, by display name. These are not CRM contacts.
960
+ *
961
+ * Scope: `knowledge:read`.
962
+ */
963
+ listKnowledgeContacts(options) {
964
+ return (options?.client ?? this.client).get({
965
+ responseStyle: 'data',
966
+ security: [{ scheme: 'bearer', type: 'http' }],
967
+ url: '/knowledge/contacts',
968
+ ...options
969
+ });
970
+ }
971
+ /**
972
+ * Create a directory contact
973
+ *
974
+ * Adds a contact card the agents can send to customers.
975
+ *
976
+ * Scope: `knowledge:write`.
977
+ */
978
+ createKnowledgeContact(options) {
979
+ return (options.client ?? this.client).post({
980
+ responseStyle: 'data',
981
+ security: [{ scheme: 'bearer', type: 'http' }],
982
+ url: '/knowledge/contacts',
983
+ ...options,
984
+ headers: {
985
+ 'Content-Type': 'application/json',
986
+ ...options.headers
987
+ }
988
+ });
989
+ }
990
+ /**
991
+ * Delete a directory contact
992
+ *
993
+ * Deletes it for good and answers it as it was.
994
+ *
995
+ * Scope: `knowledge:write`.
996
+ */
997
+ deleteKnowledgeContact(options) {
998
+ return (options.client ?? this.client).delete({
999
+ responseStyle: 'data',
1000
+ security: [{ scheme: 'bearer', type: 'http' }],
1001
+ url: '/knowledge/contacts/{knowledge_contact_id}',
1002
+ ...options
1003
+ });
1004
+ }
1005
+ /**
1006
+ * Get a directory contact
1007
+ *
1008
+ * One contact card.
1009
+ *
1010
+ * Scope: `knowledge:read`.
1011
+ */
1012
+ getKnowledgeContact(options) {
1013
+ return (options.client ?? this.client).get({
1014
+ responseStyle: 'data',
1015
+ security: [{ scheme: 'bearer', type: 'http' }],
1016
+ url: '/knowledge/contacts/{knowledge_contact_id}',
1017
+ ...options
1018
+ });
1019
+ }
1020
+ /**
1021
+ * Update a directory contact
1022
+ *
1023
+ * Changes only the fields in the body.
1024
+ *
1025
+ * Scope: `knowledge:write`.
1026
+ */
1027
+ updateKnowledgeContact(options) {
1028
+ return (options.client ?? this.client).patch({
1029
+ responseStyle: 'data',
1030
+ security: [{ scheme: 'bearer', type: 'http' }],
1031
+ url: '/knowledge/contacts/{knowledge_contact_id}',
1032
+ ...options,
1033
+ headers: {
1034
+ 'Content-Type': 'application/json',
1035
+ ...options.headers
1036
+ }
1037
+ });
1038
+ }
1039
+ /**
1040
+ * List files
1041
+ *
1042
+ * Documents and images the agents can consult or send, newest first.
1043
+ *
1044
+ * Scope: `knowledge:read`.
1045
+ */
1046
+ listKnowledgeFiles(options) {
1047
+ return (options?.client ?? this.client).get({
1048
+ responseStyle: 'data',
1049
+ security: [{ scheme: 'bearer', type: 'http' }],
1050
+ url: '/knowledge/files',
1051
+ ...options
1052
+ });
1053
+ }
1054
+ /**
1055
+ * Upload a file
1056
+ *
1057
+ * Begins an upload in three steps: this call answers the file, `uploading`, and an `upload_url`; `PUT` the bytes there; then call `POST /knowledge/files/{file_id}/complete`.
1058
+ *
1059
+ * Scope: `knowledge:write`.
1060
+ */
1061
+ createKnowledgeFile(options) {
1062
+ return (options.client ?? this.client).post({
1063
+ responseStyle: 'data',
1064
+ security: [{ scheme: 'bearer', type: 'http' }],
1065
+ url: '/knowledge/files',
1066
+ ...options,
1067
+ headers: {
1068
+ 'Content-Type': 'application/json',
1069
+ ...options.headers
1070
+ }
1071
+ });
1072
+ }
1073
+ /**
1074
+ * Complete an upload
1075
+ *
1076
+ * Checks the uploaded bytes against the declared type and size, reads the content for the agents and answers the file, `ready`. Reading a long PDF can take minutes. Completing a `ready` file changes nothing.
1077
+ *
1078
+ * Scope: `knowledge:write`.
1079
+ */
1080
+ completeKnowledgeFile(options) {
1081
+ return (options.client ?? this.client).post({
1082
+ responseStyle: 'data',
1083
+ security: [{ scheme: 'bearer', type: 'http' }],
1084
+ url: '/knowledge/files/{file_id}/complete',
1085
+ ...options,
1086
+ headers: {
1087
+ 'Content-Type': 'application/json',
1088
+ ...options.headers
1089
+ }
1090
+ });
1091
+ }
1092
+ /**
1093
+ * Delete a file
1094
+ *
1095
+ * Deletes it for good and answers it as it was. Copies already sent in conversations stay there.
1096
+ *
1097
+ * Scope: `knowledge:write`.
1098
+ */
1099
+ deleteKnowledgeFile(options) {
1100
+ return (options.client ?? this.client).delete({
1101
+ responseStyle: 'data',
1102
+ security: [{ scheme: 'bearer', type: 'http' }],
1103
+ url: '/knowledge/files/{file_id}',
1104
+ ...options
1105
+ });
1106
+ }
1107
+ /**
1108
+ * Get a file
1109
+ *
1110
+ * One file; a `ready` one carries a `download_url`.
1111
+ *
1112
+ * Scope: `knowledge:read`.
1113
+ */
1114
+ getKnowledgeFile(options) {
1115
+ return (options.client ?? this.client).get({
1116
+ responseStyle: 'data',
1117
+ security: [{ scheme: 'bearer', type: 'http' }],
1118
+ url: '/knowledge/files/{file_id}',
1119
+ ...options
1120
+ });
1121
+ }
1122
+ /**
1123
+ * Update a file
1124
+ *
1125
+ * Changes its title, description or what the agents may do with it. Only a `ready` file changes; otherwise `409 conflict`.
1126
+ *
1127
+ * Scope: `knowledge:write`.
1128
+ */
1129
+ updateKnowledgeFile(options) {
1130
+ return (options.client ?? this.client).patch({
1131
+ responseStyle: 'data',
1132
+ security: [{ scheme: 'bearer', type: 'http' }],
1133
+ url: '/knowledge/files/{file_id}',
1134
+ ...options,
1135
+ headers: {
1136
+ 'Content-Type': 'application/json',
1137
+ ...options.headers
1138
+ }
1139
+ });
1140
+ }
1141
+ /**
1142
+ * Change tags on many contacts
1143
+ *
1144
+ * Adds and removes the same tags on up to 100 contacts and answers one result per contact, in order. A tag ID the organization does not have refuses the whole request before any contact changes.
1145
+ *
1146
+ * Scope: `contacts:write`.
1147
+ */
1148
+ changeContactsTags(options) {
1149
+ return (options.client ?? this.client).post({
1150
+ responseStyle: 'data',
1151
+ security: [{ scheme: 'bearer', type: 'http' }],
1152
+ url: '/contacts/tags',
1153
+ ...options,
1154
+ headers: {
1155
+ 'Content-Type': 'application/json',
1156
+ ...options.headers
1157
+ }
1158
+ });
1159
+ }
1160
+ /**
1161
+ * Delete a contact field
1162
+ *
1163
+ * Deletes the field and its value on every contact, and answers the field as it was. It cannot be undone.
1164
+ *
1165
+ * Scope: `contacts:write`.
1166
+ */
1167
+ deleteContactField(options) {
1168
+ return (options.client ?? this.client).delete({
1169
+ responseStyle: 'data',
1170
+ security: [{ scheme: 'bearer', type: 'http' }],
1171
+ url: '/contact-fields/{field_id}',
1172
+ ...options
1173
+ });
1174
+ }
1175
+ /**
1176
+ * Delete a tag
1177
+ *
1178
+ * Deletes the tag and removes it from every contact, and answers the tag as it was. It cannot be undone.
1179
+ *
1180
+ * Scope: `tags:write`.
1181
+ */
1182
+ deleteTag(options) {
1183
+ return (options.client ?? this.client).delete({
1184
+ responseStyle: 'data',
1185
+ security: [{ scheme: 'bearer', type: 'http' }],
1186
+ url: '/tags/{tag_id}',
1187
+ ...options
1188
+ });
1189
+ }
1190
+ /**
1191
+ * Update a tag
1192
+ *
1193
+ * Renames or recolors a tag on every contact that has it. A name already in use, in any case, answers `409 conflict`.
1194
+ *
1195
+ * Scope: `tags:write`.
1196
+ */
1197
+ updateTag(options) {
1198
+ return (options.client ?? this.client).patch({
1199
+ responseStyle: 'data',
1200
+ security: [{ scheme: 'bearer', type: 'http' }],
1201
+ url: '/tags/{tag_id}',
1202
+ ...options,
1203
+ headers: {
1204
+ 'Content-Type': 'application/json',
1205
+ ...options.headers
1206
+ }
1207
+ });
1208
+ }
1209
+ /**
1210
+ * Search conversations
1211
+ *
1212
+ * Conversations whose contact or messages contain the text, latest activity first. Answers one page of at most `limit`; `next_cursor` is always null.
1213
+ *
1214
+ * Scope: `conversations:read`.
1215
+ */
1216
+ searchConversations(options) {
1217
+ return (options.client ?? this.client).get({
1218
+ responseStyle: 'data',
1219
+ security: [{ scheme: 'bearer', type: 'http' }],
1220
+ url: '/conversations/search',
1221
+ ...options
1222
+ });
1223
+ }
1224
+ /**
1225
+ * Change a conversation's tags
1226
+ *
1227
+ * Tags belong to the conversation's contact: this adds and removes tags on it and answers the contact.
1228
+ *
1229
+ * Scope: `contacts:write`.
1230
+ */
1231
+ changeConversationTags(options) {
1232
+ return (options.client ?? this.client).patch({
1233
+ responseStyle: 'data',
1234
+ security: [{ scheme: 'bearer', type: 'http' }],
1235
+ url: '/conversations/{conversation_id}/tags',
1236
+ ...options,
1237
+ headers: {
1238
+ 'Content-Type': 'application/json',
1239
+ ...options.headers
1240
+ }
1241
+ });
1242
+ }
1243
+ /**
1244
+ * Mark a conversation read
1245
+ *
1246
+ * Marks it read for the whole team through its latest message, as opening it in the inbox does. On WhatsApp the contact sees the read receipt. Send no body.
1247
+ *
1248
+ * Scope: `conversations:write`.
1249
+ */
1250
+ markConversationRead(options) {
1251
+ return (options.client ?? this.client).post({
1252
+ responseStyle: 'data',
1253
+ security: [{ scheme: 'bearer', type: 'http' }],
1254
+ url: '/conversations/{conversation_id}/read',
1255
+ ...options
1256
+ });
1257
+ }
1258
+ /**
1259
+ * Search messages
1260
+ *
1261
+ * Messages of every conversation that contain the words, newest first. Answers one page of at most `limit`; `next_cursor` is always null.
1262
+ *
1263
+ * Scope: `conversations:read`.
1264
+ */
1265
+ searchMessages(options) {
1266
+ return (options.client ?? this.client).get({
1267
+ responseStyle: 'data',
1268
+ security: [{ scheme: 'bearer', type: 'http' }],
1269
+ url: '/messages/search',
1270
+ ...options
1271
+ });
1272
+ }
1273
+ /**
1274
+ * List quick replies
1275
+ *
1276
+ * Every quick reply of the organization, by title.
1277
+ *
1278
+ * Scope: `quick_replies:read`.
1279
+ */
1280
+ listQuickReplies(options) {
1281
+ return (options?.client ?? this.client).get({
1282
+ responseStyle: 'data',
1283
+ security: [{ scheme: 'bearer', type: 'http' }],
1284
+ url: '/quick-replies',
1285
+ ...options
1286
+ });
1287
+ }
1288
+ /**
1289
+ * Create a quick reply
1290
+ *
1291
+ * Saves an answer operators can insert in the inbox. A title already in use, in any case, answers `409 conflict`.
1292
+ *
1293
+ * Scope: `quick_replies:write`.
1294
+ */
1295
+ createQuickReply(options) {
1296
+ return (options.client ?? this.client).post({
1297
+ responseStyle: 'data',
1298
+ security: [{ scheme: 'bearer', type: 'http' }],
1299
+ url: '/quick-replies',
1300
+ ...options,
1301
+ headers: {
1302
+ 'Content-Type': 'application/json',
1303
+ ...options.headers
1304
+ }
1305
+ });
1306
+ }
1307
+ /**
1308
+ * Delete a quick reply
1309
+ *
1310
+ * Deletes it and answers it as it was. It cannot be undone.
1311
+ *
1312
+ * Scope: `quick_replies:write`.
1313
+ */
1314
+ deleteQuickReply(options) {
1315
+ return (options.client ?? this.client).delete({
1316
+ responseStyle: 'data',
1317
+ security: [{ scheme: 'bearer', type: 'http' }],
1318
+ url: '/quick-replies/{quick_reply_id}',
1319
+ ...options
1320
+ });
1321
+ }
1322
+ /**
1323
+ * Get a quick reply
1324
+ *
1325
+ * One quick reply.
1326
+ *
1327
+ * Scope: `quick_replies:read`.
1328
+ */
1329
+ getQuickReply(options) {
1330
+ return (options.client ?? this.client).get({
1331
+ responseStyle: 'data',
1332
+ security: [{ scheme: 'bearer', type: 'http' }],
1333
+ url: '/quick-replies/{quick_reply_id}',
1334
+ ...options
1335
+ });
1336
+ }
1337
+ /**
1338
+ * Update a quick reply
1339
+ *
1340
+ * Changes only the fields in the body. A title already in use, in any case, answers `409 conflict`.
1341
+ *
1342
+ * Scope: `quick_replies:write`.
1343
+ */
1344
+ updateQuickReply(options) {
1345
+ return (options.client ?? this.client).patch({
1346
+ responseStyle: 'data',
1347
+ security: [{ scheme: 'bearer', type: 'http' }],
1348
+ url: '/quick-replies/{quick_reply_id}',
1349
+ ...options,
1350
+ headers: {
1351
+ 'Content-Type': 'application/json',
1352
+ ...options.headers
1353
+ }
1354
+ });
1355
+ }
737
1356
  }