@cosmoops/connect-sdk 0.42.0 → 0.43.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,30 @@
3
3
  `@cosmoops/connect-sdk` follows semver, with the 0.x convention that **minor
4
4
  versions may carry breaking changes** and patch versions never do.
5
5
 
6
+ ## 0.43.0
7
+
8
+ ### Recorded calls: transcript, summary, intent and action items
9
+
10
+ A workspace can now switch on **call recording** (Connect > Calling). Calls
11
+ placed with `<ConnectCallButton>` are then recorded, the person called hears
12
+ "This call may be recorded" as they answer, and a few minutes after the call
13
+ Connect has transcribed it and read it.
14
+
15
+ - **`call.analyzed`** - a new webhook event, sent after `call.completed` for a
16
+ recorded call. It carries `summary`, `intent` (a few words, e.g.
17
+ `"pricing enquiry"`), `sentiment`, `language`, `actionItems` (`title`,
18
+ `dueDate` as `YYYY-MM-DD` or `null`, and `owner`: `rep` or `customer`) and
19
+ `recordingFileId`. Subscribe to it on your webhook in Connect. Typed as
20
+ `CallAnalyzedEvent`.
21
+ - **`calls.get(callId)`** returns the same reading as `call.analysis`, and
22
+ the transcript as the call's `turns` - your user as `agent`, the person
23
+ called as `user`. `analysis` is `null` for a call that was not recorded.
24
+ - **The recording** is a Drive file: `connect.drive.getFileUrl(recordingFileId, { workspaceId })` with a
25
+ `drive:read` key plays it.
26
+
27
+ Recording is the workspace's choice, off by default, and adds ₹0.30 + GST per
28
+ minute to the call - nothing to wire on your side to offer it.
29
+
6
30
  ## 0.42.0
7
31
 
8
32
  ### Ask AI explains failures instead of printing them
@@ -183,4 +183,4 @@ class ConnectClient {
183
183
  }
184
184
  exports.ConnectClient = ConnectClient;
185
185
  /** Kept in step with `package.json` by `sdk.test.ts`. */
