@signalhouse-sms/sdk 1.15.0 → 1.17.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.
@@ -0,0 +1,163 @@
1
+ /** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
2
+ /**
3
+ * @template T
4
+ * @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
5
+ */
6
+ /**
7
+ * Vetting domain: the staff-only brand vetting engine for branded calling. A case runs a brand through automated checks, a
8
+ * rules engine decides it, and staff work only the exception queue. Every method lives under the admin namespace, present
9
+ * only when the SDK is created with `enableAdmin: true`. JS SDK only by design.
10
+ */
11
+ export class Vetting {
12
+ constructor(client: any, enableAdmin: any);
13
+ client: any;
14
+ enableAdmin: any;
15
+ admin: {
16
+ /**
17
+ * Start vetting a brand. The case runs in the background; read it with getVettingCase. Staff-only.
18
+ * @async
19
+ * @roles signalhouse
20
+ * @param {Object} params
21
+ * @param {Object} params.subject - The brand: `{ legalName, entityType?, displayName?, ein?, website?, sector?,
22
+ * authorizer?: { name?, email?, phone? }, billingContact?: { name?, email?, phone? },
23
+ * billingAddress?: { street?, city?, state?, postalCode?, country? }, groupId?, brandId? }`. Only `legalName` is
24
+ * required to start; a case missing any field the checks need is rejected with a cure listing them.
25
+ * @param {string} [params.tenantId] - The vetting tenant (default "signalhouse")
26
+ * @param {RequestOptions} [params.options] - Additional options for the request
27
+ * @returns {Promise<SdkResponse<any>>} - `{ caseId, tenantId, status }`, accepted with HTTP 202
28
+ */
29
+ startVettingCase: ({ subject, tenantId, options }: {
30
+ subject: any;
31
+ tenantId?: string;
32
+ options?: RequestOptions;
33
+ }) => Promise<SdkResponse<any>>;
34
+ /**
35
+ * List vetting cases, newest first. Staff-only.
36
+ * @async
37
+ * @roles signalhouse
38
+ * @param {Object} [params]
39
+ * @param {string} [params.tenantId] - The vetting tenant (default "signalhouse")
40
+ * @param {("RUNNING"|"DECIDING"|"VERIFIED"|"REJECTED"|"FALLBACK"|"EXCEPTION"|"HUMAN_SIGNOFF")} [params.status] - Only cases in this status
41
+ * @param {number} [params.page] - Page number (default 1)
42
+ * @param {number} [params.limit] - Cases per page (default 25, max 100)
43
+ * @param {RequestOptions} [params.options] - Additional options for the request
44
+ * @returns {Promise<SdkResponse<any>>} - `{ data, total, page, limit }`
45
+ */
46
+ getVettingCases: ({ tenantId, status, page, limit, options }?: {
47
+ tenantId?: string;
48
+ status?: ("RUNNING" | "DECIDING" | "VERIFIED" | "REJECTED" | "FALLBACK" | "EXCEPTION" | "HUMAN_SIGNOFF");
49
+ page?: number;
50
+ limit?: number;
51
+ options?: RequestOptions;
52
+ }) => Promise<SdkResponse<any>>;
53
+ /**
54
+ * Get one vetting case with its steps, decision and history. Staff-only.
55
+ * @async
56
+ * @roles signalhouse
57
+ * @param {Object} params
58
+ * @param {string} params.caseId - The case ID
59
+ * @param {string} [params.tenantId] - The vetting tenant (default "signalhouse")
60
+ * @param {RequestOptions} [params.options] - Additional options for the request
61
+ * @returns {Promise<SdkResponse<any>>} - The case
62
+ */
63
+ getVettingCase: ({ caseId, tenantId, options }: {
64
+ caseId: string;
65
+ tenantId?: string;
66
+ options?: RequestOptions;
67
+ }) => Promise<SdkResponse<any>>;
68
+ /**
69
+ * Export every evidence item for a case, oldest first, each with its payload's SHA-256. Staff-only.
70
+ * @async
71
+ * @roles signalhouse
72
+ * @param {Object} params
73
+ * @param {string} params.caseId - The case ID
74
+ * @param {string} [params.tenantId] - The vetting tenant (default "signalhouse")
75
+ * @param {RequestOptions} [params.options] - Additional options for the request
76
+ * @returns {Promise<SdkResponse<any>>} - `{ caseId, tenantId, status, decision, exportedAt, evidence }`
77
+ */
78
+ getVettingEvidence: ({ caseId, tenantId, options }: {
79
+ caseId: string;
80
+ tenantId?: string;
81
+ options?: RequestOptions;
82
+ }) => Promise<SdkResponse<any>>;
83
+ /**
84
+ * List the vetting exception queue, oldest first. Staff-only.
85
+ * @async
86
+ * @roles signalhouse
87
+ * @param {Object} [params]
88
+ * @param {string} [params.tenantId] - The vetting tenant (default "signalhouse")
89
+ * @param {("OPEN"|"CLAIMED"|"RESOLVED")} [params.status] - Only items in this status
90
+ * @param {("EXCEPTION"|"HUMAN_SIGNOFF"|"QA_SAMPLE")} [params.kind] - Only items of this kind
91
+ * @param {string} [params.reasonCode] - Only items with this reason
92
+ * @param {number} [params.page] - Page number (default 1)
93
+ * @param {number} [params.limit] - Items per page (default 25, max 100)
94
+ * @param {RequestOptions} [params.options] - Additional options for the request
95
+ * @returns {Promise<SdkResponse<any>>} - `{ data, total, page, limit }`
96
+ */
97
+ getVettingExceptions: ({ tenantId, status, kind, reasonCode, page, limit, options }?: {
98
+ tenantId?: string;
99
+ status?: ("OPEN" | "CLAIMED" | "RESOLVED");
100
+ kind?: ("EXCEPTION" | "HUMAN_SIGNOFF" | "QA_SAMPLE");
101
+ reasonCode?: string;
102
+ page?: number;
103
+ limit?: number;
104
+ options?: RequestOptions;
105
+ }) => Promise<SdkResponse<any>>;
106
+ /**
107
+ * Claim an open exception queue item, or take over one whose holder is no longer a Compliance Admin. Only one staff
108
+ * member can hold an item. Compliance Admins only, and never on a case the caller started.
109
+ * @async
110
+ * @roles signalhouse_user holding the COMPLIANCE_ADMIN staff permission (never signalhouse_admin)
111
+ * @param {Object} params
112
+ * @param {string} params.exceptionId - The queue item ID
113
+ * @param {string} [params.tenantId] - The vetting tenant (default "signalhouse")
114
+ * @param {RequestOptions} [params.options] - Additional options for the request
115
+ * @returns {Promise<SdkResponse<any>>} - The claimed item
116
+ */
117
+ claimVettingException: ({ exceptionId, tenantId, options }: {
118
+ exceptionId: string;
119
+ tenantId?: string;
120
+ options?: RequestOptions;
121
+ }) => Promise<SdkResponse<any>>;
122
+ /**
123
+ * Resolve a claimed exception queue item and set the case's result by hand. On a QA sample, VERIFY confirms the
124
+ * auto-approval and REJECT overturns it. Compliance Admins only: the one holding the item.
125
+ * @async
126
+ * @roles signalhouse_user holding the COMPLIANCE_ADMIN staff permission (never signalhouse_admin)
127
+ * @param {Object} params
128
+ * @param {string} params.exceptionId - The queue item ID
129
+ * @param {("VERIFY"|"REJECT")} params.outcome - The result
130
+ * @param {string} params.note - Why, kept with the case's evidence
131
+ * @param {string} [params.tenantId] - The vetting tenant (default "signalhouse")
132
+ * @param {RequestOptions} [params.options] - Additional options for the request
133
+ * @returns {Promise<SdkResponse<any>>} - `{ exception, case: { caseId, tenantId, status, decision } }`; read the full case with getVettingCase
134
+ */
135
+ resolveVettingException: ({ exceptionId, outcome, note, tenantId, options }: {
136
+ exceptionId: string;
137
+ outcome: ("VERIFY" | "REJECT");
138
+ note: string;
139
+ tenantId?: string;
140
+ options?: RequestOptions;
141
+ }) => Promise<SdkResponse<any>>;
142
+ /**
143
+ * Report vetting outcomes over a period (the last 30 days by default): counts by status, the straight-through rate,
144
+ * and the exception reasons. Staff-only.
145
+ * @async
146
+ * @roles signalhouse
147
+ * @param {Object} [params]
148
+ * @param {string} [params.tenantId] - The vetting tenant (default "signalhouse")
149
+ * @param {string} [params.from] - Start of the period (ISO date)
150
+ * @param {string} [params.to] - End of the period (ISO date)
151
+ * @param {RequestOptions} [params.options] - Additional options for the request
152
+ * @returns {Promise<SdkResponse<any>>} - `{ tenantId, from, to, cases: { total, decided, byStatus }, straightThrough: { count, rate }, exceptionReasons }`
153
+ */
154
+ getVettingReport: ({ tenantId, from, to, options }?: {
155
+ tenantId?: string;
156
+ from?: string;
157
+ to?: string;
158
+ options?: RequestOptions;
159
+ }) => Promise<SdkResponse<any>>;
160
+ };
161
+ }
162
+ export type RequestOptions = import("../SignalHouseSDK.js").RequestOptions;
163
+ export type SdkResponse<T> = import("../SignalHouseSDK.js").SdkResponse<T>;
@@ -13,6 +13,8 @@
13
13
  * - `sdk.voice.callLogs` — Account-scoped call history: list/get + presigned recording.
