getricky 0.1.4 → 0.1.6

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({
@@ -358,21 +377,6 @@ export class RickyApi extends HeyApiClient {
358
377
  }
359
378
  });
360
379
  }
361
- /**
362
- * List templates
363
- *
364
- * WhatsApp templates of every connected business account, read live from Meta.
365
- *
366
- * Scope: `templates:read`.
367
- */
368
- listTemplates(options) {
369
- return (options?.client ?? this.client).get({
370
- responseStyle: 'data',
371
- security: [{ scheme: 'bearer', type: 'http' }],
372
- url: '/templates',
373
- ...options
374
- });
375
- }
376
380
  /**
377
381
  * List webhooks
378
382
  *
@@ -1119,4 +1123,351 @@ export class RickyApi extends HeyApiClient {
1119
1123
  }
1120
1124
  });
1121
1125
  }
1126
+ /**
1127
+ * Change tags on many contacts
1128
+ *
1129
+ * 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.
1130
+ *
1131
+ * Scope: `contacts:write`.
1132
+ */
1133
+ changeContactsTags(options) {
1134
+ return (options.client ?? this.client).post({
1135
+ responseStyle: 'data',
1136
+ security: [{ scheme: 'bearer', type: 'http' }],
1137
+ url: '/contacts/tags',
1138
+ ...options,
1139
+ headers: {
1140
+ 'Content-Type': 'application/json',
1141
+ ...options.headers
1142
+ }
1143
+ });
1144
+ }
1145
+ /**
1146
+ * Delete a contact field
1147
+ *
1148
+ * Deletes the field and its value on every contact, and answers the field as it was. It cannot be undone.
1149
+ *
1150
+ * Scope: `contacts:write`.
1151
+ */
1152
+ deleteContactField(options) {
1153
+ return (options.client ?? this.client).delete({
1154
+ responseStyle: 'data',
1155
+ security: [{ scheme: 'bearer', type: 'http' }],
1156
+ url: '/contact-fields/{field_id}',
1157
+ ...options
1158
+ });
1159
+ }
1160
+ /**
1161
+ * Delete a tag
1162
+ *
1163
+ * Deletes the tag and removes it from every contact, and answers the tag as it was. It cannot be undone.
1164
+ *
1165
+ * Scope: `tags:write`.
1166
+ */
1167
+ deleteTag(options) {
1168
+ return (options.client ?? this.client).delete({
1169
+ responseStyle: 'data',
1170
+ security: [{ scheme: 'bearer', type: 'http' }],
1171
+ url: '/tags/{tag_id}',
1172
+ ...options
1173
+ });
1174
+ }
1175
+ /**
1176
+ * Update a tag
1177
+ *
1178
+ * Renames or recolors a tag on every contact that has it. A name already in use, in any case, answers `409 conflict`.
1179
+ *
1180
+ * Scope: `tags:write`.
1181
+ */
1182
+ updateTag(options) {
1183
+ return (options.client ?? this.client).patch({
1184
+ responseStyle: 'data',
1185
+ security: [{ scheme: 'bearer', type: 'http' }],
1186
+ url: '/tags/{tag_id}',
1187
+ ...options,
1188
+ headers: {
1189
+ 'Content-Type': 'application/json',
1190
+ ...options.headers
1191
+ }
1192
+ });
1193
+ }
1194
+ /**
1195
+ * Search conversations
1196
+ *
1197
+ * Conversations whose contact or messages contain the text, latest activity first. Answers one page of at most `limit`; `next_cursor` is always null.
1198
+ *
1199
+ * Scope: `conversations:read`.
1200
+ */
1201
+ searchConversations(options) {
1202
+ return (options.client ?? this.client).get({
1203
+ responseStyle: 'data',
1204
+ security: [{ scheme: 'bearer', type: 'http' }],
1205
+ url: '/conversations/search',
1206
+ ...options
1207
+ });
1208
+ }
1209
+ /**
1210
+ * Change a conversation's tags
1211
+ *
1212
+ * Tags belong to the conversation's contact: this adds and removes tags on it and answers the contact.
1213
+ *
1214
+ * Scope: `contacts:write`.
1215
+ */
1216
+ changeConversationTags(options) {
1217
+ return (options.client ?? this.client).patch({
1218
+ responseStyle: 'data',
1219
+ security: [{ scheme: 'bearer', type: 'http' }],
1220
+ url: '/conversations/{conversation_id}/tags',
1221
+ ...options,
1222
+ headers: {
1223
+ 'Content-Type': 'application/json',
1224
+ ...options.headers
1225
+ }
1226
+ });
1227
+ }
1228
+ /**
1229
+ * Mark a conversation read
1230
+ *
1231
+ * 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.
1232
+ *
1233
+ * Scope: `conversations:write`.
1234
+ */
1235
+ markConversationRead(options) {
1236
+ return (options.client ?? this.client).post({
1237
+ responseStyle: 'data',
1238
+ security: [{ scheme: 'bearer', type: 'http' }],
1239
+ url: '/conversations/{conversation_id}/read',
1240
+ ...options
1241
+ });
1242
+ }
1243
+ /**
1244
+ * Search messages
1245
+ *
1246
+ * Messages of every conversation that contain the words, newest first. Answers one page of at most `limit`; `next_cursor` is always null.
1247
+ *
1248
+ * Scope: `conversations:read`.
1249
+ */
1250
+ searchMessages(options) {
1251
+ return (options.client ?? this.client).get({
1252
+ responseStyle: 'data',
1253
+ security: [{ scheme: 'bearer', type: 'http' }],
1254
+ url: '/messages/search',
1255
+ ...options
1256
+ });
1257
+ }
1258
+ /**
1259
+ * List quick replies
1260
+ *
1261
+ * Every quick reply of the organization, by title.
1262
+ *
1263
+ * Scope: `quick_replies:read`.
1264
+ */
1265
+ listQuickReplies(options) {
1266
+ return (options?.client ?? this.client).get({
1267
+ responseStyle: 'data',
1268
+ security: [{ scheme: 'bearer', type: 'http' }],
1269
+ url: '/quick-replies',
1270
+ ...options
1271
+ });
1272
+ }
1273
+ /**
1274
+ * Create a quick reply
1275
+ *
1276
+ * Saves an answer operators can insert in the inbox. A title already in use, in any case, answers `409 conflict`.
1277
+ *
1278
+ * Scope: `quick_replies:write`.
1279
+ */
1280
+ createQuickReply(options) {
1281
+ return (options.client ?? this.client).post({
1282
+ responseStyle: 'data',
1283
+ security: [{ scheme: 'bearer', type: 'http' }],
1284
+ url: '/quick-replies',
1285
+ ...options,
1286
+ headers: {
1287
+ 'Content-Type': 'application/json',
1288
+ ...options.headers
1289
+ }
1290
+ });
1291
+ }
1292
+ /**
1293
+ * Delete a quick reply
1294
+ *
1295
+ * Deletes it and answers it as it was. It cannot be undone.
1296
+ *
1297
+ * Scope: `quick_replies:write`.
1298
+ */
1299
+ deleteQuickReply(options) {
1300
+ return (options.client ?? this.client).delete({
1301
+ responseStyle: 'data',
1302
+ security: [{ scheme: 'bearer', type: 'http' }],
1303
+ url: '/quick-replies/{quick_reply_id}',
1304
+ ...options
1305
+ });
1306
+ }
1307
+ /**
1308
+ * Get a quick reply
1309
+ *
1310
+ * One quick reply.
1311
+ *
1312
+ * Scope: `quick_replies:read`.
1313
+ */
1314
+ getQuickReply(options) {
1315
+ return (options.client ?? this.client).get({
1316
+ responseStyle: 'data',
1317
+ security: [{ scheme: 'bearer', type: 'http' }],
1318
+ url: '/quick-replies/{quick_reply_id}',
1319
+ ...options
1320
+ });
1321
+ }
1322
+ /**
1323
+ * Update a quick reply
1324
+ *
1325
+ * Changes only the fields in the body. A title already in use, in any case, answers `409 conflict`.
1326
+ *
1327
+ * Scope: `quick_replies:write`.
1328
+ */
1329
+ updateQuickReply(options) {
1330
+ return (options.client ?? this.client).patch({
1331
+ responseStyle: 'data',
1332
+ security: [{ scheme: 'bearer', type: 'http' }],
1333
+ url: '/quick-replies/{quick_reply_id}',
1334
+ ...options,
1335
+ headers: {
1336
+ 'Content-Type': 'application/json',
1337
+ ...options.headers
1338
+ }
1339
+ });
1340
+ }
1341
+ /**
1342
+ * List templates
1343
+ *
1344
+ * WhatsApp templates of every connected business account, read live from Meta.
1345
+ *
1346
+ * Scope: `templates:read`.
1347
+ */
1348
+ listTemplates(options) {
1349
+ return (options?.client ?? this.client).get({
1350
+ responseStyle: 'data',
1351
+ security: [{ scheme: 'bearer', type: 'http' }],
1352
+ url: '/templates',
1353
+ ...options
1354
+ });
1355
+ }
1356
+ /**
1357
+ * Create a template
1358
+ *
1359
+ * Submits a template to Meta for review from the business account of `channel_id`. It answers the template as Meta has it, usually `PENDING`; follow it with `GET /templates/{template_id}`. A draft that breaks a rule answers `400` with the first problem; Meta refusing it answers `422 rule_violation` with its reason.
1360
+ *
1361
+ * Scope: `templates:write`.
1362
+ */
1363
+ createTemplate(options) {
1364
+ return (options.client ?? this.client).post({
1365
+ responseStyle: 'data',
1366
+ security: [{ scheme: 'bearer', type: 'http' }],
1367
+ url: '/templates',
1368
+ ...options,
1369
+ headers: {
1370
+ 'Content-Type': 'application/json',
1371
+ ...options.headers
1372
+ }
1373
+ });
1374
+ }
1375
+ /**
1376
+ * Delete a template
1377
+ *
1378
+ * Deletes the template at Meta. Meta deletes it in every language that shares its name, and the name cannot be used again for 30 days.
1379
+ *
1380
+ * Scope: `templates:write`.
1381
+ */
1382
+ deleteTemplate(options) {
1383
+ return (options.client ?? this.client).delete({
1384
+ responseStyle: 'data',
1385
+ security: [{ scheme: 'bearer', type: 'http' }],
1386
+ url: '/templates/{template_id}',
1387
+ ...options
1388
+ });
1389
+ }
1390
+ /**
1391
+ * Get a template
1392
+ *
1393
+ * One template, read live from Meta, with its review `status`: `PENDING` while Meta reviews it, then `APPROVED`, `REJECTED` or `PAUSED`. Read it again to follow Meta's review.
1394
+ *
1395
+ * Scope: `templates:read`.
1396
+ */
1397
+ getTemplate(options) {
1398
+ return (options.client ?? this.client).get({
1399
+ responseStyle: 'data',
1400
+ security: [{ scheme: 'bearer', type: 'http' }],
1401
+ url: '/templates/{template_id}',
1402
+ ...options
1403
+ });
1404
+ }
1405
+ /**
1406
+ * Edit a template
1407
+ *
1408
+ * Changes the category or content of a template and sends it to Meta for review again. Meta allows it only for `APPROVED`, `REJECTED` and `PAUSED` templates, and limits how often an approved one can change; otherwise it answers `422 rule_violation`. Templates with a media header, or with buttons and components Ricky’s editor does not build, cannot be edited here.
1409
+ *
1410
+ * Scope: `templates:write`.
1411
+ */
1412
+ updateTemplate(options) {
1413
+ return (options.client ?? this.client).patch({
1414
+ responseStyle: 'data',
1415
+ security: [{ scheme: 'bearer', type: 'http' }],
1416
+ url: '/templates/{template_id}',
1417
+ ...options,
1418
+ headers: {
1419
+ 'Content-Type': 'application/json',
1420
+ ...options.headers
1421
+ }
1422
+ });
1423
+ }
1424
+ /**
1425
+ * Validate a template draft
1426
+ *
1427
+ * Checks a draft with the rules of Ricky’s template editor and answers every problem found, without submitting anything to Meta. A body that is not a draft answers `400`; a draft that breaks a rule answers `200` with `valid: false`. Meta can still reject a valid draft in its review.
1428
+ *
1429
+ * Scope: `templates:read`.
1430
+ */
1431
+ validateTemplate(options) {
1432
+ return (options.client ?? this.client).post({
1433
+ responseStyle: 'data',
1434
+ security: [{ scheme: 'bearer', type: 'http' }],
1435
+ url: '/templates/validate',
1436
+ ...options,
1437
+ headers: {
1438
+ 'Content-Type': 'application/json',
1439
+ ...options.headers
1440
+ }
1441
+ });
1442
+ }
1443
+ /**
1444
+ * List WhatsApp numbers
1445
+ *
1446
+ * Every WhatsApp number of the organization, also disconnected ones, with its status, quality rating and messaging limit as Ricky last read them from Meta.
1447
+ *
1448
+ * Scope: `conversations:read`.
1449
+ */
1450
+ listWhatsAppNumbers(options) {
1451
+ return (options?.client ?? this.client).get({
1452
+ responseStyle: 'data',
1453
+ security: [{ scheme: 'bearer', type: 'http' }],
1454
+ url: '/whatsapp-numbers',
1455
+ ...options
1456
+ });
1457
+ }
1458
+ /**
1459
+ * Get a WhatsApp number
1460
+ *
1461
+ * One WhatsApp number by its channel ID.
1462
+ *
1463
+ * Scope: `conversations:read`.
1464
+ */
1465
+ getWhatsAppNumber(options) {
1466
+ return (options.client ?? this.client).get({
1467
+ responseStyle: 'data',
1468
+ security: [{ scheme: 'bearer', type: 'http' }],
1469
+ url: '/whatsapp-numbers/{channel_id}',
1470
+ ...options
1471
+ });
1472
+ }
1122
1473
  }