@medalsocial/sdk 1.4.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:
@@ -2299,6 +2408,130 @@ components:
2299
2408
  status:
2300
2409
  type: string
2301
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
2302
2535
  ApiResponse_PostCreateResult:
2303
2536
  $ref: "#/components/schemas/Envelope_PostCreateResult"
2304
2537
  ApiResponse_PostDetail:
@@ -2369,6 +2602,16 @@ components:
2369
2602
  $ref: "#/components/schemas/Envelope_WebhookDeliveryArray"
2370
2603
  ApiResponse_WebhookTestResult:
2371
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"
2372
2615
  PaginatedResponse_Post:
2373
2616
  type: object
2374
2617
  required: [data, pagination]
@@ -2653,3 +2896,37 @@ components:
2653
2896
  properties:
2654
2897
  data:
2655
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.4.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",