14
14
  * - `sdk.voice.globalVoiceSettings` — Account-wide voice defaults (accepted regions, max spend, E911).
15
15
  * - `sdk.voice.tokens` — Mint ephemeral SIP credentials for the browser voice SDK.
16
+ * - `sdk.voice.pushCredentials` — Mobile push: the Apple/Firebase credentials that wake your app for calls.
17
+ * - `sdk.voice.pushDevices` — Mobile push: register a device (called by the app with its voice token).
16
18
  * - `sdk.voice.analytics` — Aggregated call analytics (summary tiles + byDate/byNumber/byCarrier breakdowns).
17
19
  */
18
20
  export class Voice {
@@ -30,6 +32,8 @@ export class Voice {
30
32
  analytics: Analytics;
31
33
  outboundVoice: OutboundVoice;
32
34
  callFlows: CallFlows;
35
+ pushCredentials: PushCredentials;
36
+ pushDevices: PushDevices;
33
37
  }
34
38
  import { SipTrunks } from "./voice/SipTrunks.js";
35
39
  import { SipProfiles } from "./voice/SipProfiles.js";
@@ -42,3 +46,5 @@ import { Tokens } from "./voice/Tokens.js";
42
46
  import { Analytics } from "./voice/Analytics.js";
43
47
  import { OutboundVoice } from "./voice/OutboundVoice.js";
44
48
  import { CallFlows } from "./voice/CallFlows.js";
49
+ import { PushCredentials } from "./voice/PushCredentials.js";
50
+ import { PushDevices } from "./voice/PushDevices.js";
@@ -26,7 +26,7 @@
26
26
  /**
27
27
  * @typedef {Object} CallFlowStep
28
28
  * @property {string} id - A UUID you generate. It is kept as the step's id, so it stays stable across saves.
29
- * @property {"inbound"|"answer"|"play"|"ivr"|"fwd_phone"|"voicemail"|"hangup"} type - The step kind. `catalog()` lists the kinds this service can run.
29
+ * @property {"inbound"|"answer"|"play"|"sms"|"ivr"|"ai_agent"|"ai_sms"|"webhook"|"fwd_phone"|"fwd_sip"|"voicemail"|"hangup"} type - The step kind. `catalog()` lists the kinds this service can run.
30
30
  * @property {string} name - Display name.
31
31
  * @property {Object} [config] - The step's settings, which depend on its type.
32
32
  * @property {number} [positionX] - Canvas x position, for a visual builder.
@@ -271,7 +271,7 @@ export type CallFlowStep = {
271
271
  /**
272
272
  * - The step kind. `catalog()` lists the kinds this service can run.
273
273
  */
274
- type: "inbound" | "answer" | "play" | "ivr" | "fwd_phone" | "voicemail" | "hangup";
274
+ type: "inbound" | "answer" | "play" | "sms" | "ivr" | "ai_agent" | "ai_sms" | "webhook" | "fwd_phone" | "fwd_sip" | "voicemail" | "hangup";
275
275
  /**
276
276
  * - Display name.
277
277
  */
@@ -0,0 +1,144 @@
1
+ /** @typedef {import('../../SignalHouseSDK.js').RequestOptions} RequestOptions */
2
+ /**
3
+ * @template T
4
+ * @typedef {import('../../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
5
+ */
6
+ /**
7
+ * @typedef {Object} ApnsCredentialData
8
+ * @property {"apns"} provider - Apple Push Notification service (iOS).
9
+ * @property {string} [name] - A label, up to 100 characters.
10
+ * @property {string} keyId - The 10-character key ID of the APNs auth key (.p8).
11
+ * @property {string} teamId - Your 10-character Apple developer team ID.
12
+ * @property {string} bundleId - Your app's bundle ID. VoIP pushes go to its `.voip` topic.
13
+ * @property {string} privateKey - The contents of the .p8 file.
14
+ */
15
+ /**
16
+ * @typedef {Object} FcmCredentialData
17
+ * @property {"fcm"} provider - Firebase Cloud Messaging (Android).
18
+ * @property {string} [name] - A label, up to 100 characters.
19
+ * @property {string|Object} serviceAccount - The Firebase service account key file, as its JSON text or the parsed object.
20
+ */
21
+ /**
22
+ * Mobile push credentials — the Apple APNs auth key and Firebase service account the Voice service
23
+ * uses to wake your mobile app for incoming calls. One credential per app; secrets are encrypted and
24
+ * never returned (responses show a `fingerprint`). Calls the Voice service mounted under /voice.
25
+ * Accessed via `sdk.voice.pushCredentials`.
26
+ */
27
+ export class PushCredentials {
28
+ constructor(client: any, enableAdmin: any);
29
+ client: any;
30
+ enableAdmin: any;
31
+ /**
32
+ * List the account's push credentials (metadata only).
33
+ * @async
34
+ * @roles api, admin, developer, billing, user
35
+ * @param {Object} [params] - Request parameters.
36
+ * @param {RequestOptions} [params.options] - Additional options for the request.
37
+ * @returns {Promise<SdkResponse<any>>} `{ success, data: [{ id, provider, name, appId, keyId, teamId, bundleId, projectId, clientEmail, fingerprint, createdAt, updatedAt }] }`.
38
+ */
39
+ list({ options }?: {
40
+ options?: RequestOptions;
41
+ }): Promise<SdkResponse<any>>;
42
+ /**
43
+ * Get one push credential (metadata only).
44
+ * @async
45
+ * @roles api, admin, developer, billing, user
46
+ * @param {Object} params - Request parameters.
47
+ * @param {string} params.id - The credential ID.
48
+ * @param {RequestOptions} [params.options] - Additional options for the request.
49
+ * @throws {Error} If id is missing.
50
+ * @returns {Promise<SdkResponse<any>>} `{ success, data: { ...credential } }`.
51
+ */
52
+ get({ id, options }: {
53
+ id: string;
54
+ options?: RequestOptions;
55
+ }): Promise<SdkResponse<any>>;
56
+ /**
57
+ * Upload push credentials for one app: an Apple APNs auth key, or a Firebase service account. The
58
+ * key is checked on upload.
59
+ * @async
60
+ * @roles api, admin, developer
61
+ * @param {Object} params - Request parameters.
62
+ * @param {ApnsCredentialData|FcmCredentialData} params.credentialData - The credential.
63
+ * @param {RequestOptions} [params.options] - Additional options for the request.
64
+ * @throws {Error} If credentialData is missing.
65
+ * @returns {Promise<SdkResponse<any>>} `{ success, data: { ...credential } }` (201).
66
+ */
67
+ create({ credentialData, options }: {
68
+ credentialData: ApnsCredentialData | FcmCredentialData;
69
+ options?: RequestOptions;
70
+ }): Promise<SdkResponse<any>>;
71
+ /**
72
+ * Replace a credential's key or service account (and name). Same body as create; the provider
73
+ * cannot change. Registered devices keep working with the new key.
74
+ * @async
75
+ * @roles api, admin, developer
76
+ * @param {Object} params - Request parameters.
77
+ * @param {string} params.id - The credential ID.
78
+ * @param {ApnsCredentialData|FcmCredentialData} params.credentialData - The replacement.
79
+ * @param {RequestOptions} [params.options] - Additional options for the request.
80
+ * @throws {Error} If id or credentialData is missing.
81
+ * @returns {Promise<SdkResponse<any>>} `{ success, data: { ...credential } }`.
82
+ */
83
+ update({ id, credentialData, options }: {
84
+ id: string;
85
+ credentialData: ApnsCredentialData | FcmCredentialData;
86
+ options?: RequestOptions;
87
+ }): Promise<SdkResponse<any>>;
88
+ /**
89
+ * Delete a credential and every device registered for that app.
90
+ * @async
91
+ * @roles api, admin, developer
92
+ * @param {Object} params - Request parameters.
93
+ * @param {string} params.id - The credential ID.
94
+ * @param {RequestOptions} [params.options] - Additional options for the request.
95
+ * @throws {Error} If id is missing.
96
+ * @returns {Promise<SdkResponse<any>>} `{ success }`.
97
+ */
98
+ delete({ id, options }: {
99
+ id: string;
100
+ options?: RequestOptions;
101
+ }): Promise<SdkResponse<any>>;
102
+ }
103
+ export type RequestOptions = import("../../SignalHouseSDK.js").RequestOptions;
104
+ export type SdkResponse<T> = import("../../SignalHouseSDK.js").SdkResponse<T>;
105
+ export type ApnsCredentialData = {
106
+ /**
107
+ * - Apple Push Notification service (iOS).
108
+ */
109
+ provider: "apns";
110
+ /**
111
+ * - A label, up to 100 characters.
112
+ */
113
+ name?: string;
114
+ /**
115
+ * - The 10-character key ID of the APNs auth key (.p8).
116
+ */
117
+ keyId: string;
118
+ /**
119
+ * - Your 10-character Apple developer team ID.
120
+ */
121
+ teamId: string;
122
+ /**
123
+ * - Your app's bundle ID. VoIP pushes go to its `.voip` topic.
124
+ */
125
+ bundleId: string;
126
+ /**
127
+ * - The contents of the .p8 file.
128
+ */
129
+ privateKey: string;
130
+ };
131
+ export type FcmCredentialData = {
132
+ /**
133
+ * - Firebase Cloud Messaging (Android).
134
+ */
135
+ provider: "fcm";
136
+ /**
137
+ * - A label, up to 100 characters.
138
+ */
139
+ name?: string;
140
+ /**
141
+ * - The Firebase service account key file, as its JSON text or the parsed object.
142
+ */
143
+ serviceAccount: string | any;
144
+ };
@@ -0,0 +1,85 @@
1
+ /** @typedef {import('../../SignalHouseSDK.js').RequestOptions} RequestOptions */
2
+ /**
3
+ * @template T
4
+ * @typedef {import('../../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
5
+ */
6
+ /**
7
+ * @typedef {Object} RegisterPushDeviceData
8
+ * @property {"apns"|"fcm"} provider - "apns" for iOS (PushKit VoIP token), "fcm" for Android (Firebase registration token).
9
+ * @property {string} deviceToken - The device's push token.
10
+ * @property {"production"|"sandbox"} [environment] - apns only: "sandbox" for development builds. Default "production".
11
+ * @property {string} [appId] - The bundle ID or Firebase project ID; only needed when the account has several apps for the provider.
12
+ */
13
+ /**
14
+ * Mobile push devices — your app registers each device so incoming calls wake it. These methods are
15
+ * called by the app with the user's **voice token** (from `sdk.voice.tokens.create`, minted with a
16
+ * `subgroupId`) as `options.token`, not a dashboard or API key token. The device is tied to that
17
+ * token's identity. Calls the Voice service mounted under /voice. Accessed via `sdk.voice.pushDevices`.
18
+ */
19
+ export class PushDevices {
20
+ constructor(client: any, enableAdmin: any);
21
+ client: any;
22
+ enableAdmin: any;
23
+ /**
24
+ * Register this device for push. Call it after each token mint and whenever the OS gives the app a
25
+ * new push token. A push token already registered to another user moves to this one.
26
+ * @async
27
+ * @roles voice token
28
+ * @param {Object} params - Request parameters.
29
+ * @param {RegisterPushDeviceData} params.deviceData - The device.
30
+ * @param {RequestOptions} params.options - Must carry the voice token as `token`.
31
+ * @throws {Error} If deviceData is missing.
32
+ * @returns {Promise<SdkResponse<any>>} `{ success, data: { id, identity, provider, environment, appId, registeredAt } }` (201).
33
+ */
34
+ register({ deviceData, options }: {
35
+ deviceData: RegisterPushDeviceData;
36
+ options: RequestOptions;
37
+ }): Promise<SdkResponse<any>>;
38
+ /**
39
+ * Unregister this device, e.g. when the user signs out.
40
+ * @async
41
+ * @roles voice token
42
+ * @param {Object} params - Request parameters.
43
+ * @param {string} params.deviceToken - The device's push token.
44
+ * @param {RequestOptions} params.options - Must carry the voice token as `token`.
45
+ * @throws {Error} If deviceToken is missing.
46
+ * @returns {Promise<SdkResponse<any>>} `{ success, data: { removed } }`.
47
+ */
48
+ unregister({ deviceToken, options }: {
49
+ deviceToken: string;
50
+ options: RequestOptions;
51
+ }): Promise<SdkResponse<any>>;
52
+ /**
53
+ * The pushes recently sent to the voice token's user, newest first (kept 7 days), for debugging.
54
+ * @async
55
+ * @roles voice token
56
+ * @param {Object} [params] - Request parameters.
57
+ * @param {number} [params.limit] - How many, 1 to 100 (default 20).
58
+ * @param {RequestOptions} [params.options] - Must carry the voice token as `token`.
59
+ * @returns {Promise<SdkResponse<any>>} `{ success, data: [{ id, callUuid, provider, kind, status, error, createdAt }] }`.
60
+ */
61
+ listDeliveries({ limit, options }?: {
62
+ limit?: number;
63
+ options?: RequestOptions;
64
+ }): Promise<SdkResponse<any>>;
65
+ }
66
+ export type RequestOptions = import("../../SignalHouseSDK.js").RequestOptions;
67
+ export type SdkResponse<T> = import("../../SignalHouseSDK.js").SdkResponse<T>;
68
+ export type RegisterPushDeviceData = {
69
+ /**
70
+ * - "apns" for iOS (PushKit VoIP token), "fcm" for Android (Firebase registration token).
71
+ */
72
+ provider: "apns" | "fcm";
73
+ /**
74
+ * - The device's push token.
75
+ */
76
+ deviceToken: string;
77
+ /**
78
+ * - apns only: "sandbox" for development builds. Default "production".
79
+ */
80
+ environment?: "production" | "sandbox";
81
+ /**
82
+ * - The bundle ID or Firebase project ID; only needed when the account has several apps for the provider.
83
+ */
84
+ appId?: string;
85
+ };
@@ -15,6 +15,7 @@
15
15
  * @typedef {Object} CreateTokenData
16
16
  * @property {string} [identity] - Customer-facing logical identity name (e.g. "alice"). Persisted as `requested_identity` so server-initiated `calls.create({to_identity: "alice"})` can resolve it later. Defaults to "anonymous".
17
17
  * @property {number} [ttl] - Token TTL in seconds. Clamped to the server's max. Defaults to VOICE_TOKEN_DEFAULT_TTL_SEC.
18
+ * @property {string} [subgroupId] - The subgroup whose inbound calls should ring this identity. Required to receive calls (and to register the device for mobile push).
18
19
  * @property {VoiceGrants} [grants] - Capability grants attached to the token.
19
20
  */
20
21
  /**
@@ -110,6 +111,10 @@ export type CreateTokenData = {
110
111
  * - Token TTL in seconds. Clamped to the server's max. Defaults to VOICE_TOKEN_DEFAULT_TTL_SEC.
111
112
  */
112
113
  ttl?: number;
114
+ /**
115
+ * - The subgroup whose inbound calls should ring this identity. Required to receive calls (and to register the device for mobile push).
116
+ */
117
+ subgroupId?: string;
113
118
  /**
114
119
  * - Capability grants attached to the token.
115
120
  */