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