@medalsocial/sdk 1.3.0 → 1.5.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.
@@ -29,6 +29,10 @@ tags:
29
29
  description: Read helpdesk conversations, reply, and manage assignment/status.
30
30
  - name: Webhooks
31
31
  description: Manage webhook endpoints and inspect their deliveries.
32
+ - name: Channels
33
+ description: >-
34
+ Partner channel connect — mint hosted connect links and manage the
35
+ resulting channel connections.
32
36
  paths:
33
37
  /api/v1/posts:
34
38
  get:
@@ -926,6 +930,111 @@ paths:
926
930
  $ref: "#/components/schemas/ApiResponse_WebhookTestResult"
927
931
  default:
928
932
  $ref: "#/components/responses/ApiError"
933
+ /api/v1/channels/connect-links:
934
+ post:
935
+ tags: [Channels]
936
+ operationId: createChannelConnectLink
937
+ summary: Mint a hosted connect link
938
+ description: >-
939
+ Mints a single-use hosted connect link that lets an external person
940
+ (no Medal account required) attach a channel account (e.g.
941
+ `telegram_inbox`) to the workspace's helpdesk. The response's
942
+ `data.url` contains the one-time link token EXACTLY ONCE — an
943
+ idempotent replay (same `Idempotency-Key`) returns the link WITHOUT
944
+ `url`. Requires the `channel.connect.manage` scope; OAuth callers
945
+ additionally need the workspace `admin` role.
946
+ requestBody:
947
+ required: true
948
+ content:
949
+ application/json:
950
+ schema:
951
+ $ref: "#/components/schemas/CreateConnectLinkInput"
952
+ responses:
953
+ "201":
954
+ description: Minted connect link, including the one-time `url`.
955
+ content:
956
+ application/json:
957
+ schema:
958
+ $ref: "#/components/schemas/ApiResponse_ConnectLinkCreateResult"
959
+ default:
960
+ $ref: "#/components/responses/ApiError"
961
+ get:
962
+ tags: [Channels]
963
+ operationId: listChannelConnectLinks
964
+ summary: List connect links
965
+ description: Link tokens are never returned.
966
+ parameters:
967
+ - name: channel_type
968
+ in: query
969
+ schema:
970
+ type: string
971
+ - name: status
972
+ in: query
973
+ schema:
974
+ $ref: "#/components/schemas/ConnectLinkStatus"
975
+ responses:
976
+ "200":
977
+ description: The workspace's connect links.
978
+ content:
979
+ application/json:
980
+ schema:
981
+ $ref: "#/components/schemas/ApiResponse_ConnectLinkArray"
982
+ default:
983
+ $ref: "#/components/responses/ApiError"
984
+ /api/v1/channels/connect-links/{id}:
985
+ parameters:
986
+ - $ref: "#/components/parameters/Id"
987
+ delete:
988
+ tags: [Channels]
989
+ operationId: revokeChannelConnectLink
990
+ summary: Revoke a connect link
991
+ description: >-
992
+ Revokes a pending connect link so it can no longer be consumed. OAuth
993
+ callers need the workspace `admin` role.
994
+ responses:
995
+ "200":
996
+ description: Revoke result.
997
+ content:
998
+ application/json:
999
+ schema:
1000
+ $ref: "#/components/schemas/ApiResponse_ConnectLinkRevokeResult"
1001
+ default:
1002
+ $ref: "#/components/responses/ApiError"
1003
+ /api/v1/channels/connections:
1004
+ get:
1005
+ tags: [Channels]
1006
+ operationId: listChannelConnections
1007
+ summary: List channel connections
1008
+ responses:
1009
+ "200":
1010
+ description: The workspace's channel connections (generic shape).
1011
+ content:
1012
+ application/json:
1013
+ schema:
1014
+ $ref: "#/components/schemas/ApiResponse_ChannelConnectionArray"
1015
+ default:
1016
+ $ref: "#/components/responses/ApiError"
1017
+ /api/v1/channels/connections/{id}:
1018
+ parameters:
1019
+ - $ref: "#/components/parameters/Id"
1020
+ delete:
1021
+ tags: [Channels]
1022
+ operationId: disconnectChannelConnection
1023
+ summary: Disconnect a channel connection
1024
+ description: >-
1025
+ Disconnects a connected channel account (best-effort platform logout,
1026
+ then local revoke). Emits a `helpdesk.channel_disconnected` webhook
1027
+ event with `reason: "api_disconnect"` if the account was previously
1028
+ connected. OAuth callers need the workspace `admin` role.
1029
+ responses:
1030
+ "200":
1031
+ description: Disconnect result.
1032
+ content:
1033
+ application/json:
1034
+ schema:
1035
+ $ref: "#/components/schemas/ApiResponse_ChannelConnectionDisconnectResult"
1036
+ default:
1037
+ $ref: "#/components/responses/ApiError"
929
1038
  components:
