@unboundcx/sdk-internal 2.3.3 → 2.3.4
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/index.js +3 -0
- package/package.json +1 -1
- package/services/workflows.js +37 -0
package/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import { InternalVideoService } from './services/video.js';
|
|
|
14
14
|
import { InternalVoicemailService } from './services/voicemail.js';
|
|
15
15
|
import { InternalVoiceService } from './services/voice.js';
|
|
16
16
|
import { InternalTaskRouterService } from './services/taskRouter.js';
|
|
17
|
+
import { InternalWorkflowsService } from './services/workflows.js';
|
|
17
18
|
import { buildObjectEventV2 } from './utils/buildObjectEventV2.js';
|
|
18
19
|
|
|
19
20
|
export class InternalSDK {
|
|
@@ -34,6 +35,7 @@ export class InternalSDK {
|
|
|
34
35
|
this.voicemail = new InternalVoicemailService(sdk);
|
|
35
36
|
this.voice = new InternalVoiceService(sdk);
|
|
36
37
|
this.taskRouter = new InternalTaskRouterService(sdk);
|
|
38
|
+
this.workflows = new InternalWorkflowsService(sdk);
|
|
37
39
|
|
|
38
40
|
// Proxy all base SDK properties and methods
|
|
39
41
|
this._proxyBaseSDK();
|
|
@@ -185,4 +187,5 @@ export { InternalVideoService } from './services/video.js';
|
|
|
185
187
|
export { InternalVoicemailService } from './services/voicemail.js';
|
|
186
188
|
export { InternalVoiceService } from './services/voice.js';
|
|
187
189
|
export { InternalTaskRouterService } from './services/taskRouter.js';
|
|
190
|
+
export { InternalWorkflowsService } from './services/workflows.js';
|
|
188
191
|
export { buildObjectEventV2 } from './utils/buildObjectEventV2.js';
|
package/package.json
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { internalRequest } from '../utils/sdkRequest.js';
|
|
2
|
+
export class InternalWorkflowsService {
|
|
3
|
+
constructor(sdk) {
|
|
4
|
+
this.sdk = sdk;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Report that the voice call driving a workflow session ended (caller hung
|
|
9
|
+
* up, or the workflow's own Hang Up module ran). The api records the module
|
|
10
|
+
* the session was on and, for caller hangups, completes the session.
|
|
11
|
+
* Idempotent. Matches
|
|
12
|
+
* app1-api/src/services/INTERNAL/workflows/controllers/sessionCallEnded.js.
|
|
13
|
+
*
|
|
14
|
+
* PUT /internal/workflows/session/:id/callEnded
|
|
15
|
+
* Body: { accountId, reason } reason: 'caller' | 'workflow'
|
|
16
|
+
*/
|
|
17
|
+
async sessionCallEnded({ sessionId, accountId, reason }) {
|
|
18
|
+
this.sdk.validateParams(
|
|
19
|
+
{ sessionId, accountId },
|
|
20
|
+
{
|
|
21
|
+
sessionId: { type: 'string', required: true },
|
|
22
|
+
accountId: { type: 'string', required: true },
|
|
23
|
+
},
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const body = { accountId };
|
|
27
|
+
if (reason) body.reason = reason;
|
|
28
|
+
|
|
29
|
+
const result = await internalRequest(
|
|
30
|
+
this.sdk,
|
|
31
|
+
`/internal/workflows/session/${sessionId}/callEnded`,
|
|
32
|
+
'PUT',
|
|
33
|
+
{ body },
|
|
34
|
+
);
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
}
|