@medalsocial/sdk 1.2.1 → 1.3.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.
@@ -45,6 +45,14 @@
45
45
  {
46
46
  "name": "Workspaces",
47
47
  "description": "Inspect workspaces accessible to the current credential."
48
+ },
49
+ {
50
+ "name": "Helpdesk",
51
+ "description": "Read helpdesk conversations, reply, and manage assignment/status."
52
+ },
53
+ {
54
+ "name": "Webhooks",
55
+ "description": "Manage webhook endpoints and inspect their deliveries."
48
56
  }
49
57
  ],
50
58
  "paths": {
@@ -1129,111 +1137,550 @@
1129
1137
  }
1130
1138
  }
1131
1139
  }
1132
- }
1133
- },
1134
- "components": {
1135
- "securitySchemes": {
1136
- "bearerAuth": {
1137
- "type": "http",
1138
- "scheme": "bearer"
1139
- }
1140
1140
  },
1141
- "parameters": {
1142
- "Id": {
1143
- "name": "id",
1144
- "in": "path",
1145
- "required": true,
1146
- "schema": {
1147
- "type": "string"
1141
+ "/api/v1/helpdesk/conversations": {
1142
+ "get": {
1143
+ "tags": [
1144
+ "Helpdesk"
1145
+ ],
1146
+ "operationId": "listHelpdeskConversations",
1147
+ "summary": "List helpdesk conversations",
1148
+ "parameters": [
1149
+ {
1150
+ "name": "limit",
1151
+ "in": "query",
1152
+ "schema": {
1153
+ "type": "integer",
1154
+ "minimum": 1,
1155
+ "maximum": 100
1156
+ }
1157
+ },
1158
+ {
1159
+ "$ref": "#/components/parameters/Cursor"
1160
+ },
1161
+ {
1162
+ "name": "status",
1163
+ "in": "query",
1164
+ "schema": {
1165
+ "$ref": "#/components/schemas/HelpdeskConversationStatus"
1166
+ }
1167
+ },
1168
+ {
1169
+ "name": "assignee_user_id",
1170
+ "in": "query",
1171
+ "schema": {
1172
+ "type": "string"
1173
+ },
1174
+ "description": "Only conversations assigned to this user."
1175
+ },
1176
+ {
1177
+ "name": "requester",
1178
+ "in": "query",
1179
+ "schema": {
1180
+ "type": "string"
1181
+ },
1182
+ "description": "Match against visitor name/email."
1183
+ },
1184
+ {
1185
+ "name": "query",
1186
+ "in": "query",
1187
+ "schema": {
1188
+ "type": "string"
1189
+ },
1190
+ "description": "Free-text search query."
1191
+ },
1192
+ {
1193
+ "name": "channels",
1194
+ "in": "query",
1195
+ "schema": {
1196
+ "type": "string"
1197
+ },
1198
+ "description": "Comma-separated channel types (e.g. `widget,whatsapp`)."
1199
+ }
1200
+ ],
1201
+ "responses": {
1202
+ "200": {
1203
+ "description": "Conversations page.",
1204
+ "content": {
1205
+ "application/json": {
1206
+ "schema": {
1207
+ "$ref": "#/components/schemas/PaginatedResponse_HelpdeskConversation"
1208
+ }
1209
+ }
1210
+ }
1211
+ },
1212
+ "default": {
1213
+ "$ref": "#/components/responses/ApiError"
1214
+ }
1148
1215
  }
1149
- },
1150
- "Slug": {
1151
- "name": "slug",
1152
- "in": "path",
1153
- "required": true,
1154
- "schema": {
1155
- "type": "string"
1216
+ }
1217
+ },
1218
+ "/api/v1/helpdesk/conversations/{id}": {
1219
+ "parameters": [
1220
+ {
1221
+ "$ref": "#/components/parameters/Id"
1156
1222
  }
1157
- },
1158
- "Cursor": {
1159
- "name": "cursor",
1160
- "in": "query",
1161
- "schema": {
1162
- "type": "string"
1223
+ ],
1224
+ "get": {
1225
+ "tags": [
1226
+ "Helpdesk"
1227
+ ],
1228
+ "operationId": "getHelpdeskConversation",
1229
+ "summary": "Get a helpdesk conversation",
1230
+ "responses": {
1231
+ "200": {
1232
+ "description": "Conversation.",
1233
+ "content": {
1234
+ "application/json": {
1235
+ "schema": {
1236
+ "$ref": "#/components/schemas/Envelope_HelpdeskConversation"
1237
+ }
1238
+ }
1239
+ }
1240
+ },
1241
+ "default": {
1242
+ "$ref": "#/components/responses/ApiError"
1243
+ }
1163
1244
  }
1164
1245
  },
1165
- "Limit": {
1166
- "name": "limit",
1167
- "in": "query",
1168
- "schema": {
1169
- "type": "integer",
1170
- "minimum": 1,
1171
- "maximum": 500
1246
+ "patch": {
1247
+ "tags": [
1248
+ "Helpdesk"
1249
+ ],
1250
+ "operationId": "updateHelpdeskConversation",
1251
+ "summary": "Update a conversation's status or assignee",
1252
+ "description": "Set `status` and/or `assignee_user_id` (`null` unassigns). At least one field is required. Capability-scoped tokens must send `Idempotency-Key` and `X-Capability-Confirmation` headers on this route; API keys with legacy scopes may omit them.",
1253
+ "requestBody": {
1254
+ "required": true,
1255
+ "content": {
1256
+ "application/json": {
1257
+ "schema": {
1258
+ "$ref": "#/components/schemas/UpdateHelpdeskConversationInput"
1259
+ }
1260
+ }
1261
+ }
1262
+ },
1263
+ "responses": {
1264
+ "200": {
1265
+ "description": "Update result.",
1266
+ "content": {
1267
+ "application/json": {
1268
+ "schema": {
1269
+ "$ref": "#/components/schemas/Envelope_HelpdeskConversationUpdateResult"
1270
+ }
1271
+ }
1272
+ }
1273
+ },
1274
+ "default": {
1275
+ "$ref": "#/components/responses/ApiError"
1276
+ }
1172
1277
  }
1173
1278
  }
1174
1279
  },
1175
- "responses": {
1176
- "ApiError": {
1177
- "description": "API error.",
1178
- "content": {
1179
- "application/json": {
1280
+ "/api/v1/helpdesk/conversations/{id}/messages": {
1281
+ "parameters": [
1282
+ {
1283
+ "$ref": "#/components/parameters/Id"
1284
+ }
1285
+ ],
1286
+ "get": {
1287
+ "tags": [
1288
+ "Helpdesk"
1289
+ ],
1290
+ "operationId": "listHelpdeskConversationMessages",
1291
+ "summary": "List conversation messages",
1292
+ "parameters": [
1293
+ {
1294
+ "name": "limit",
1295
+ "in": "query",
1180
1296
  "schema": {
1181
- "$ref": "#/components/schemas/ApiError"
1297
+ "type": "integer",
1298
+ "minimum": 1,
1299
+ "maximum": 50
1300
+ }
1301
+ },
1302
+ {
1303
+ "$ref": "#/components/parameters/Cursor"
1304
+ }
1305
+ ],
1306
+ "responses": {
1307
+ "200": {
1308
+ "description": "Messages page.",
1309
+ "content": {
1310
+ "application/json": {
1311
+ "schema": {
1312
+ "$ref": "#/components/schemas/PaginatedResponse_HelpdeskMessage"
1313
+ }
1314
+ }
1315
+ }
1316
+ },
1317
+ "404": {
1318
+ "description": "Conversation not found.",
1319
+ "content": {
1320
+ "application/json": {
1321
+ "schema": {
1322
+ "$ref": "#/components/schemas/ApiError"
1323
+ }
1324
+ }
1182
1325
  }
1326
+ },
1327
+ "default": {
1328
+ "$ref": "#/components/responses/ApiError"
1183
1329
  }
1184
1330
  }
1185
1331
  }
1186
1332
  },
1187
- "schemas": {
1188
- "ApiError": {
1189
- "type": "object",
1190
- "required": [
1191
- "error"
1333
+ "/api/v1/helpdesk/replies": {
1334
+ "post": {
1335
+ "tags": [
1336
+ "Helpdesk"
1192
1337
  ],
1193
- "properties": {
1194
- "error": {
1195
- "type": "object",
1196
- "required": [
1197
- "code",
1198
- "message"
1199
- ],
1200
- "properties": {
1201
- "code": {
1202
- "type": "string"
1203
- },
1204
- "message": {
1205
- "type": "string"
1206
- },
1207
- "details": true
1338
+ "operationId": "createHelpdeskReply",
1339
+ "summary": "Send an operator reply or internal note",
1340
+ "description": "Send an `Idempotency-Key` header so retried requests do not create duplicate messages — it is required for capability-scoped tokens (together with `X-Capability-Confirmation`).",
1341
+ "requestBody": {
1342
+ "required": true,
1343
+ "content": {
1344
+ "application/json": {
1345
+ "schema": {
1346
+ "$ref": "#/components/schemas/CreateHelpdeskReplyInput"
1347
+ }
1208
1348
  }
1209
1349
  }
1350
+ },
1351
+ "responses": {
1352
+ "201": {
1353
+ "description": "Created reply reference.",
1354
+ "content": {
1355
+ "application/json": {
1356
+ "schema": {
1357
+ "$ref": "#/components/schemas/Envelope_HelpdeskReplyCreateResult"
1358
+ }
1359
+ }
1360
+ }
1361
+ },
1362
+ "default": {
1363
+ "$ref": "#/components/responses/ApiError"
1364
+ }
1210
1365
  }
1211
- },
1212
- "Pagination": {
1213
- "type": "object",
1214
- "required": [
1215
- "has_more",
1216
- "next_cursor"
1366
+ }
1367
+ },
1368
+ "/api/v1/webhooks": {
1369
+ "get": {
1370
+ "tags": [
1371
+ "Webhooks"
1217
1372
  ],
1218
- "properties": {
1219
- "has_more": {
1220
- "type": "boolean"
1373
+ "operationId": "listWebhooks",
1374
+ "summary": "List webhook endpoints",
1375
+ "responses": {
1376
+ "200": {
1377
+ "description": "Webhook endpoints.",
1378
+ "content": {
1379
+ "application/json": {
1380
+ "schema": {
1381
+ "$ref": "#/components/schemas/Envelope_WebhookEndpointArray"
1382
+ }
1383
+ }
1384
+ }
1221
1385
  },
1222
- "next_cursor": {
1223
- "type": [
1224
- "string",
1225
- "null"
1226
- ]
1386
+ "default": {
1387
+ "$ref": "#/components/responses/ApiError"
1227
1388
  }
1228
1389
  }
1229
1390
  },
1230
- "Success": {
1231
- "type": "object",
1232
- "required": [
1233
- "success"
1391
+ "post": {
1392
+ "tags": [
1393
+ "Webhooks"
1234
1394
  ],
1235
- "properties": {
1236
- "success": {
1395
+ "operationId": "createWebhook",
1396
+ "summary": "Create a webhook endpoint",
1397
+ "description": "The response's `data.secret` contains the signing secret EXACTLY ONCE — it can never be retrieved again, so store it securely immediately. An idempotent replay (same `Idempotency-Key`) returns the existing endpoint WITHOUT `secret`. Deliveries are HTTP POSTs signed with `X-Medal-Signature: sha256=<base64(HMAC-SHA256(\"{timestamp}.{rawBody}\", secret))>` plus `X-Medal-Timestamp`, `X-Medal-Event`, and `X-Medal-Delivery-Id` / `Idempotency-Key` headers.",
1398
+ "requestBody": {
1399
+ "required": true,
1400
+ "content": {
1401
+ "application/json": {
1402
+ "schema": {
1403
+ "$ref": "#/components/schemas/CreateWebhookInput"
1404
+ }
1405
+ }
1406
+ }
1407
+ },
1408
+ "responses": {
1409
+ "201": {
1410
+ "description": "Created endpoint, including the one-time `secret`.",
1411
+ "content": {
1412
+ "application/json": {
1413
+ "schema": {
1414
+ "$ref": "#/components/schemas/Envelope_WebhookEndpoint"
1415
+ }
1416
+ }
1417
+ }
1418
+ },
1419
+ "default": {
1420
+ "$ref": "#/components/responses/ApiError"
1421
+ }
1422
+ }
1423
+ }
1424
+ },
1425
+ "/api/v1/webhooks/{id}": {
1426
+ "parameters": [
1427
+ {
1428
+ "$ref": "#/components/parameters/Id"
1429
+ }
1430
+ ],
1431
+ "get": {
1432
+ "tags": [
1433
+ "Webhooks"
1434
+ ],
1435
+ "operationId": "getWebhook",
1436
+ "summary": "Get a webhook endpoint",
1437
+ "responses": {
1438
+ "200": {
1439
+ "description": "Webhook endpoint.",
1440
+ "content": {
1441
+ "application/json": {
1442
+ "schema": {
1443
+ "$ref": "#/components/schemas/Envelope_WebhookEndpoint"
1444
+ }
1445
+ }
1446
+ }
1447
+ },
1448
+ "default": {
1449
+ "$ref": "#/components/responses/ApiError"
1450
+ }
1451
+ }
1452
+ },
1453
+ "patch": {
1454
+ "tags": [
1455
+ "Webhooks"
1456
+ ],
1457
+ "operationId": "updateWebhook",
1458
+ "summary": "Update a webhook endpoint",
1459
+ "description": "Only provided fields change. Pass `null` for `channels` or `channel_connection_ids` to clear that filter.",
1460
+ "requestBody": {
1461
+ "required": true,
1462
+ "content": {
1463
+ "application/json": {
1464
+ "schema": {
1465
+ "$ref": "#/components/schemas/UpdateWebhookInput"
1466
+ }
1467
+ }
1468
+ }
1469
+ },
1470
+ "responses": {
1471
+ "200": {
1472
+ "description": "Updated endpoint.",
1473
+ "content": {
1474
+ "application/json": {
1475
+ "schema": {
1476
+ "$ref": "#/components/schemas/Envelope_WebhookEndpoint"
1477
+ }
1478
+ }
1479
+ }
1480
+ },
1481
+ "default": {
1482
+ "$ref": "#/components/responses/ApiError"
1483
+ }
1484
+ }
1485
+ },
1486
+ "delete": {
1487
+ "tags": [
1488
+ "Webhooks"
1489
+ ],
1490
+ "operationId": "deleteWebhook",
1491
+ "summary": "Delete a webhook endpoint",
1492
+ "description": "Permanently deletes the endpoint and stops all outbound deliveries. Capability-scoped tokens must send `Idempotency-Key` and `X-Capability-Confirmation` headers on this route; API keys with legacy scopes may omit them.",
1493
+ "responses": {
1494
+ "200": {
1495
+ "description": "Delete result.",
1496
+ "content": {
1497
+ "application/json": {
1498
+ "schema": {
1499
+ "$ref": "#/components/schemas/Envelope_WebhookDeleteResult"
1500
+ }
1501
+ }
1502
+ }
1503
+ },
1504
+ "default": {
1505
+ "$ref": "#/components/responses/ApiError"
1506
+ }
1507
+ }
1508
+ }
1509
+ },
1510
+ "/api/v1/webhooks/{id}/deliveries": {
1511
+ "parameters": [
1512
+ {
1513
+ "$ref": "#/components/parameters/Id"
1514
+ }
1515
+ ],
1516
+ "get": {
1517
+ "tags": [
1518
+ "Webhooks"
1519
+ ],
1520
+ "operationId": "listWebhookDeliveries",
1521
+ "summary": "List recent deliveries",
1522
+ "parameters": [
1523
+ {
1524
+ "name": "limit",
1525
+ "in": "query",
1526
+ "schema": {
1527
+ "type": "integer",
1528
+ "minimum": 1,
1529
+ "maximum": 100
1530
+ }
1531
+ }
1532
+ ],
1533
+ "responses": {
1534
+ "200": {
1535
+ "description": "Recent deliveries, most recent first.",
1536
+ "content": {
1537
+ "application/json": {
1538
+ "schema": {
1539
+ "$ref": "#/components/schemas/Envelope_WebhookDeliveryArray"
1540
+ }
1541
+ }
1542
+ }
1543
+ },
1544
+ "default": {
1545
+ "$ref": "#/components/responses/ApiError"
1546
+ }
1547
+ }
1548
+ }
1549
+ },
1550
+ "/api/v1/webhooks/{id}/test": {
1551
+ "parameters": [
1552
+ {
1553
+ "$ref": "#/components/parameters/Id"
1554
+ }
1555
+ ],
1556
+ "post": {
1557
+ "tags": [
1558
+ "Webhooks"
1559
+ ],
1560
+ "operationId": "testWebhook",
1561
+ "summary": "Queue a test delivery",
1562
+ "description": "Queues a signed `test.ping` delivery to the endpoint.",
1563
+ "responses": {
1564
+ "202": {
1565
+ "description": "Test delivery queued.",
1566
+ "content": {
1567
+ "application/json": {
1568
+ "schema": {
1569
+ "$ref": "#/components/schemas/Envelope_WebhookTestResult"
1570
+ }
1571
+ }
1572
+ }
1573
+ },
1574
+ "default": {
1575
+ "$ref": "#/components/responses/ApiError"
1576
+ }
1577
+ }
1578
+ }
1579
+ }
1580
+ },
1581
+ "components": {
1582
+ "securitySchemes": {
1583
+ "bearerAuth": {
1584
+ "type": "http",
1585
+ "scheme": "bearer"
1586
+ }
1587
+ },
1588
+ "parameters": {
1589
+ "Id": {
1590
+ "name": "id",
1591
+ "in": "path",
1592
+ "required": true,
1593
+ "schema": {
1594
+ "type": "string"
1595
+ }
1596
+ },
1597
+ "Slug": {
1598
+ "name": "slug",
1599
+ "in": "path",
1600
+ "required": true,
1601
+ "schema": {
1602
+ "type": "string"
1603
+ }
1604
+ },
1605
+ "Cursor": {
1606
+ "name": "cursor",
1607
+ "in": "query",
1608
+ "schema": {
1609
+ "type": "string"
1610
+ }
1611
+ },
1612
+ "Limit": {
1613
+ "name": "limit",
1614
+ "in": "query",
1615
+ "schema": {
1616
+ "type": "integer",
1617
+ "minimum": 1,
1618
+ "maximum": 500
1619
+ }
1620
+ }
1621
+ },
1622
+ "responses": {
1623
+ "ApiError": {
1624
+ "description": "API error.",
1625
+ "content": {
1626
+ "application/json": {
1627
+ "schema": {
1628
+ "$ref": "#/components/schemas/ApiError"
1629
+ }
1630
+ }
1631
+ }
1632
+ }
1633
+ },
1634
+ "schemas": {
1635
+ "ApiError": {
1636
+ "type": "object",
1637
+ "required": [
1638
+ "error"
1639
+ ],
1640
+ "properties": {
1641
+ "error": {
1642
+ "type": "object",
1643
+ "required": [
1644
+ "code",
1645
+ "message"
1646
+ ],
1647
+ "properties": {
1648
+ "code": {
1649
+ "type": "string"
1650
+ },
1651
+ "message": {
1652
+ "type": "string"
1653
+ },
1654
+ "details": true
1655
+ }
1656
+ }
1657
+ }
1658
+ },
1659
+ "Pagination": {
1660
+ "type": "object",
1661
+ "required": [
1662
+ "has_more",
1663
+ "next_cursor"
1664
+ ],
1665
+ "properties": {
1666
+ "has_more": {
1667
+ "type": "boolean"
1668
+ },
1669
+ "next_cursor": {
1670
+ "type": [
1671
+ "string",
1672
+ "null"
1673
+ ]
1674
+ }
1675
+ }
1676
+ },
1677
+ "Success": {
1678
+ "type": "object",
1679
+ "required": [
1680
+ "success"
1681
+ ],
1682
+ "properties": {
1683
+ "success": {
1237
1684
  "type": "boolean"
1238
1685
  }
1239
1686
  }
@@ -2961,11 +3408,581 @@
2961
3408
  },
2962
3409
  "additionalProperties": true
2963
3410
  },
2964
- "ApiResponse_PostCreateResult": {
2965
- "$ref": "#/components/schemas/Envelope_PostCreateResult"
2966
- },
2967
- "ApiResponse_PostDetail": {
2968
- "$ref": "#/components/schemas/Envelope_PostDetail"
3411
+ "HelpdeskConversationStatus": {
3412
+ "type": "string",
3413
+ "enum": [
3414
+ "open",
3415
+ "snoozed",
3416
+ "closed"
3417
+ ]
3418
+ },
3419
+ "HelpdeskMessageAuthorType": {
3420
+ "type": "string",
3421
+ "enum": [
3422
+ "visitor",
3423
+ "operator",
3424
+ "ai",
3425
+ "system"
3426
+ ]
3427
+ },
3428
+ "HelpdeskMessageType": {
3429
+ "type": "string",
3430
+ "enum": [
3431
+ "chat",
3432
+ "email",
3433
+ "note"
3434
+ ],
3435
+ "description": "`note` is operator-internal and never delivered to the customer."
3436
+ },
3437
+ "HelpdeskConversation": {
3438
+ "type": "object",
3439
+ "required": [
3440
+ "id",
3441
+ "channel",
3442
+ "channel_connection_id",
3443
+ "status",
3444
+ "subject",
3445
+ "assignee_user_id",
3446
+ "contact_id",
3447
+ "visitor_name",
3448
+ "visitor_email",
3449
+ "external_conversation_id",
3450
+ "channel_account_id",
3451
+ "message_count",
3452
+ "unread_for_operator",
3453
+ "last_message_at",
3454
+ "last_message_preview",
3455
+ "last_message_author_type",
3456
+ "created_at",
3457
+ "updated_at"
3458
+ ],
3459
+ "properties": {
3460
+ "id": {
3461
+ "type": "string"
3462
+ },
3463
+ "channel": {
3464
+ "type": "string",
3465
+ "description": "Channel type, e.g. `widget`, `instagram`, `messenger`, `whatsapp`, `email`."
3466
+ },
3467
+ "channel_connection_id": {
3468
+ "type": [
3469
+ "string",
3470
+ "null"
3471
+ ]
3472
+ },
3473
+ "status": {
3474
+ "$ref": "#/components/schemas/HelpdeskConversationStatus"
3475
+ },
3476
+ "subject": {
3477
+ "type": [
3478
+ "string",
3479
+ "null"
3480
+ ]
3481
+ },
3482
+ "assignee_user_id": {
3483
+ "type": [
3484
+ "string",
3485
+ "null"
3486
+ ]
3487
+ },
3488
+ "contact_id": {
3489
+ "type": [
3490
+ "string",
3491
+ "null"
3492
+ ]
3493
+ },
3494
+ "visitor_name": {
3495
+ "type": [
3496
+ "string",
3497
+ "null"
3498
+ ]
3499
+ },
3500
+ "visitor_email": {
3501
+ "type": [
3502
+ "string",
3503
+ "null"
3504
+ ]
3505
+ },
3506
+ "external_conversation_id": {
3507
+ "type": [
3508
+ "string",
3509
+ "null"
3510
+ ]
3511
+ },
3512
+ "channel_account_id": {
3513
+ "type": [
3514
+ "string",
3515
+ "null"
3516
+ ]
3517
+ },
3518
+ "message_count": {
3519
+ "type": "integer"
3520
+ },
3521
+ "unread_for_operator": {
3522
+ "type": "integer"
3523
+ },
3524
+ "last_message_at": {
3525
+ "type": "integer",
3526
+ "description": "Unix timestamp in milliseconds."
3527
+ },
3528
+ "last_message_preview": {
3529
+ "type": [
3530
+ "string",
3531
+ "null"
3532
+ ]
3533
+ },
3534
+ "last_message_author_type": {
3535
+ "anyOf": [
3536
+ {
3537
+ "$ref": "#/components/schemas/HelpdeskMessageAuthorType"
3538
+ },
3539
+ {
3540
+ "type": "null"
3541
+ }
3542
+ ]
3543
+ },
3544
+ "created_at": {
3545
+ "type": "integer",
3546
+ "description": "Unix timestamp in milliseconds."
3547
+ },
3548
+ "updated_at": {
3549
+ "type": "integer",
3550
+ "description": "Unix timestamp in milliseconds."
3551
+ }
3552
+ }
3553
+ },
3554
+ "HelpdeskMessage": {
3555
+ "type": "object",
3556
+ "required": [
3557
+ "id",
3558
+ "conversation_id",
3559
+ "author_type",
3560
+ "message_type",
3561
+ "author_user_id",
3562
+ "author_name",
3563
+ "body",
3564
+ "created_at"
3565
+ ],
3566
+ "properties": {
3567
+ "id": {
3568
+ "type": "string"
3569
+ },
3570
+ "conversation_id": {
3571
+ "type": "string"
3572
+ },
3573
+ "author_type": {
3574
+ "$ref": "#/components/schemas/HelpdeskMessageAuthorType"
3575
+ },
3576
+ "message_type": {
3577
+ "$ref": "#/components/schemas/HelpdeskMessageType"
3578
+ },
3579
+ "author_user_id": {
3580
+ "type": [
3581
+ "string",
3582
+ "null"
3583
+ ]
3584
+ },
3585
+ "author_name": {
3586
+ "type": [
3587
+ "string",
3588
+ "null"
3589
+ ]
3590
+ },
3591
+ "body": {
3592
+ "type": "string"
3593
+ },
3594
+ "created_at": {
3595
+ "type": "integer",
3596
+ "description": "Unix timestamp in milliseconds."
3597
+ }
3598
+ }
3599
+ },
3600
+ "UpdateHelpdeskConversationInput": {
3601
+ "type": "object",
3602
+ "minProperties": 1,
3603
+ "description": "At least one field is required.",
3604
+ "properties": {
3605
+ "status": {
3606
+ "$ref": "#/components/schemas/HelpdeskConversationStatus"
3607
+ },
3608
+ "assignee_user_id": {
3609
+ "type": [
3610
+ "string",
3611
+ "null"
3612
+ ],
3613
+ "description": "User ID to assign, or `null` to unassign."
3614
+ }
3615
+ }
3616
+ },
3617
+ "HelpdeskConversationUpdateResult": {
3618
+ "type": "object",
3619
+ "required": [
3620
+ "id",
3621
+ "status",
3622
+ "assignee_user_id"
3623
+ ],
3624
+ "properties": {
3625
+ "id": {
3626
+ "type": "string"
3627
+ },
3628
+ "status": {
3629
+ "$ref": "#/components/schemas/HelpdeskConversationStatus"
3630
+ },
3631
+ "assignee_user_id": {
3632
+ "type": [
3633
+ "string",
3634
+ "null"
3635
+ ]
3636
+ }
3637
+ }
3638
+ },
3639
+ "CreateHelpdeskReplyInput": {
3640
+ "type": "object",
3641
+ "required": [
3642
+ "conversation_id",
3643
+ "body"
3644
+ ],
3645
+ "properties": {
3646
+ "conversation_id": {
3647
+ "type": "string"
3648
+ },
3649
+ "body": {
3650
+ "type": "string",
3651
+ "maxLength": 20000
3652
+ },
3653
+ "message_type": {
3654
+ "type": "string",
3655
+ "enum": [
3656
+ "chat",
3657
+ "note"
3658
+ ],
3659
+ "description": "`note` = operator-internal note (not delivered to the customer). Default `chat`."
3660
+ },
3661
+ "author_name": {
3662
+ "type": "string",
3663
+ "description": "Agent display name for bridged replies (shown in widget + inbox)."
3664
+ }
3665
+ }
3666
+ },
3667
+ "HelpdeskReplyCreateResult": {
3668
+ "type": "object",
3669
+ "required": [
3670
+ "id",
3671
+ "conversation_id",
3672
+ "status"
3673
+ ],
3674
+ "properties": {
3675
+ "id": {
3676
+ "type": "string"
3677
+ },
3678
+ "conversation_id": {
3679
+ "type": "string"
3680
+ },
3681
+ "status": {
3682
+ "type": "string",
3683
+ "const": "created"
3684
+ }
3685
+ }
3686
+ },
3687
+ "WebhookEndpoint": {
3688
+ "type": "object",
3689
+ "required": [
3690
+ "id",
3691
+ "name",
3692
+ "url",
3693
+ "enabled",
3694
+ "event_types",
3695
+ "channels",
3696
+ "channel_connection_ids",
3697
+ "secret_last4",
3698
+ "consecutive_failures",
3699
+ "last_delivery_at",
3700
+ "last_success_at",
3701
+ "last_error_at",
3702
+ "last_error",
3703
+ "created_at",
3704
+ "updated_at"
3705
+ ],
3706
+ "properties": {
3707
+ "id": {
3708
+ "type": "string"
3709
+ },
3710
+ "name": {
3711
+ "type": "string"
3712
+ },
3713
+ "url": {
3714
+ "type": "string",
3715
+ "format": "uri",
3716
+ "description": "Destination URL (must be https)."
3717
+ },
3718
+ "enabled": {
3719
+ "type": "boolean"
3720
+ },
3721
+ "event_types": {
3722
+ "type": "array",
3723
+ "items": {
3724
+ "type": "string"
3725
+ },
3726
+ "description": "Subscribed event types. Empty array = all events."
3727
+ },
3728
+ "channels": {
3729
+ "type": [
3730
+ "array",
3731
+ "null"
3732
+ ],
3733
+ "items": {
3734
+ "type": "string"
3735
+ },
3736
+ "description": "Channel-type filter (e.g. `['widget', 'whatsapp']`), or `null` for all channels."
3737
+ },
3738
+ "channel_connection_ids": {
3739
+ "type": [
3740
+ "array",
3741
+ "null"
3742
+ ],
3743
+ "items": {
3744
+ "type": "string"
3745
+ },
3746
+ "description": "Channel-connection filter, or `null` for all connections."
3747
+ },
3748
+ "secret_last4": {
3749
+ "type": "string",
3750
+ "description": "Last 4 characters of the signing secret, for identification."
3751
+ },
3752
+ "consecutive_failures": {
3753
+ "type": "integer"
3754
+ },
3755
+ "last_delivery_at": {
3756
+ "type": [
3757
+ "integer",
3758
+ "null"
3759
+ ],
3760
+ "description": "Unix timestamp in milliseconds, or `null` if never."
3761
+ },
3762
+ "last_success_at": {
3763
+ "type": [
3764
+ "integer",
3765
+ "null"
3766
+ ],
3767
+ "description": "Unix timestamp in milliseconds, or `null` if never."
3768
+ },
3769
+ "last_error_at": {
3770
+ "type": [
3771
+ "integer",
3772
+ "null"
3773
+ ],
3774
+ "description": "Unix timestamp in milliseconds, or `null` if never."
3775
+ },
3776
+ "last_error": {
3777
+ "type": [
3778
+ "string",
3779
+ "null"
3780
+ ]
3781
+ },
3782
+ "created_at": {
3783
+ "type": "integer",
3784
+ "description": "Unix timestamp in milliseconds."
3785
+ },
3786
+ "updated_at": {
3787
+ "type": "integer",
3788
+ "description": "Unix timestamp in milliseconds."
3789
+ },
3790
+ "secret": {
3791
+ "type": "string",
3792
+ "description": "Full signing secret (`whsec_…`) — present ONLY in the create response, exactly once. It can never be retrieved again; store it securely immediately. An idempotent replay of the create request omits it."
3793
+ }
3794
+ }
3795
+ },
3796
+ "CreateWebhookInput": {
3797
+ "type": "object",
3798
+ "required": [
3799
+ "name",
3800
+ "url",
3801
+ "event_types"
3802
+ ],
3803
+ "properties": {
3804
+ "name": {
3805
+ "type": "string",
3806
+ "maxLength": 100
3807
+ },
3808
+ "url": {
3809
+ "type": "string",
3810
+ "format": "uri",
3811
+ "description": "Destination URL — must be https."
3812
+ },
3813
+ "event_types": {
3814
+ "type": "array",
3815
+ "items": {
3816
+ "type": "string"
3817
+ },
3818
+ "description": "Event types to subscribe to (e.g. `helpdesk.message_received`). Empty = all."
3819
+ },
3820
+ "channels": {
3821
+ "type": "array",
3822
+ "items": {
3823
+ "type": "string"
3824
+ },
3825
+ "description": "Restrict to these channel types (e.g. `['widget', 'whatsapp']`)."
3826
+ },
3827
+ "channel_connection_ids": {
3828
+ "type": "array",
3829
+ "items": {
3830
+ "type": "string"
3831
+ },
3832
+ "description": "Restrict to these channel connection IDs."
3833
+ }
3834
+ }
3835
+ },
3836
+ "UpdateWebhookInput": {
3837
+ "type": "object",
3838
+ "description": "Only provided fields change.",
3839
+ "properties": {
3840
+ "name": {
3841
+ "type": "string",
3842
+ "maxLength": 100
3843
+ },
3844
+ "url": {
3845
+ "type": "string",
3846
+ "format": "uri"
3847
+ },
3848
+ "event_types": {
3849
+ "type": "array",
3850
+ "items": {
3851
+ "type": "string"
3852
+ }
3853
+ },
3854
+ "channels": {
3855
+ "type": [
3856
+ "array",
3857
+ "null"
3858
+ ],
3859
+ "items": {
3860
+ "type": "string"
3861
+ },
3862
+ "description": "New channel-type filter, or `null` to clear the filter."
3863
+ },
3864
+ "channel_connection_ids": {
3865
+ "type": [
3866
+ "array",
3867
+ "null"
3868
+ ],
3869
+ "items": {
3870
+ "type": "string"
3871
+ },
3872
+ "description": "New channel-connection filter, or `null` to clear the filter."
3873
+ },
3874
+ "enabled": {
3875
+ "type": "boolean"
3876
+ }
3877
+ }
3878
+ },
3879
+ "WebhookDeleteResult": {
3880
+ "type": "object",
3881
+ "required": [
3882
+ "id",
3883
+ "status"
3884
+ ],
3885
+ "properties": {
3886
+ "id": {
3887
+ "type": "string"
3888
+ },
3889
+ "status": {
3890
+ "type": "string",
3891
+ "const": "deleted"
3892
+ }
3893
+ }
3894
+ },
3895
+ "WebhookDelivery": {
3896
+ "type": "object",
3897
+ "required": [
3898
+ "id",
3899
+ "event_type",
3900
+ "status",
3901
+ "attempt_count",
3902
+ "next_attempt_at",
3903
+ "response_status",
3904
+ "duration_ms",
3905
+ "last_error",
3906
+ "delivered_at",
3907
+ "created_at"
3908
+ ],
3909
+ "properties": {
3910
+ "id": {
3911
+ "type": "string"
3912
+ },
3913
+ "event_type": {
3914
+ "type": "string"
3915
+ },
3916
+ "status": {
3917
+ "type": "string",
3918
+ "enum": [
3919
+ "pending",
3920
+ "delivered",
3921
+ "dead_letter"
3922
+ ]
3923
+ },
3924
+ "attempt_count": {
3925
+ "type": "integer"
3926
+ },
3927
+ "next_attempt_at": {
3928
+ "type": [
3929
+ "integer",
3930
+ "null"
3931
+ ],
3932
+ "description": "Unix timestamp in milliseconds of the next retry, or `null`."
3933
+ },
3934
+ "response_status": {
3935
+ "type": [
3936
+ "integer",
3937
+ "null"
3938
+ ]
3939
+ },
3940
+ "duration_ms": {
3941
+ "type": [
3942
+ "integer",
3943
+ "null"
3944
+ ]
3945
+ },
3946
+ "last_error": {
3947
+ "type": [
3948
+ "string",
3949
+ "null"
3950
+ ]
3951
+ },
3952
+ "delivered_at": {
3953
+ "type": [
3954
+ "integer",
3955
+ "null"
3956
+ ],
3957
+ "description": "Unix timestamp in milliseconds, or `null` if not delivered."
3958
+ },
3959
+ "created_at": {
3960
+ "type": "integer",
3961
+ "description": "Unix timestamp in milliseconds."
3962
+ }
3963
+ }
3964
+ },
3965
+ "WebhookTestResult": {
3966
+ "type": "object",
3967
+ "required": [
3968
+ "delivery_id",
3969
+ "status"
3970
+ ],
3971
+ "properties": {
3972
+ "delivery_id": {
3973
+ "type": "string"
3974
+ },
3975
+ "status": {
3976
+ "type": "string",
3977
+ "const": "queued"
3978
+ }
3979
+ }
3980
+ },
3981
+ "ApiResponse_PostCreateResult": {
3982
+ "$ref": "#/components/schemas/Envelope_PostCreateResult"
3983
+ },
3984
+ "ApiResponse_PostDetail": {
3985
+ "$ref": "#/components/schemas/Envelope_PostDetail"
2969
3986
  },
2970
3987
  "ApiResponse_Success": {
2971
3988
  "$ref": "#/components/schemas/Envelope_Success"
@@ -3042,6 +4059,30 @@
3042
4059
  "ApiResponse_WorkspaceArray": {
3043
4060
  "$ref": "#/components/schemas/Envelope_WorkspaceArray"
3044
4061
  },
4062
+ "ApiResponse_HelpdeskConversation": {
4063
+ "$ref": "#/components/schemas/Envelope_HelpdeskConversation"
4064
+ },
4065
+ "ApiResponse_HelpdeskConversationUpdateResult": {
4066
+ "$ref": "#/components/schemas/Envelope_HelpdeskConversationUpdateResult"
4067
+ },
4068
+ "ApiResponse_HelpdeskReplyCreateResult": {
4069
+ "$ref": "#/components/schemas/Envelope_HelpdeskReplyCreateResult"
4070
+ },
4071
+ "ApiResponse_WebhookEndpoint": {
4072
+ "$ref": "#/components/schemas/Envelope_WebhookEndpoint"
4073
+ },
4074
+ "ApiResponse_WebhookEndpointArray": {
4075
+ "$ref": "#/components/schemas/Envelope_WebhookEndpointArray"
4076
+ },
4077
+ "ApiResponse_WebhookDeleteResult": {
4078
+ "$ref": "#/components/schemas/Envelope_WebhookDeleteResult"
4079
+ },
4080
+ "ApiResponse_WebhookDeliveryArray": {
4081
+ "$ref": "#/components/schemas/Envelope_WebhookDeliveryArray"
4082
+ },
4083
+ "ApiResponse_WebhookTestResult": {
4084
+ "$ref": "#/components/schemas/Envelope_WebhookTestResult"
4085
+ },
3045
4086
  "PaginatedResponse_Post": {
3046
4087
  "type": "object",
3047
4088
  "required": [
@@ -3114,6 +4155,42 @@
3114
4155
  }
3115
4156
  }
3116
4157
  },
4158
+ "PaginatedResponse_HelpdeskConversation": {
4159
+ "type": "object",
4160
+ "required": [
4161
+ "data",
4162
+ "pagination"
4163
+ ],
4164
+ "properties": {
4165
+ "data": {
4166
+ "type": "array",
4167
+ "items": {
4168
+ "$ref": "#/components/schemas/HelpdeskConversation"
4169
+ }
4170
+ },
4171
+ "pagination": {
4172
+ "$ref": "#/components/schemas/Pagination"
4173
+ }
4174
+ }
4175
+ },
4176
+ "PaginatedResponse_HelpdeskMessage": {
4177
+ "type": "object",
4178
+ "required": [
4179
+ "data",
4180
+ "pagination"
4181
+ ],
4182
+ "properties": {
4183
+ "data": {
4184
+ "type": "array",
4185
+ "items": {
4186
+ "$ref": "#/components/schemas/HelpdeskMessage"
4187
+ }
4188
+ },
4189
+ "pagination": {
4190
+ "$ref": "#/components/schemas/Pagination"
4191
+ }
4192
+ }
4193
+ },
3117
4194
  "Envelope_PostCreateResult": {
3118
4195
  "type": "object",
3119
4196
  "required": [
@@ -3425,6 +4502,100 @@
3425
4502
  }
3426
4503
  }
3427
4504
  }
4505
+ },
4506
+ "Envelope_HelpdeskConversation": {
4507
+ "type": "object",
4508
+ "required": [
4509
+ "data"
4510
+ ],
4511
+ "properties": {
4512
+ "data": {
4513
+ "$ref": "#/components/schemas/HelpdeskConversation"
4514
+ }
4515
+ }
4516
+ },
4517
+ "Envelope_HelpdeskConversationUpdateResult": {
4518
+ "type": "object",
4519
+ "required": [
4520
+ "data"
4521
+ ],
4522
+ "properties": {
4523
+ "data": {
4524
+ "$ref": "#/components/schemas/HelpdeskConversationUpdateResult"
4525
+ }
4526
+ }
4527
+ },
4528
+ "Envelope_HelpdeskReplyCreateResult": {
4529
+ "type": "object",
4530
+ "required": [
4531
+ "data"
4532
+ ],
4533
+ "properties": {
4534
+ "data": {
4535
+ "$ref": "#/components/schemas/HelpdeskReplyCreateResult"
4536
+ }
4537
+ }
4538
+ },
4539
+ "Envelope_WebhookEndpoint": {
4540
+ "type": "object",
4541
+ "required": [
4542
+ "data"
4543
+ ],
4544
+ "properties": {
4545
+ "data": {
4546
+ "$ref": "#/components/schemas/WebhookEndpoint"
4547
+ }
4548
+ }
4549
+ },
4550
+ "Envelope_WebhookEndpointArray": {
4551
+ "type": "object",
4552
+ "required": [
4553
+ "data"
4554
+ ],
4555
+ "properties": {
4556
+ "data": {
4557
+ "type": "array",
4558
+ "items": {
4559
+ "$ref": "#/components/schemas/WebhookEndpoint"
4560
+ }
4561
+ }
4562
+ }
4563
+ },
4564
+ "Envelope_WebhookDeleteResult": {
4565
+ "type": "object",
4566
+ "required": [
4567
+ "data"
4568
+ ],
4569
+ "properties": {
4570
+ "data": {
4571
+ "$ref": "#/components/schemas/WebhookDeleteResult"
4572
+ }
4573
+ }
4574
+ },
4575
+ "Envelope_WebhookDeliveryArray": {
4576
+ "type": "object",
4577
+ "required": [
4578
+ "data"
4579
+ ],
4580
+ "properties": {
4581
+ "data": {
4582
+ "type": "array",
4583
+ "items": {
4584
+ "$ref": "#/components/schemas/WebhookDelivery"
4585
+ }
4586
+ }
4587
+ }
4588
+ },
4589
+ "Envelope_WebhookTestResult": {
4590
+ "type": "object",
4591
+ "required": [
4592
+ "data"
4593
+ ],
4594
+ "properties": {
4595
+ "data": {
4596
+ "$ref": "#/components/schemas/WebhookTestResult"
4597
+ }
4598
+ }
3428
4599
  }
3429
4600
  }
3430
4601
  }