930
1039
  securitySchemes:
931
1040
  bearerAuth:
@@ -1183,12 +1292,26 @@ components:
1183
1292
  type: string
1184
1293
  contact_id:
1185
1294
  type: string
1295
+ idempotency_key:
1296
+ type: string
1297
+ copy_to:
1298
+ type: string
1299
+ format: email
1300
+ copy_reply_to:
1301
+ type: string
1302
+ format: email
1186
1303
  EmailSendResult:
1187
1304
  type: object
1188
- required: [id, status]
1305
+ required: [id, copy_id, contact_id, status]
1189
1306
  properties:
1190
1307
  id:
1191
- type: string
1308
+ type: [string, "null"]
1309
+ description: Email send id — poll GET /api/v1/emails/{id} with it.
1310
+ copy_id:
1311
+ type: [string, "null"]
1312
+ description: Send id of the copy_to copy, or null when no copy was requested.
1313
+ contact_id:
1314
+ type: [string, "null"]
1192
1315
  status:
1193
1316
  type: string
1194
1317
  EmailSend:
@@ -1268,7 +1391,7 @@ components:
1268
1391
  type: string
1269
1392
  BatchSendSummary:
1270
1393
  type: object
1271
- required: [batch_id, total, queued, failed]
1394
+ required: [batch_id, total, queued, failed, results]
1272
1395
  properties:
1273
1396
  batch_id:
1274
1397
  type: string
@@ -1278,6 +1401,27 @@ components:
1278
1401
  type: integer
1279
1402
  failed:
1280
1403
  type: integer
1404
+ results:
1405
+ type: array
1406
+ description: Per-recipient outcome, in request order.
1407
+ items:
1408
+ $ref: "#/components/schemas/BatchSendRecipientResult"
1409
+ BatchSendRecipientResult:
1410
+ type: object
1411
+ required: [email, id, status, error]
1412
+ properties:
1413
+ email:
1414
+ type: string
1415
+ format: email
1416
+ id:
1417
+ type: [string, "null"]
1418
+ description: Email send id — poll GET /api/v1/emails/{id} with it. Null when not queued.
1419
+ status:
1420
+ type: string
1421
+ enum: [queued, failed]
1422
+ error:
1423
+ type: [string, "null"]
1424
+ description: Failure reason for recipients that were not queued.
1281
1425
  EmailTemplate:
1282
1426
  type: object
1283
1427
  required:
@@ -2264,6 +2408,130 @@ components:
2264
2408
  status:
2265
2409
  type: string
2266
2410
  const: queued