186
- exports.SDK_VERSION = "0.42.0";
186
+ exports.SDK_VERSION = "0.43.0";
@@ -60,8 +60,11 @@ class CallsResource {
60
60
  * All three need the `calls:place` scope **and** a signed-in member
61
61
  * (`asUser`), whose own "Make calls" permission Connect checks. None works
62
62
  * server-to-server: a call is placed by a person, from the workspace's own
63
- * number, and is not recorded. Read how one went with `get(callId)`, which
64
- * needs `calls:read` - a call your application placed is readable by it.
63
+ * number. It is recorded only when the workspace has switched recording on
64
+ * (the person called hears a notice); `call.analyzed` then follows with the
65
+ * summary, intent and action items. Read how one went with `get(callId)`,
66
+ * which needs `calls:read` - a call your application placed is readable by
67
+ * it, transcript included.
65
68
  */
66
69
  /**
67
70
  * Whether the member can call, and if not why - what `<ConnectCallButton>`
@@ -179,4 +179,4 @@ export class ConnectClient {
179
179
  }
180
180
  }
181
181
  /** Kept in step with `package.json` by `sdk.test.ts`. */
182
- export const SDK_VERSION = "0.42.0";
182
+ export const SDK_VERSION = "0.43.0";
@@ -57,8 +57,11 @@ export class CallsResource {
57
57
  * All three need the `calls:place` scope **and** a signed-in member
58
58
  * (`asUser`), whose own "Make calls" permission Connect checks. None works
59
59
  * server-to-server: a call is placed by a person, from the workspace's own
60
- * number, and is not recorded. Read how one went with `get(callId)`, which
61
- * needs `calls:read` - a call your application placed is readable by it.
60
+ * number. It is recorded only when the workspace has switched recording on
61
+ * (the person called hears a notice); `call.analyzed` then follows with the
62
+ * summary, intent and action items. Read how one went with `get(callId)`,
63
+ * which needs `calls:read` - a call your application placed is readable by
64
+ * it, transcript included.
62
65
  */
63
66
  /**
64
67
  * Whether the member can call, and if not why - what `<ConnectCallButton>`
@@ -141,4 +141,4 @@ export declare class ConnectClient {
141
141
  constructor(options: ConnectClientOptions);
142
142
  }
143
143
  /** Kept in step with `package.json` by `sdk.test.ts`. */
144
- export declare const SDK_VERSION = "0.42.0";
144
+ export declare const SDK_VERSION = "0.43.0";
@@ -1114,7 +1114,7 @@ export interface EmitEventsResponse {
1114
1114
  * `createConnectWebhookHandler` simply ignores anything you have not
1115
1115
  * registered a handler for.
1116
1116
  */
1117
- export type ConnectWebhookEventType = "workspace.deletion_scheduled" | "workspace.deletion_cancelled" | "workspace.deleted" | "subscription.cancelled" | "call.completed" | "call.missed" | "booking.confirmed" | "booking.cancelled" | "booking.rescheduled" | "contact.created" | "contact.updated";
1117
+ export type ConnectWebhookEventType = "workspace.deletion_scheduled" | "workspace.deletion_cancelled" | "workspace.deleted" | "subscription.cancelled" | "call.completed" | "call.missed" | "call.analyzed" | "booking.confirmed" | "booking.cancelled" | "booking.rescheduled" | "contact.created" | "contact.updated";
1118
1118
  /** What becomes of one class of data when the workspace is purged. */
1119
1119
  export type ConnectDataDisposition = "erase" | "anonymize" | "retain";
1120
1120
  /** Who answers for your copy of the customer's data. See the deletion-policy guide. */
@@ -1321,6 +1321,48 @@ export interface CallMissedEvent {
1321
1321
  /** ISO-8601. */
1322
1322
  occurredAt: string;
1323
1323
  }
1324
+ /** How the person called came across, by the end of the call. */
1325
+ export type CallSentiment = "positive" | "neutral" | "negative";
1326
+ /**
1327
+ * Something somebody committed to on a recorded call. `owner` is who said
1328
+ * they would do it - `rep` for your user's side, `customer` for the person
1329
+ * called. Both are worth a follow-up: one to do, one to chase.
1330
+ */
1331
+ export interface CallActionItem {
1332
+ title: string;
1333
+ /** `YYYY-MM-DD` when a day was named or clearly implied, else `null`. */
1334
+ dueDate: string | null;
1335
+ owner: "rep" | "customer";
1336
+ }
1337
+ /**
1338
+ * A recorded call, transcribed and read. Sent minutes after `call.completed`,
1339
+ * and only for calls placed while the workspace records them - file the call
1340
+ * on `call.completed` and enrich that row here. The transcript itself is the
1341
+ * call's turns on `calls.get`.
1342
+ */
1343
+ export interface CallAnalyzedEvent {
1344
+ workspaceId: string;
1345
+ callId: string;
1346
+ channelId: string | null;
1347
+ /** E.164 - the person called on an outbound call, the caller on an inbound one. */
1348
+ contactPhone: string | null;
1349
+ direction: ConnectCallDirection;
1350
+ handler: CallHandler;
1351
+ placedByUserId: string | null;
1352
+ placedByName: string | null;
1353
+ /** Two or three sentences, in English whatever language was spoken. */
1354
+ summary: string | null;
1355
+ /** Why they were on the call, in a few lowercase words - "pricing enquiry". */
1356
+ intent: string | null;
1357
+ sentiment: CallSentiment | null;
1358
+ /** The main language spoken, BCP-47 - `hi-IN`, `en-IN`. */
1359
+ language: string | null;
1360
+ actionItems: CallActionItem[];
1361
+ /** The audio in the workspace's Drive - read it with a `drive:read` key. */
1362
+ recordingFileId: string | null;
1363
+ /** ISO-8601 - when the call started. */
1364
+ occurredAt: string;
1365
+ }
1324
1366
  /**
1325
1367
  * An appointment was booked and is holding its slot.
1326
1368
  *
@@ -1446,6 +1488,7 @@ export interface ConnectWebhookEventMap {
1446
1488
  "subscription.cancelled": SubscriptionCancelledEvent;
1447
1489
  "call.completed": CallCompletedEvent;
1448
1490
  "call.missed": CallMissedEvent;
1491
+ "call.analyzed": CallAnalyzedEvent;
1449
1492
  "booking.confirmed": BookingConfirmedEvent;
1450
1493
  "booking.cancelled": BookingCancelledEvent;
1451
1494
  "booking.rescheduled": BookingRescheduledEvent;
@@ -2804,7 +2847,7 @@ export interface ConnectCall {
2804
2847
  extraction: Record<string, unknown> | null;
2805
2848
  agentId: string | null;
2806
2849
  agentVersion: number | null;
2807
- /** `member` for a call a person placed with `<ConnectCallButton>`; such a call has no agent, transcript or recording. */
2850
+ /** `member` for a call a person placed with `<ConnectCallButton>`. Such a call has no agent; it has a recording, a transcript and an `analysis` only when the workspace records calls. */
2808
2851
  handler: CallHandler;
2809
2852
  /** The member who placed a `member` call - their Connect user id. */
2810
2853
  placedByUserId: string | null;
@@ -2817,6 +2860,21 @@ export interface ConnectCall {
2817
2860
  talkSeconds: number | null;
2818
2861
  /** Why nobody answered - set only when `status` is `unanswered`. */
2819
2862
  unansweredReason: CallUnansweredReason | (string & {}) | null;
2863
+ /**
2864
+ * The reading of a recorded member call - summary, intent, action items.
2865
+ * `null` for a call that was not recorded; `status: "pending"` while it is
2866
+ * being read. The transcript is `CallDetail.turns`, the member as `agent`
2867
+ * and the person called as `user`.
2868
+ */
2869
+ analysis: ConnectCallAnalysis | null;
2870
+ }
2871
+ export interface ConnectCallAnalysis {
2872
+ status: "pending" | "done" | "failed";
2873
+ summary: string | null;
2874
+ intent: string | null;
2875
+ sentiment: CallSentiment | null;
2876
+ actionItems: CallActionItem[];
2877
+ language: string | null;
2820
2878
  }
2821
2879
  /**
2822
2880
  * What the browser needs to place one approved call - see
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmoops/connect-sdk",
3
- "version": "0.42.0",
3
+ "version": "0.43.0",
4
4
  "description": "Official server-side SDK for the CosmoOps Connect platform API - Login with Connect, entitlements, billing and metering.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "commonjs",