retell-sdk 1.15.12 → 1.15.16
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/README.md +498 -279
- package/dist/internal/utils/queryparams.js +7 -3
- package/dist/internal/utils/requestbody.js +29 -19
- package/dist/internal/utils/security.js +11 -3
- package/dist/internal/utils/utils.js +3 -5
- package/dist/{sdk/models/shared → models/components}/agent.d.ts +1 -1
- package/dist/{sdk/models/shared → models/components}/agent.js +1 -1
- package/dist/{sdk/models/shared → models/components}/agentnodefaultnorequired.d.ts +1 -1
- package/dist/{sdk/models/shared → models/components}/agentnodefaultnorequired.js +1 -1
- package/dist/{sdk/models/shared → models/components}/agentpromptparams.d.ts +1 -1
- package/dist/{sdk/models/shared → models/components}/agentpromptparams.js +1 -1
- package/dist/{sdk/models/shared → models/components}/calldetail.d.ts +5 -5
- package/dist/{sdk/models/shared → models/components}/calldetail.js +14 -14
- package/dist/{sdk/models/shared → models/components}/callphonenumber.d.ts +2 -2
- package/dist/{sdk/models/shared → models/components}/callphonenumber.js +2 -2
- package/dist/{sdk/models/shared → models/components}/phonenumber.d.ts +1 -1
- package/dist/{sdk/models/shared → models/components}/phonenumber.js +1 -1
- package/dist/{sdk/models/shared → models/components}/security.d.ts +1 -1
- package/dist/{sdk/models/shared → models/components}/security.js +1 -1
- package/dist/{sdk/models → models}/errors/createagent.d.ts +8 -8
- package/dist/{sdk/models → models}/errors/createagent.js +38 -38
- package/dist/{sdk/models → models}/errors/createphonecall.d.ts +12 -12
- package/dist/{sdk/models → models}/errors/createphonecall.js +56 -56
- package/dist/{sdk/models → models}/errors/createphonenumber.d.ts +10 -10
- package/dist/{sdk/models → models}/errors/createphonenumber.js +47 -47
- package/dist/{sdk/models → models}/errors/deleteagent.d.ts +8 -8
- package/dist/{sdk/models → models}/errors/deleteagent.js +38 -38
- package/dist/models/errors/deletephonenumber.d.ts +45 -0
- package/dist/models/errors/deletephonenumber.js +144 -0
- package/dist/{sdk/models → models}/errors/getagent.d.ts +8 -8
- package/dist/{sdk/models/errors/getcall.js → models/errors/getagent.js} +38 -38
- package/dist/{sdk/models → models}/errors/getcall.d.ts +8 -8
- package/dist/{sdk/models/errors/getagent.js → models/errors/getcall.js} +38 -38
- package/dist/{sdk/models/errors/updatephoneagent.d.ts → models/errors/getphonenumber.d.ts} +8 -8
- package/dist/{sdk/models/errors/updatephoneagent.js → models/errors/getphonenumber.js} +38 -38
- package/dist/{sdk/models → models}/errors/listagents.d.ts +4 -4
- package/dist/{sdk/models → models}/errors/listagents.js +20 -20
- package/dist/{sdk/models → models}/errors/listcalls.d.ts +6 -6
- package/dist/{sdk/models → models}/errors/listcalls.js +29 -29
- package/dist/{sdk/models → models}/errors/listphonenumbers.d.ts +6 -6
- package/dist/{sdk/models → models}/errors/listphonenumbers.js +29 -29
- package/dist/{sdk/models → models}/errors/updateagent.d.ts +8 -8
- package/dist/{sdk/models → models}/errors/updateagent.js +38 -38
- package/dist/{sdk/models/errors/deletephonenumber.d.ts → models/errors/updatephoneagent.d.ts} +8 -8
- package/dist/models/errors/updatephoneagent.js +144 -0
- package/dist/{sdk/models → models}/operations/createagent.d.ts +4 -4
- package/dist/{sdk/models → models}/operations/createagent.js +3 -3
- package/dist/{sdk/models → models}/operations/createphonecall.d.ts +14 -14
- package/dist/{sdk/models → models}/operations/createphonecall.js +44 -44
- package/dist/{sdk/models → models}/operations/createphonenumber.d.ts +4 -4
- package/dist/{sdk/models → models}/operations/createphonenumber.js +3 -3
- package/dist/{sdk/models → models}/operations/deleteagent.d.ts +2 -2
- package/dist/{sdk/models → models}/operations/deleteagent.js +1 -1
- package/dist/{sdk/models → models}/operations/deletephonenumber.d.ts +2 -2
- package/dist/{sdk/models → models}/operations/deletephonenumber.js +1 -1
- package/dist/{sdk/models → models}/operations/getagent.d.ts +4 -4
- package/dist/{sdk/models → models}/operations/getagent.js +3 -3
- package/dist/{sdk/models → models}/operations/getcall.d.ts +4 -4
- package/dist/{sdk/models → models}/operations/getcall.js +3 -3
- package/dist/{sdk/models → models}/operations/getphonenumber.d.ts +4 -4
- package/dist/{sdk/models → models}/operations/getphonenumber.js +3 -3
- package/dist/{sdk/models → models}/operations/listagents.d.ts +7 -7
- package/dist/{sdk/models → models}/operations/listagents.js +6 -6
- package/dist/{sdk/models → models}/operations/listcalls.d.ts +13 -13
- package/dist/{sdk/models → models}/operations/listcalls.js +30 -30
- package/dist/{sdk/models → models}/operations/listphonenumbers.d.ts +7 -7
- package/dist/{sdk/models → models}/operations/listphonenumbers.js +6 -6
- package/dist/{sdk/models → models}/operations/updateagent.d.ts +5 -5
- package/dist/{sdk/models → models}/operations/updateagent.js +4 -4
- package/dist/{sdk/models → models}/operations/updatephoneagent.d.ts +4 -4
- package/dist/{sdk/models → models}/operations/updatephoneagent.js +3 -3
- package/dist/sdk/sdk.d.ts +5 -6
- package/dist/sdk/sdk.js +324 -338
- package/docs/models/{shared → components}/agent.md +0 -0
- package/docs/models/{shared → components}/agentnodefaultnorequired.md +0 -0
- package/docs/models/{shared → components}/agentpromptparams.md +0 -0
- package/docs/models/{shared → components}/calldetail.md +4 -4
- package/docs/models/{shared → components}/callphonenumber.md +1 -1
- package/docs/models/{shared/calldetailcallstatus.md → components/callstatus.md} +1 -1
- package/docs/models/{shared/calldetailcalltype.md → components/calltype.md} +1 -1
- package/docs/models/{shared → components}/phonenumber.md +0 -0
- package/docs/models/{shared → components}/security.md +0 -0
- package/docs/models/errors/{createphonecall422applicationjson.md → createagentresponse422responsebody.md} +1 -1
- package/docs/models/errors/{createphonecall500applicationjson.md → createagentresponse500responsebody.md} +1 -1
- package/docs/models/errors/{getcall400applicationjson.md → createagentresponsebody.md} +1 -1
- package/docs/models/errors/{createagent401applicationjson.md → createagentresponseresponsebody.md} +1 -1
- package/docs/models/errors/{createphonecall402applicationjson.md → createphonecallresponse402responsebody.md} +1 -1
- package/docs/models/errors/createphonecallresponse422responsebody.md +11 -0
- package/docs/models/errors/{createphonecall429applicationjson.md → createphonecallresponse429responsebody.md} +1 -1
- package/docs/models/errors/createphonecallresponse500responsebody.md +11 -0
- package/docs/models/errors/{listcalls400applicationjson.md → createphonecallresponsebody.md} +1 -1
- package/docs/models/errors/{createphonenumber401applicationjson.md → createphonecallresponseresponsebody.md} +1 -1
- package/docs/models/errors/{createphonenumber402applicationjson.md → createphonenumberresponse402responsebody.md} +1 -1
- package/docs/models/errors/createphonenumberresponse422responsebody.md +11 -0
- package/docs/models/errors/createphonenumberresponse500responsebody.md +11 -0
- package/docs/models/errors/{createagent400applicationjson.md → createphonenumberresponsebody.md} +1 -1
- package/docs/models/errors/createphonenumberresponseresponsebody.md +11 -0
- package/docs/models/errors/{createagent422applicationjson.md → deleteagentresponse422responsebody.md} +1 -1
- package/docs/models/errors/deleteagentresponse500responsebody.md +11 -0
- package/docs/models/errors/{getagent400applicationjson.md → deleteagentresponsebody.md} +1 -1
- package/docs/models/errors/deleteagentresponseresponsebody.md +11 -0
- package/docs/models/errors/deletephonenumberresponse422responsebody.md +11 -0
- package/docs/models/errors/deletephonenumberresponse500responsebody.md +11 -0
- package/docs/models/errors/{deleteagent400applicationjson.md → deletephonenumberresponsebody.md} +1 -1
- package/docs/models/errors/deletephonenumberresponseresponsebody.md +11 -0
- package/docs/models/errors/{getagent422applicationjson.md → getagentresponse422responsebody.md} +1 -1
- package/docs/models/errors/{getagent500applicationjson.md → getagentresponse500responsebody.md} +1 -1
- package/docs/models/errors/getagentresponsebody.md +11 -0
- package/docs/models/errors/{listagents401applicationjson.md → getagentresponseresponsebody.md} +1 -1
- package/docs/models/errors/{getcall422applicationjson.md → getcallresponse422responsebody.md} +1 -1
- package/docs/models/errors/{createagent500applicationjson.md → getcallresponse500responsebody.md} +1 -1
- package/docs/models/errors/getcallresponsebody.md +11 -0
- package/docs/models/errors/{getagent401applicationjson.md → getcallresponseresponsebody.md} +1 -1
- package/docs/models/errors/{createphonenumber422applicationjson.md → getphonenumberresponse422responsebody.md} +1 -1
- package/docs/models/errors/{createphonenumber500applicationjson.md → getphonenumberresponse500responsebody.md} +1 -1
- package/docs/models/errors/getphonenumberresponsebody.md +11 -0
- package/docs/models/errors/{createphonecall401applicationjson.md → getphonenumberresponseresponsebody.md} +1 -1
- package/docs/models/errors/{getcall401applicationjson.md → listagentsresponsebody.md} +1 -1
- package/docs/models/errors/{getcall500applicationjson.md → listagentsresponseresponsebody.md} +1 -1
- package/docs/models/errors/{deleteagent500applicationjson.md → listcallsresponse500responsebody.md} +1 -1
- package/docs/models/errors/listcallsresponsebody.md +11 -0
- package/docs/models/errors/{deleteagent401applicationjson.md → listcallsresponseresponsebody.md} +1 -1
- package/docs/models/errors/listphonenumbersresponse500responsebody.md +11 -0
- package/docs/models/errors/listphonenumbersresponsebody.md +11 -0
- package/docs/models/errors/listphonenumbersresponseresponsebody.md +11 -0
- package/docs/models/errors/{deleteagent422applicationjson.md → updateagentresponse422responsebody.md} +1 -1
- package/docs/models/errors/updateagentresponse500responsebody.md +11 -0
- package/docs/models/errors/updateagentresponsebody.md +11 -0
- package/docs/models/errors/updateagentresponseresponsebody.md +11 -0
- package/docs/models/errors/updatephoneagentresponse422responsebody.md +11 -0
- package/docs/models/errors/updatephoneagentresponse500responsebody.md +11 -0
- package/docs/models/errors/updatephoneagentresponsebody.md +11 -0
- package/docs/models/errors/updatephoneagentresponseresponsebody.md +11 -0
- package/docs/models/operations/{createphonecall201applicationjsoncallstatus.md → callstatus.md} +1 -1
- package/docs/models/operations/{listcallsfiltercriteriacalltype.md → calltype.md} +1 -1
- package/docs/models/operations/createagentrequestbody.md +0 -0
- package/docs/models/operations/createagentresponse.md +2 -2
- package/docs/models/operations/{createphonecall201applicationjsoncalltype.md → createphonecallcalltype.md} +1 -1
- package/docs/models/operations/createphonecallrequestbody.md +2 -2
- package/docs/models/operations/createphonecallresponse.md +6 -6
- package/docs/models/operations/{createphonecall201applicationjson.md → createphonecallresponsebody.md} +5 -5
- package/docs/models/operations/createphonenumberrequestbody.md +0 -0
- package/docs/models/operations/createphonenumberresponse.md +6 -6
- package/docs/models/operations/deleteagentrequest.md +0 -0
- package/docs/models/operations/deleteagentresponse.md +1 -1
- package/docs/models/operations/deletephonenumberrequest.md +0 -0
- package/docs/models/operations/deletephonenumberresponse.md +1 -1
- package/docs/models/operations/filtercriteria.md +13 -0
- package/docs/models/operations/getagentrequest.md +0 -0
- package/docs/models/operations/getagentresponse.md +2 -2
- package/docs/models/operations/getcallrequest.md +0 -0
- package/docs/models/operations/getcallresponse.md +6 -6
- package/docs/models/operations/getphonenumberrequest.md +0 -0
- package/docs/models/operations/getphonenumberresponse.md +6 -6
- package/docs/models/operations/listagentsresponse.md +2 -2
- package/docs/models/operations/listcallsrequest.md +2 -2
- package/docs/models/operations/listcallsresponse.md +6 -6
- package/docs/models/operations/listphonenumbersresponse.md +6 -6
- package/docs/models/operations/{createphonecallrequestbodyphonenumber.md → phonenumber.md} +1 -1
- package/docs/models/operations/{listcallssortorder.md → sortorder.md} +1 -1
- package/docs/models/operations/updateagentrequest.md +4 -4
- package/docs/models/operations/updateagentresponse.md +2 -2
- package/docs/models/operations/updatephoneagentrequest.md +4 -4
- package/docs/models/operations/updatephoneagentrequestbody.md +0 -0
- package/docs/models/operations/updatephoneagentresponse.md +6 -6
- package/docs/sdks/retellclient/README.md +205 -107
- package/package.json +10 -3
- package/dist/sdk/models/errors/deletephonenumber.js +0 -144
- package/dist/sdk/models/errors/getphonenumber.d.ts +0 -45
- package/dist/sdk/models/errors/getphonenumber.js +0 -144
- package/docs/models/errors/createphonecall400applicationjson.md +0 -11
- package/docs/models/errors/createphonenumber400applicationjson.md +0 -11
- package/docs/models/errors/deletephonenumber400applicationjson.md +0 -11
- package/docs/models/errors/deletephonenumber401applicationjson.md +0 -11
- package/docs/models/errors/deletephonenumber422applicationjson.md +0 -11
- package/docs/models/errors/deletephonenumber500applicationjson.md +0 -11
- package/docs/models/errors/getphonenumber400applicationjson.md +0 -11
- package/docs/models/errors/getphonenumber401applicationjson.md +0 -11
- package/docs/models/errors/getphonenumber422applicationjson.md +0 -11
- package/docs/models/errors/getphonenumber500applicationjson.md +0 -11
- package/docs/models/errors/listagents500applicationjson.md +0 -11
- package/docs/models/errors/listcalls401applicationjson.md +0 -11
- package/docs/models/errors/listcalls500applicationjson.md +0 -11
- package/docs/models/errors/listphonenumbers400applicationjson.md +0 -11
- package/docs/models/errors/listphonenumbers401applicationjson.md +0 -11
- package/docs/models/errors/listphonenumbers500applicationjson.md +0 -11
- package/docs/models/errors/updateagent400applicationjson.md +0 -11
- package/docs/models/errors/updateagent401applicationjson.md +0 -11
- package/docs/models/errors/updateagent422applicationjson.md +0 -11
- package/docs/models/errors/updateagent500applicationjson.md +0 -11
- package/docs/models/errors/updatephoneagent400applicationjson.md +0 -11
- package/docs/models/errors/updatephoneagent401applicationjson.md +0 -11
- package/docs/models/errors/updatephoneagent422applicationjson.md +0 -11
- package/docs/models/errors/updatephoneagent500applicationjson.md +0 -11
- package/docs/models/operations/listcallsfiltercriteria.md +0 -13
- package/dist/{sdk/models/shared → models/components}/index.d.ts +0 -0
- package/dist/{sdk/models/shared → models/components}/index.js +0 -0
- package/dist/{sdk/models → models}/errors/index.d.ts +1 -1
- package/dist/{sdk/models → models}/errors/index.js +1 -1
- /package/dist/{sdk/models → models}/errors/sdkerror.d.ts +0 -0
- /package/dist/{sdk/models → models}/errors/sdkerror.js +0 -0
- /package/dist/{sdk/models → models}/operations/index.d.ts +0 -0
- /package/dist/{sdk/models → models}/operations/index.js +0 -0
- /package/dist/{sdk/types → types}/index.d.ts +0 -0
- /package/dist/{sdk/types → types}/index.js +0 -0
- /package/dist/{sdk/types → types}/rfcdate.d.ts +0 -0
- /package/dist/{sdk/types → types}/rfcdate.js +0 -0
package/README.md
CHANGED
|
@@ -2,376 +2,413 @@
|
|
|
2
2
|
|
|
3
3
|
<div align="left">
|
|
4
4
|
<a href="https://speakeasyapi.dev/"><img src="https://custom-icon-badges.demolab.com/badge/-Built%20By%20Speakeasy-212015?style=for-the-badge&logoColor=FBE331&logo=speakeasy&labelColor=545454" /></a>
|
|
5
|
+
<a href="https://opensource.org/licenses/MIT">
|
|
6
|
+
<img src="https://img.shields.io/badge/License-MIT-blue.svg" style="width: 100px; height: 28px;" />
|
|
7
|
+
</a>
|
|
5
8
|
</div>
|
|
6
9
|
|
|
7
|
-
<!-- Start SDK Installation -->
|
|
8
|
-
# SDK Installation
|
|
9
10
|
|
|
10
|
-
##
|
|
11
|
+
## 🏗 **Welcome to your new SDK!** 🏗
|
|
12
|
+
|
|
13
|
+
It has been generated successfully based on your OpenAPI spec. However, it is not yet ready for production use. Here are some next steps:
|
|
14
|
+
- [ ] 🛠 Make your SDK feel handcrafted by [customizing it](https://www.speakeasyapi.dev/docs/customize-sdks)
|
|
15
|
+
- [ ] ♻️ Refine your SDK quickly by iterating locally with the [Speakeasy CLI](https://github.com/speakeasy-api/speakeasy)
|
|
16
|
+
- [ ] 🎁 Publish your SDK to package managers by [configuring automatic publishing](https://www.speakeasyapi.dev/docs/productionize-sdks/publish-sdks)
|
|
17
|
+
- [ ] ✨ When ready to productionize, delete this section from the README
|
|
18
|
+
|
|
19
|
+
<!-- Start SDK Installation [installation] -->
|
|
20
|
+
## SDK Installation
|
|
21
|
+
|
|
22
|
+
### NPM
|
|
11
23
|
|
|
12
24
|
```bash
|
|
13
|
-
npm add
|
|
25
|
+
npm add retell-sdk
|
|
14
26
|
```
|
|
15
27
|
|
|
16
|
-
|
|
28
|
+
### Yarn
|
|
17
29
|
|
|
18
30
|
```bash
|
|
19
|
-
yarn add
|
|
31
|
+
yarn add retell-sdk
|
|
20
32
|
```
|
|
21
|
-
<!-- End SDK Installation -->
|
|
33
|
+
<!-- End SDK Installation [installation] -->
|
|
22
34
|
|
|
35
|
+
<!-- Start SDK Example Usage [usage] -->
|
|
23
36
|
## SDK Example Usage
|
|
24
|
-
<!-- Start SDK Example Usage -->
|
|
25
37
|
|
|
26
|
-
|
|
38
|
+
### Create a new voice AI agent
|
|
39
|
+
|
|
27
40
|
Create a new agent
|
|
41
|
+
|
|
28
42
|
```typescript
|
|
29
43
|
import { RetellClient } from "retell-sdk";
|
|
30
44
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
async function run() {
|
|
46
|
+
const sdk = new RetellClient({
|
|
47
|
+
apiKey: "",
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const res = await sdk.createAgent({
|
|
51
|
+
agentName: "Jarvis",
|
|
52
|
+
beginMessage: "Hello there, how can I help you?",
|
|
53
|
+
enableBeginMessage: true,
|
|
54
|
+
enableEndCall: true,
|
|
55
|
+
enableEndMessage: false,
|
|
56
|
+
endMessage: "Hope you have a good day, goodbye.",
|
|
57
|
+
prompt: "You are a marketing assistant. You help come up with creative content ideas and content like marketing emails, blog posts, tweets, ad copy and product descriptions. You respond concisely, with filler words in it.",
|
|
58
|
+
voiceId: "elevenlabs-xxcrwXReTKMHWjqi7Q27",
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
if (res.statusCode == 200) {
|
|
62
|
+
// handle response
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
run();
|
|
67
|
+
|
|
53
68
|
```
|
|
54
69
|
|
|
70
|
+
### Create an outbound phone call
|
|
55
71
|
|
|
56
|
-
# Create an outbound phone call
|
|
57
72
|
Initiate an outbound phone call.
|
|
73
|
+
|
|
58
74
|
```typescript
|
|
59
75
|
import { RetellClient } from "retell-sdk";
|
|
60
76
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
77
|
+
async function run() {
|
|
78
|
+
const sdk = new RetellClient({
|
|
79
|
+
apiKey: "",
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const res = await sdk.createPhoneCall({
|
|
83
|
+
agentPromptParams: [
|
|
84
|
+
{
|
|
85
|
+
name: "username",
|
|
86
|
+
value: "Adam",
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
phoneNumber: {
|
|
90
|
+
from: "+14159095857",
|
|
91
|
+
to: "+14159095858",
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
if (res.statusCode == 200) {
|
|
96
|
+
// handle response
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
run();
|
|
101
|
+
|
|
85
102
|
```
|
|
86
103
|
|
|
104
|
+
### Create a new phone number
|
|
87
105
|
|
|
88
|
-
# Create a new phone number
|
|
89
106
|
Create a new phone number
|
|
107
|
+
|
|
90
108
|
```typescript
|
|
91
109
|
import { RetellClient } from "retell-sdk";
|
|
92
110
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
111
|
+
async function run() {
|
|
112
|
+
const sdk = new RetellClient({
|
|
113
|
+
apiKey: "",
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
const res = await sdk.createPhoneNumber({
|
|
117
|
+
agentId: "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
|
|
118
|
+
areaCode: 415,
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
if (res.statusCode == 200) {
|
|
122
|
+
// handle response
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
run();
|
|
127
|
+
|
|
109
128
|
```
|
|
110
129
|
|
|
130
|
+
### Delete an existing agent
|
|
111
131
|
|
|
112
|
-
# Delete an existing agent
|
|
113
132
|
Delete an existing agent
|
|
133
|
+
|
|
114
134
|
```typescript
|
|
115
135
|
import { RetellClient } from "retell-sdk";
|
|
116
|
-
import { DeleteAgentRequest } from "retell-sdk/dist/
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
136
|
+
import { DeleteAgentRequest } from "retell-sdk/dist/models/operations";
|
|
137
|
+
|
|
138
|
+
async function run() {
|
|
139
|
+
const sdk = new RetellClient({
|
|
140
|
+
apiKey: "",
|
|
141
|
+
});
|
|
142
|
+
const agentId: string = "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD";
|
|
143
|
+
|
|
144
|
+
const res = await sdk.deleteAgent(agentId);
|
|
145
|
+
|
|
146
|
+
if (res.statusCode == 200) {
|
|
147
|
+
// handle response
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
run();
|
|
152
|
+
|
|
132
153
|
```
|
|
133
154
|
|
|
155
|
+
### Delete a specific phone number
|
|
134
156
|
|
|
135
|
-
# Delete a specific phone number
|
|
136
157
|
Delete a specific phone number
|
|
158
|
+
|
|
137
159
|
```typescript
|
|
138
160
|
import { RetellClient } from "retell-sdk";
|
|
139
|
-
import { DeletePhoneNumberRequest } from "retell-sdk/dist/
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
161
|
+
import { DeletePhoneNumberRequest } from "retell-sdk/dist/models/operations";
|
|
162
|
+
|
|
163
|
+
async function run() {
|
|
164
|
+
const sdk = new RetellClient({
|
|
165
|
+
apiKey: "",
|
|
166
|
+
});
|
|
167
|
+
const phoneNumber: string = "string";
|
|
168
|
+
|
|
169
|
+
const res = await sdk.deletePhoneNumber(phoneNumber);
|
|
170
|
+
|
|
171
|
+
if (res.statusCode == 200) {
|
|
172
|
+
// handle response
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
run();
|
|
177
|
+
|
|
155
178
|
```
|
|
156
179
|
|
|
180
|
+
### Retrieve details of an agent
|
|
157
181
|
|
|
158
|
-
# Retrieve details of an agent
|
|
159
182
|
Retrieve details of a specific agent
|
|
183
|
+
|
|
160
184
|
```typescript
|
|
161
185
|
import { RetellClient } from "retell-sdk";
|
|
162
|
-
import { GetAgentRequest } from "retell-sdk/dist/
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
186
|
+
import { GetAgentRequest } from "retell-sdk/dist/models/operations";
|
|
187
|
+
|
|
188
|
+
async function run() {
|
|
189
|
+
const sdk = new RetellClient({
|
|
190
|
+
apiKey: "",
|
|
191
|
+
});
|
|
192
|
+
const agentId: string = "16b980523634a6dc504898cda492e939";
|
|
193
|
+
|
|
194
|
+
const res = await sdk.getAgent(agentId);
|
|
195
|
+
|
|
196
|
+
if (res.statusCode == 200) {
|
|
197
|
+
// handle response
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
run();
|
|
202
|
+
|
|
178
203
|
```
|
|
179
204
|
|
|
205
|
+
### Retrieve a on-going or finished call
|
|
180
206
|
|
|
181
|
-
# Retrieve a on-going or finished call
|
|
182
207
|
Retrieve details of a specific call
|
|
208
|
+
|
|
183
209
|
```typescript
|
|
184
210
|
import { RetellClient } from "retell-sdk";
|
|
185
|
-
import { GetCallRequest } from "retell-sdk/dist/
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
211
|
+
import { GetCallRequest } from "retell-sdk/dist/models/operations";
|
|
212
|
+
|
|
213
|
+
async function run() {
|
|
214
|
+
const sdk = new RetellClient({
|
|
215
|
+
apiKey: "",
|
|
216
|
+
});
|
|
217
|
+
const callId: string = "119c3f8e47135a29e65947eeb34cf12d";
|
|
218
|
+
|
|
219
|
+
const res = await sdk.getCall(callId);
|
|
220
|
+
|
|
221
|
+
if (res.statusCode == 200) {
|
|
222
|
+
// handle response
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
run();
|
|
227
|
+
|
|
201
228
|
```
|
|
202
229
|
|
|
230
|
+
### Retrieve info about a specific number
|
|
203
231
|
|
|
204
|
-
# Retrieve info about a specific number
|
|
205
232
|
Retrieve info about a specific number
|
|
233
|
+
|
|
206
234
|
```typescript
|
|
207
235
|
import { RetellClient } from "retell-sdk";
|
|
208
|
-
import { GetPhoneNumberRequest } from "retell-sdk/dist/
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
236
|
+
import { GetPhoneNumberRequest } from "retell-sdk/dist/models/operations";
|
|
237
|
+
|
|
238
|
+
async function run() {
|
|
239
|
+
const sdk = new RetellClient({
|
|
240
|
+
apiKey: "",
|
|
241
|
+
});
|
|
242
|
+
const phoneNumber: string = "+14159095857";
|
|
243
|
+
|
|
244
|
+
const res = await sdk.getPhoneNumber(phoneNumber);
|
|
245
|
+
|
|
246
|
+
if (res.statusCode == 200) {
|
|
247
|
+
// handle response
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
run();
|
|
252
|
+
|
|
224
253
|
```
|
|
225
254
|
|
|
255
|
+
### List all agents
|
|
226
256
|
|
|
227
|
-
# List all agents
|
|
228
257
|
List all agents
|
|
258
|
+
|
|
229
259
|
```typescript
|
|
230
260
|
import { RetellClient } from "retell-sdk";
|
|
231
261
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
262
|
+
async function run() {
|
|
263
|
+
const sdk = new RetellClient({
|
|
264
|
+
apiKey: "",
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
const res = await sdk.listAgents();
|
|
268
|
+
|
|
269
|
+
if (res.statusCode == 200) {
|
|
270
|
+
// handle response
|
|
271
|
+
}
|
|
272
|
+
}
|
|
238
273
|
|
|
239
|
-
|
|
274
|
+
run();
|
|
240
275
|
|
|
241
|
-
if (res.statusCode == 200) {
|
|
242
|
-
// handle response
|
|
243
|
-
}
|
|
244
|
-
})();
|
|
245
276
|
```
|
|
246
277
|
|
|
278
|
+
### List all web or phone calls
|
|
247
279
|
|
|
248
|
-
# List all web or phone calls
|
|
249
280
|
Retrieve call details
|
|
281
|
+
|
|
250
282
|
```typescript
|
|
251
283
|
import { RetellClient } from "retell-sdk";
|
|
252
284
|
import {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
} from "retell-sdk/dist/
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
if (res.statusCode == 200) {
|
|
284
|
-
// handle response
|
|
285
|
-
}
|
|
286
|
-
})();
|
|
285
|
+
CallType,
|
|
286
|
+
FilterCriteria,
|
|
287
|
+
ListCallsRequest,
|
|
288
|
+
SortOrder,
|
|
289
|
+
} from "retell-sdk/dist/models/operations";
|
|
290
|
+
|
|
291
|
+
async function run() {
|
|
292
|
+
const sdk = new RetellClient({
|
|
293
|
+
apiKey: "",
|
|
294
|
+
});
|
|
295
|
+
const filterCriteria: FilterCriteria = {
|
|
296
|
+
afterEndTimestamp: 1703302428800,
|
|
297
|
+
afterStartTimestamp: 1703302407300,
|
|
298
|
+
agentId: ["oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD"],
|
|
299
|
+
beforeEndTimestamp: 1703302428899,
|
|
300
|
+
beforeStartTimestamp: 1703302407399,
|
|
301
|
+
callType: [CallType.InboundPhoneCall, CallType.OutboundPhoneCall],
|
|
302
|
+
};
|
|
303
|
+
const limit: number = 666195;
|
|
304
|
+
const sortOrder: SortOrder = SortOrder.Descending;
|
|
305
|
+
|
|
306
|
+
const res = await sdk.listCalls(filterCriteria, limit, sortOrder);
|
|
307
|
+
|
|
308
|
+
if (res.statusCode == 200) {
|
|
309
|
+
// handle response
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
run();
|
|
314
|
+
|
|
287
315
|
```
|
|
288
316
|
|
|
317
|
+
### List all purchased and active phone numbers
|
|
289
318
|
|
|
290
|
-
# List all purchased and active phone numbers
|
|
291
319
|
List all purchased and active phone numbers
|
|
320
|
+
|
|
292
321
|
```typescript
|
|
293
322
|
import { RetellClient } from "retell-sdk";
|
|
294
323
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
},
|
|
300
|
-
});
|
|
324
|
+
async function run() {
|
|
325
|
+
const sdk = new RetellClient({
|
|
326
|
+
apiKey: "",
|
|
327
|
+
});
|
|
301
328
|
|
|
302
|
-
|
|
329
|
+
const res = await sdk.listPhoneNumbers();
|
|
330
|
+
|
|
331
|
+
if (res.statusCode == 200) {
|
|
332
|
+
// handle response
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
run();
|
|
303
337
|
|
|
304
|
-
if (res.statusCode == 200) {
|
|
305
|
-
// handle response
|
|
306
|
-
}
|
|
307
|
-
})();
|
|
308
338
|
```
|
|
309
339
|
|
|
340
|
+
### Update an existing agent
|
|
310
341
|
|
|
311
|
-
# Update an existing agent
|
|
312
342
|
Update an existing agent
|
|
343
|
+
|
|
313
344
|
```typescript
|
|
314
345
|
import { RetellClient } from "retell-sdk";
|
|
315
|
-
import {
|
|
316
|
-
import {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
const
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
346
|
+
import { AgentNoDefaultNoRequired } from "retell-sdk/dist/models/components";
|
|
347
|
+
import { UpdateAgentRequest } from "retell-sdk/dist/models/operations";
|
|
348
|
+
|
|
349
|
+
async function run() {
|
|
350
|
+
const sdk = new RetellClient({
|
|
351
|
+
apiKey: "",
|
|
352
|
+
});
|
|
353
|
+
const agentNoDefaultNoRequired: AgentNoDefaultNoRequired = {
|
|
354
|
+
agentName: "Jarvis",
|
|
355
|
+
beginMessage: "Hello there, how can I help you.",
|
|
356
|
+
enableBeginMessage: true,
|
|
357
|
+
enableEndCall: true,
|
|
358
|
+
enableEndMessage: false,
|
|
359
|
+
endMessage: "Hope you have a good day, goodbye.",
|
|
360
|
+
prompt: "You are a marketing assistant. You help come up with creative content ideas and content like marketing emails, blog posts, tweets, ad copy and product descriptions. You respond concisely, with filler words in it.",
|
|
361
|
+
voiceId: "elevenlabs-xxcrwXReTKMHWjqi7Q27",
|
|
362
|
+
};
|
|
363
|
+
const agentId: string = "16b980523634a6dc504898cda492e939";
|
|
364
|
+
|
|
365
|
+
const res = await sdk.updateAgent(agentNoDefaultNoRequired, agentId);
|
|
366
|
+
|
|
367
|
+
if (res.statusCode == 200) {
|
|
368
|
+
// handle response
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
run();
|
|
373
|
+
|
|
342
374
|
```
|
|
343
375
|
|
|
376
|
+
### Update an existing phone number
|
|
344
377
|
|
|
345
|
-
# Update an existing phone number
|
|
346
378
|
Update an existing phone number
|
|
379
|
+
|
|
347
380
|
```typescript
|
|
348
381
|
import { RetellClient } from "retell-sdk";
|
|
349
|
-
import {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
}
|
|
382
|
+
import {
|
|
383
|
+
UpdatePhoneAgentRequest,
|
|
384
|
+
UpdatePhoneAgentRequestBody,
|
|
385
|
+
} from "retell-sdk/dist/models/operations";
|
|
386
|
+
|
|
387
|
+
async function run() {
|
|
388
|
+
const sdk = new RetellClient({
|
|
389
|
+
apiKey: "",
|
|
390
|
+
});
|
|
391
|
+
const requestBody: UpdatePhoneAgentRequestBody = {
|
|
392
|
+
agentId: "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
|
|
393
|
+
};
|
|
394
|
+
const phoneNumber: string = "+14159095857";
|
|
395
|
+
|
|
396
|
+
const res = await sdk.updatePhoneAgent(requestBody, phoneNumber);
|
|
397
|
+
|
|
398
|
+
if (res.statusCode == 200) {
|
|
399
|
+
// handle response
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
run();
|
|
404
|
+
|
|
368
405
|
```
|
|
369
|
-
<!-- End SDK Example Usage -->
|
|
406
|
+
<!-- End SDK Example Usage [usage] -->
|
|
370
407
|
|
|
371
|
-
<!-- Start
|
|
372
|
-
|
|
408
|
+
<!-- Start Available Resources and Operations [operations] -->
|
|
409
|
+
## Available Resources and Operations
|
|
373
410
|
|
|
374
|
-
|
|
411
|
+
### [RetellClient SDK](docs/sdks/retellclient/README.md)
|
|
375
412
|
|
|
376
413
|
* [createAgent](docs/sdks/retellclient/README.md#createagent) - Create a new agent
|
|
377
414
|
* [createPhoneCall](docs/sdks/retellclient/README.md#createphonecall) - Initiate an outbound phone call.
|
|
@@ -386,25 +423,207 @@ const phoneNumber: string = "+14159095857";
|
|
|
386
423
|
* [listPhoneNumbers](docs/sdks/retellclient/README.md#listphonenumbers) - List all purchased and active phone numbers
|
|
387
424
|
* [updateAgent](docs/sdks/retellclient/README.md#updateagent) - Update an existing agent
|
|
388
425
|
* [updatePhoneAgent](docs/sdks/retellclient/README.md#updatephoneagent) - Update an existing phone number
|
|
389
|
-
<!-- End
|
|
426
|
+
<!-- End Available Resources and Operations [operations] -->
|
|
390
427
|
|
|
391
|
-
<!-- Start
|
|
428
|
+
<!-- Start Error Handling [errors] -->
|
|
429
|
+
## Error Handling
|
|
392
430
|
|
|
431
|
+
Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an error. If Error objects are specified in your OpenAPI Spec, the SDK will throw the appropriate Error type.
|
|
393
432
|
|
|
433
|
+
| Error Object | Status Code | Content Type |
|
|
434
|
+
| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- |
|
|
435
|
+
| errors.CreateAgentResponseBody | 400 | application/json |
|
|
436
|
+
| errors.CreateAgentResponseResponseBody | 401 | application/json |
|
|
437
|
+
| errors.CreateAgentResponse422ResponseBody | 422 | application/json |
|
|
438
|
+
| errors.CreateAgentResponse500ResponseBody | 500 | application/json |
|
|
439
|
+
| errors.SDKError | 400-600 | */* |
|
|
394
440
|
|
|
395
|
-
|
|
441
|
+
Example
|
|
396
442
|
|
|
397
|
-
|
|
398
|
-
|
|
443
|
+
```typescript
|
|
444
|
+
import { RetellClient } from "retell-sdk";
|
|
399
445
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
446
|
+
async function run() {
|
|
447
|
+
const sdk = new RetellClient({
|
|
448
|
+
apiKey: "",
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
let res;
|
|
452
|
+
try {
|
|
453
|
+
res = await sdk.createAgent({
|
|
454
|
+
agentName: "Jarvis",
|
|
455
|
+
beginMessage: "Hello there, how can I help you?",
|
|
456
|
+
enableBeginMessage: true,
|
|
457
|
+
enableEndCall: true,
|
|
458
|
+
enableEndMessage: false,
|
|
459
|
+
endMessage: "Hope you have a good day, goodbye.",
|
|
460
|
+
prompt: "You are a marketing assistant. You help come up with creative content ideas and content like marketing emails, blog posts, tweets, ad copy and product descriptions. You respond concisely, with filler words in it.",
|
|
461
|
+
voiceId: "elevenlabs-xxcrwXReTKMHWjqi7Q27",
|
|
462
|
+
});
|
|
463
|
+
} catch (err) {
|
|
464
|
+
if (err instanceof errors.CreateAgentResponseBody) {
|
|
465
|
+
console.error(err); // handle exception
|
|
466
|
+
throw err;
|
|
467
|
+
} else if (err instanceof errors.CreateAgentResponseResponseBody) {
|
|
468
|
+
console.error(err); // handle exception
|
|
469
|
+
throw err;
|
|
470
|
+
} else if (err instanceof errors.CreateAgentResponse422ResponseBody) {
|
|
471
|
+
console.error(err); // handle exception
|
|
472
|
+
throw err;
|
|
473
|
+
} else if (err instanceof errors.CreateAgentResponse500ResponseBody) {
|
|
474
|
+
console.error(err); // handle exception
|
|
475
|
+
throw err;
|
|
476
|
+
} else if (err instanceof errors.SDKError) {
|
|
477
|
+
console.error(err); // handle exception
|
|
478
|
+
throw err;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
if (res.statusCode == 200) {
|
|
483
|
+
// handle response
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
run();
|
|
403
488
|
|
|
404
|
-
|
|
489
|
+
```
|
|
490
|
+
<!-- End Error Handling [errors] -->
|
|
491
|
+
|
|
492
|
+
<!-- Start Server Selection [server] -->
|
|
493
|
+
## Server Selection
|
|
494
|
+
|
|
495
|
+
### Select Server by Index
|
|
496
|
+
|
|
497
|
+
You can override the default server globally by passing a server index to the `serverIdx: number` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
|
|
498
|
+
|
|
499
|
+
| # | Server | Variables |
|
|
500
|
+
| - | ------ | --------- |
|
|
501
|
+
| 0 | `https://api.re-tell.ai` | None |
|
|
502
|
+
|
|
503
|
+
#### Example
|
|
504
|
+
|
|
505
|
+
```typescript
|
|
506
|
+
import { RetellClient } from "retell-sdk";
|
|
507
|
+
|
|
508
|
+
async function run() {
|
|
509
|
+
const sdk = new RetellClient({
|
|
510
|
+
serverIdx: 0,
|
|
511
|
+
apiKey: "",
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
const res = await sdk.createAgent({
|
|
515
|
+
agentName: "Jarvis",
|
|
516
|
+
beginMessage: "Hello there, how can I help you?",
|
|
517
|
+
enableBeginMessage: true,
|
|
518
|
+
enableEndCall: true,
|
|
519
|
+
enableEndMessage: false,
|
|
520
|
+
endMessage: "Hope you have a good day, goodbye.",
|
|
521
|
+
prompt: "You are a marketing assistant. You help come up with creative content ideas and content like marketing emails, blog posts, tweets, ad copy and product descriptions. You respond concisely, with filler words in it.",
|
|
522
|
+
voiceId: "elevenlabs-xxcrwXReTKMHWjqi7Q27",
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
if (res.statusCode == 200) {
|
|
526
|
+
// handle response
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
run();
|
|
531
|
+
|
|
532
|
+
```
|
|
405
533
|
|
|
406
534
|
|
|
407
|
-
|
|
535
|
+
### Override Server URL Per-Client
|
|
536
|
+
|
|
537
|
+
The default server can also be overridden globally by passing a URL to the `serverURL: str` optional parameter when initializing the SDK client instance. For example:
|
|
538
|
+
```typescript
|
|
539
|
+
import { RetellClient } from "retell-sdk";
|
|
540
|
+
|
|
541
|
+
async function run() {
|
|
542
|
+
const sdk = new RetellClient({
|
|
543
|
+
serverURL: "https://api.re-tell.ai",
|
|
544
|
+
apiKey: "",
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
const res = await sdk.createAgent({
|
|
548
|
+
agentName: "Jarvis",
|
|
549
|
+
beginMessage: "Hello there, how can I help you?",
|
|
550
|
+
enableBeginMessage: true,
|
|
551
|
+
enableEndCall: true,
|
|
552
|
+
enableEndMessage: false,
|
|
553
|
+
endMessage: "Hope you have a good day, goodbye.",
|
|
554
|
+
prompt: "You are a marketing assistant. You help come up with creative content ideas and content like marketing emails, blog posts, tweets, ad copy and product descriptions. You respond concisely, with filler words in it.",
|
|
555
|
+
voiceId: "elevenlabs-xxcrwXReTKMHWjqi7Q27",
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
if (res.statusCode == 200) {
|
|
559
|
+
// handle response
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
run();
|
|
564
|
+
|
|
565
|
+
```
|
|
566
|
+
<!-- End Server Selection [server] -->
|
|
567
|
+
|
|
568
|
+
<!-- Start Custom HTTP Client [http-client] -->
|
|
569
|
+
## Custom HTTP Client
|
|
570
|
+
|
|
571
|
+
The Typescript SDK makes API calls using the [axios](https://axios-http.com/docs/intro) HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with a custom `AxiosInstance` object.
|
|
572
|
+
|
|
573
|
+
For example, you could specify a header for every request that your sdk makes as follows:
|
|
574
|
+
|
|
575
|
+
```typescript
|
|
576
|
+
import { retell-sdk } from "RetellClient";
|
|
577
|
+
import axios from "axios";
|
|
578
|
+
|
|
579
|
+
const httpClient = axios.create({
|
|
580
|
+
headers: {'x-custom-header': 'someValue'}
|
|
581
|
+
})
|
|
582
|
+
|
|
583
|
+
const sdk = new RetellClient({defaultClient: httpClient});
|
|
584
|
+
```
|
|
585
|
+
<!-- End Custom HTTP Client [http-client] -->
|
|
586
|
+
|
|
587
|
+
<!-- Start Authentication [security] -->
|
|
588
|
+
## Authentication
|
|
589
|
+
|
|
590
|
+
### Per-Client Security Schemes
|
|
591
|
+
|
|
592
|
+
This SDK supports the following security scheme globally:
|
|
593
|
+
|
|
594
|
+
| Name | Type | Scheme |
|
|
595
|
+
| ----------- | ----------- | ----------- |
|
|
596
|
+
| `apiKey` | http | HTTP Bearer |
|
|
597
|
+
|
|
598
|
+
To authenticate with the API the `apiKey` parameter must be set when initializing the SDK client instance. For example:
|
|
599
|
+
```typescript
|
|
600
|
+
import { RetellClient } from "retell-sdk";
|
|
601
|
+
|
|
602
|
+
async function run() {
|
|
603
|
+
const sdk = new RetellClient({
|
|
604
|
+
apiKey: "",
|
|
605
|
+
});
|
|
606
|
+
|
|
607
|
+
const res = await sdk.createAgent({
|
|
608
|
+
agentName: "Jarvis",
|
|
609
|
+
beginMessage: "Hello there, how can I help you?",
|
|
610
|
+
enableBeginMessage: true,
|
|
611
|
+
enableEndCall: true,
|
|
612
|
+
enableEndMessage: false,
|
|
613
|
+
endMessage: "Hope you have a good day, goodbye.",
|
|
614
|
+
prompt: "You are a marketing assistant. You help come up with creative content ideas and content like marketing emails, blog posts, tweets, ad copy and product descriptions. You respond concisely, with filler words in it.",
|
|
615
|
+
voiceId: "elevenlabs-xxcrwXReTKMHWjqi7Q27",
|
|
616
|
+
});
|
|
617
|
+
|
|
618
|
+
if (res.statusCode == 200) {
|
|
619
|
+
// handle response
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
run();
|
|
624
|
+
|
|
625
|
+
```
|
|
626
|
+
<!-- End Authentication [security] -->
|
|
408
627
|
|
|
409
628
|
<!-- Placeholder for Future Speakeasy SDK Sections -->
|
|
410
629
|
|