2411
+ ConnectLinkStatus:
2412
+ type: string
2413
+ enum: [pending, consumed, expired, revoked]
2414
+ ChannelConnectionState:
2415
+ type: string
2416
+ enum: [connecting, active, disconnected, disabled]
2417
+ CreateConnectLinkInput:
2418
+ type: object
2419
+ required: [channel_type]
2420
+ properties:
2421
+ channel_type:
2422
+ type: string
2423
+ maxLength: 64
2424
+ description: Channel type to connect (e.g. `telegram_inbox`).
2425
+ label:
2426
+ type: string
2427
+ maxLength: 100
2428
+ description: Display label shown on the hosted connect page.
2429
+ redirect_url:
2430
+ type: string
2431
+ format: uri
2432
+ maxLength: 2000
2433
+ description: >-
2434
+ URL the hosted page redirects to after a successful connect — must
2435
+ be https.
2436
+ ConnectLinkCreateResult:
2437
+ type: object
2438
+ required: [id, channel_type, label, status, expires_at]
2439
+ properties:
2440
+ id:
2441
+ type: string
2442
+ url:
2443
+ type: string
2444
+ format: uri
2445
+ description: >-
2446
+ Single-use hosted connect URL containing the one-time link token —
2447
+ present ONLY in the live create response. An idempotent replay of
2448
+ the create request omits it; the token can never be retrieved
2449
+ again.
2450
+ channel_type:
2451
+ type: string
2452
+ label:
2453
+ type: [string, "null"]
2454
+ status:
2455
+ $ref: "#/components/schemas/ConnectLinkStatus"
2456
+ expires_at:
2457
+ type: integer
2458
+ description: Unix timestamp in milliseconds.
2459
+ ConnectLink:
2460
+ type: object
2461
+ required:
2462
+ - id
2463
+ - channel_type
2464
+ - label
2465
+ - status
2466
+ - consumed_connection_ref
2467
+ - expires_at
2468
+ - created_at
2469
+ properties:
2470
+ id:
2471
+ type: string
2472
+ channel_type:
2473
+ type: string
2474
+ label:
2475
+ type: [string, "null"]
2476
+ status:
2477
+ $ref: "#/components/schemas/ConnectLinkStatus"
2478
+ consumed_connection_ref:
2479
+ type: [string, "null"]
2480
+ description: >-
2481
+ Stable ref of the connection created by consuming this link, or
2482
+ `null`.
2483
+ expires_at:
2484
+ type: integer
2485
+ description: Unix timestamp in milliseconds.
2486
+ created_at:
2487
+ type: integer
2488
+ description: Unix timestamp in milliseconds.
2489
+ ConnectLinkRevokeResult:
2490
+ type: object
2491
+ required: [id, status]
2492
+ properties:
2493
+ id:
2494
+ type: string
2495
+ status:
2496
+ type: string
2497
+ const: revoked
2498
+ ChannelConnection:
2499
+ type: object
2500
+ required:
2501
+ - id
2502
+ - channel_type
2503
+ - label
2504
+ - state
2505
+ - masked_identity
2506
+ - last_activity_at
2507
+ - helpdesk_connection_id
2508
+ properties:
2509
+ id:
2510
+ type: string
2511
+ channel_type:
2512
+ type: string
2513
+ label:
2514
+ type: [string, "null"]
2515
+ state:
2516
+ $ref: "#/components/schemas/ChannelConnectionState"
2517
+ masked_identity:
2518
+ type: string
2519
+ description: Privacy-preserving identity handle (e.g. a masked phone number).
2520
+ last_activity_at:
2521
+ type: [integer, "null"]
2522
+ description: Unix timestamp in milliseconds, or `null` if never active.
2523
+ helpdesk_connection_id:
2524
+ type: [string, "null"]
2525
+ description: Linked helpdesk channel connection ID, or `null`.
2526
+ ChannelConnectionDisconnectResult:
2527
+ type: object
2528
+ required: [id, state]
2529
+ properties:
2530
+ id:
2531
+ type: string
2532
+ state:
2533
+ type: string
2534
+ const: disconnected
2267
2535
  ApiResponse_PostCreateResult:
2268
2536
  $ref: "#/components/schemas/Envelope_PostCreateResult"
2269
2537
  ApiResponse_PostDetail:
@@ -2334,6 +2602,16 @@ components:
2334
2602
  $ref: "#/components/schemas/Envelope_WebhookDeliveryArray"
2335
2603
  ApiResponse_WebhookTestResult:
2336
2604
  $ref: "#/components/schemas/Envelope_WebhookTestResult"
2605
+ ApiResponse_ConnectLinkCreateResult:
2606
+ $ref: "#/components/schemas/Envelope_ConnectLinkCreateResult"
2607
+ ApiResponse_ConnectLinkArray:
2608
+ $ref: "#/components/schemas/Envelope_ConnectLinkArray"
2609
+ ApiResponse_ConnectLinkRevokeResult:
2610
+ $ref: "#/components/schemas/Envelope_ConnectLinkRevokeResult"
2611
+ ApiResponse_ChannelConnectionArray:
2612
+ $ref: "#/components/schemas/Envelope_ChannelConnectionArray"
2613
+ ApiResponse_ChannelConnectionDisconnectResult:
2614
+ $ref: "#/components/schemas/Envelope_ChannelConnectionDisconnectResult"
2337
2615
  PaginatedResponse_Post:
2338
2616
  type: object
2339
2617
  required: [data, pagination]
@@ -2618,3 +2896,37 @@ components:
2618
2896
  properties:
2619
2897
  data:
2620
2898
  $ref: "#/components/schemas/WebhookTestResult"
2899
+ Envelope_ConnectLinkCreateResult:
2900
+ type: object
2901
+ required: [data]
2902
+ properties:
2903
+ data:
2904
+ $ref: "#/components/schemas/ConnectLinkCreateResult"
2905
+ Envelope_ConnectLinkArray:
2906
+ type: object
2907
+ required: [data]
2908
+ properties:
2909
+ data:
2910
+ type: array
2911
+ items:
2912
+ $ref: "#/components/schemas/ConnectLink"
2913
+ Envelope_ConnectLinkRevokeResult:
2914
+ type: object
2915
+ required: [data]
2916
+ properties:
2917
+ data:
2918
+ $ref: "#/components/schemas/ConnectLinkRevokeResult"
2919
+ Envelope_ChannelConnectionArray:
2920
+ type: object
2921
+ required: [data]
2922
+ properties:
2923
+ data:
2924
+ type: array
2925
+ items:
2926
+ $ref: "#/components/schemas/ChannelConnection"
2927
+ Envelope_ChannelConnectionDisconnectResult:
2928
+ type: object
2929
+ required: [data]
2930
+ properties:
2931
+ data:
2932
+ $ref: "#/components/schemas/ChannelConnectionDisconnectResult"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medalsocial/sdk",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
4
4
  "description": "TypeScript SDK for Medal Social API — posts, emails, contacts, deals, helpdesk, webhooks, and GDPR compliance",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Medal Social / Ali Aljumaili",
@@ -73,34 +73,34 @@
73
73
  "tanstack-intent"
74
74
  ],
75
75
  "dependencies": {
76
- "zod": "^3.23.8"
76
+ "zod": "^4.4.3"
77
77
  },
78
78
  "devDependencies": {
79
- "@biomejs/biome": "^1.8.3",
79
+ "@biomejs/biome": "^2.5.6",
80
80
  "@changesets/changelog-github": "^0.7.0",
81
- "@changesets/cli": "^2.31.0",
82
- "@commitlint/cli": "^21.2.0",
81
+ "@changesets/cli": "^2.31.1",
82
+ "@commitlint/cli": "^21.2.1",
83
83
  "@commitlint/config-conventional": "^21.2.0",
84
- "@redocly/cli": "^2.37.0",
85
- "@secretlint/secretlint-rule-preset-recommend": "^13.0.2",
86
- "@tanstack/intent": "0.3.5",
87
- "@types/node": "^24.3.2",
84
+ "@redocly/cli": "^2.42.0",
85
+ "@secretlint/secretlint-rule-preset-recommend": "^13.0.4",
86
+ "@tanstack/intent": "0.3.6",
87
+ "@types/node": "^24.13.3",
88
88
  "@vitest/coverage-v8": "^4.1.10",
89
89
  "husky": "^9.1.6",
90
90
  "jsr": "^0.14.3",
91
- "knip": "^5.63.1",
92
- "lint-staged": "^17.0.8",
91
+ "knip": "^6.29.0",
92
+ "lint-staged": "^17.2.0",
93
93
  "only-allow": "^1.2.1",
94
94
  "openapi-typescript": "^7.13.0",
95
- "secretlint": "^13.0.2",
95
+ "secretlint": "^13.0.4",
96
96
  "tsup": "^8.3.0",
97
97
  "typedoc": "^0.28.20",
98
- "typescript": "^5.5.4",
98
+ "typescript": "^6.0.3",
99
99
  "vitest": "^4.1.10"
100
100
  },
101
101
  "scripts": {
102
102
  "preinstall": "npx only-allow pnpm",
103
- "build": "pnpm openapi:types && tsup src/index.ts src/openapi.generated.ts pilot/index.ts --dts --format esm,cjs --sourcemap && pnpm openapi:bundle",
103
+ "build": "pnpm openapi:types && tsup && pnpm openapi:bundle",
104
104
  "dev": "tsup src/index.ts --watch",
105
105
  "clean": "rm -rf dist",
106
106
  "test": "vitest run",