retell-sdk 1.15.12 → 1.15.15
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 +1033 -243
- 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/models/components/agent.d.ts +43 -0
- package/dist/models/components/agent.js +90 -0
- package/dist/models/components/agentnodefaultnorequired.d.ts +35 -0
- package/dist/models/components/agentnodefaultnorequired.js +80 -0
- package/dist/models/components/agentpromptparams.d.ts +11 -0
- package/dist/models/components/agentpromptparams.js +50 -0
- package/dist/models/components/calldetail.d.ts +58 -0
- package/dist/models/components/calldetail.js +112 -0
- package/dist/models/components/callphonenumber.d.ts +14 -0
- package/dist/models/components/callphonenumber.js +53 -0
- package/dist/models/components/index.d.ts +7 -0
- package/dist/models/components/index.js +26 -0
- package/dist/models/components/phonenumber.d.ts +23 -0
- package/dist/models/components/phonenumber.js +65 -0
- package/dist/models/components/security.d.ts +4 -0
- package/dist/models/components/security.js +45 -0
- package/dist/models/errors/createagent.d.ts +45 -0
- package/dist/models/errors/createagent.js +144 -0
- package/dist/models/errors/createphonecall.d.ts +67 -0
- package/dist/models/errors/createphonecall.js +200 -0
- package/dist/models/errors/createphonenumber.d.ts +56 -0
- package/dist/models/errors/createphonenumber.js +172 -0
- package/dist/models/errors/deleteagent.d.ts +45 -0
- package/dist/models/errors/deleteagent.js +144 -0
- package/dist/models/errors/deletephonenumber.d.ts +45 -0
- package/dist/models/errors/deletephonenumber.js +144 -0
- package/dist/models/errors/getagent.d.ts +45 -0
- package/dist/models/errors/getagent.js +144 -0
- package/dist/models/errors/getcall.d.ts +45 -0
- package/dist/models/errors/getcall.js +144 -0
- package/dist/models/errors/getphonenumber.d.ts +45 -0
- package/dist/models/errors/getphonenumber.js +144 -0
- package/dist/models/errors/index.d.ts +14 -0
- package/dist/models/errors/index.js +33 -0
- package/dist/models/errors/listagents.d.ts +23 -0
- package/dist/models/errors/listagents.js +88 -0
- package/dist/models/errors/listcalls.d.ts +34 -0
- package/dist/models/errors/listcalls.js +116 -0
- package/dist/models/errors/listphonenumbers.d.ts +34 -0
- package/dist/models/errors/listphonenumbers.js +116 -0
- package/dist/models/errors/sdkerror.d.ts +7 -0
- package/dist/models/errors/sdkerror.js +40 -0
- package/dist/models/errors/updateagent.d.ts +45 -0
- package/dist/models/errors/updateagent.js +144 -0
- package/dist/models/errors/updatephoneagent.d.ts +45 -0
- package/dist/models/errors/updatephoneagent.js +144 -0
- package/dist/models/operations/createagent.d.ts +55 -0
- package/dist/models/operations/createagent.js +128 -0
- package/dist/models/operations/createphonecall.d.ts +87 -0
- package/dist/models/operations/createphonecall.js +187 -0
- package/dist/models/operations/createphonenumber.d.ts +31 -0
- package/dist/models/operations/createphonenumber.js +98 -0
- package/dist/models/operations/deleteagent.d.ts +22 -0
- package/dist/models/operations/deleteagent.js +63 -0
- package/dist/models/operations/deletephonenumber.d.ts +22 -0
- package/dist/models/operations/deletephonenumber.js +63 -0
- package/dist/models/operations/getagent.d.ts +27 -0
- package/dist/models/operations/getagent.js +91 -0
- package/dist/models/operations/getcall.d.ts +27 -0
- package/dist/models/operations/getcall.js +91 -0
- package/dist/models/operations/getphonenumber.d.ts +27 -0
- package/dist/models/operations/getphonenumber.js +91 -0
- package/dist/models/operations/index.d.ts +13 -0
- package/dist/models/operations/index.js +32 -0
- package/dist/models/operations/listagents.d.ts +21 -0
- package/dist/models/operations/listagents.js +79 -0
- package/dist/models/operations/listcalls.d.ts +70 -0
- package/dist/models/operations/listcalls.js +145 -0
- package/dist/models/operations/listphonenumbers.d.ts +21 -0
- package/dist/models/operations/listphonenumbers.js +79 -0
- package/dist/models/operations/updateagent.d.ts +28 -0
- package/dist/models/operations/updateagent.js +95 -0
- package/dist/models/operations/updatephoneagent.d.ts +34 -0
- package/dist/models/operations/updatephoneagent.js +109 -0
- package/dist/sdk/sdk.d.ts +5 -5
- package/dist/sdk/sdk.js +325 -325
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +20 -0
- package/dist/types/rfcdate.d.ts +9 -0
- package/dist/types/rfcdate.js +59 -0
- 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/{getagent401applicationjson.md → deleteagentresponseresponsebody.md} +1 -1
- 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/{deleteagent500applicationjson.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/{getcall500applicationjson.md → getcallresponse500responsebody.md} +1 -1
- package/docs/models/errors/getcallresponsebody.md +11 -0
- package/docs/models/errors/{listcalls401applicationjson.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/{getagent500applicationjson.md → listagentsresponseresponsebody.md} +1 -1
- package/docs/models/errors/{createagent500applicationjson.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/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/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/README.md
CHANGED
|
@@ -4,374 +4,987 @@
|
|
|
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
5
|
</div>
|
|
6
6
|
|
|
7
|
+
<!-- Start SDK Installation [installation] -->
|
|
8
|
+
## SDK Installation
|
|
9
|
+
|
|
10
|
+
### NPM
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm add retell-sdk
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Yarn
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
yarn add retell-sdk
|
|
20
|
+
```
|
|
21
|
+
<!-- End SDK Installation [installation] -->
|
|
22
|
+
|
|
23
|
+
<!-- Start SDK Example Usage [usage] -->
|
|
24
|
+
## SDK Example Usage
|
|
25
|
+
|
|
26
|
+
### Create a new voice AI agent
|
|
27
|
+
|
|
28
|
+
Create a new agent
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import { RetellClient } from "retell-sdk";
|
|
32
|
+
|
|
33
|
+
async function run() {
|
|
34
|
+
const sdk = new RetellClient({
|
|
35
|
+
apiKey: "",
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const res = await sdk.createAgent({
|
|
39
|
+
agentName: "Jarvis",
|
|
40
|
+
beginMessage: "Hello there, how can I help you?",
|
|
41
|
+
enableBeginMessage: true,
|
|
42
|
+
enableEndCall: true,
|
|
43
|
+
enableEndMessage: false,
|
|
44
|
+
endMessage: "Hope you have a good day, goodbye.",
|
|
45
|
+
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.",
|
|
46
|
+
voiceId: "elevenlabs-xxcrwXReTKMHWjqi7Q27",
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
if (res.statusCode == 200) {
|
|
50
|
+
// handle response
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
run();
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Create an outbound phone call
|
|
59
|
+
|
|
60
|
+
Initiate an outbound phone call.
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
import { RetellClient } from "retell-sdk";
|
|
64
|
+
|
|
65
|
+
async function run() {
|
|
66
|
+
const sdk = new RetellClient({
|
|
67
|
+
apiKey: "",
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const res = await sdk.createPhoneCall({
|
|
71
|
+
agentPromptParams: [
|
|
72
|
+
{
|
|
73
|
+
name: "username",
|
|
74
|
+
value: "Adam",
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
phoneNumber: {
|
|
78
|
+
from: "+14159095857",
|
|
79
|
+
to: "+14159095858",
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
if (res.statusCode == 200) {
|
|
84
|
+
// handle response
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
run();
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Create a new phone number
|
|
93
|
+
|
|
94
|
+
Create a new phone number
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
import { RetellClient } from "retell-sdk";
|
|
98
|
+
|
|
99
|
+
async function run() {
|
|
100
|
+
const sdk = new RetellClient({
|
|
101
|
+
apiKey: "",
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const res = await sdk.createPhoneNumber({
|
|
105
|
+
agentId: "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
|
|
106
|
+
areaCode: 415,
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
if (res.statusCode == 200) {
|
|
110
|
+
// handle response
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
run();
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Delete an existing agent
|
|
119
|
+
|
|
120
|
+
Delete an existing agent
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
import { RetellClient } from "retell-sdk";
|
|
124
|
+
import { DeleteAgentRequest } from "retell-sdk/dist/models/operations";
|
|
125
|
+
|
|
126
|
+
async function run() {
|
|
127
|
+
const sdk = new RetellClient({
|
|
128
|
+
apiKey: "",
|
|
129
|
+
});
|
|
130
|
+
const agentId: string = "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD";
|
|
131
|
+
|
|
132
|
+
const res = await sdk.deleteAgent(agentId);
|
|
133
|
+
|
|
134
|
+
if (res.statusCode == 200) {
|
|
135
|
+
// handle response
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
run();
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Delete a specific phone number
|
|
144
|
+
|
|
145
|
+
Delete a specific phone number
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
import { RetellClient } from "retell-sdk";
|
|
149
|
+
import { DeletePhoneNumberRequest } from "retell-sdk/dist/models/operations";
|
|
150
|
+
|
|
151
|
+
async function run() {
|
|
152
|
+
const sdk = new RetellClient({
|
|
153
|
+
apiKey: "",
|
|
154
|
+
});
|
|
155
|
+
const phoneNumber: string = "string";
|
|
156
|
+
|
|
157
|
+
const res = await sdk.deletePhoneNumber(phoneNumber);
|
|
158
|
+
|
|
159
|
+
if (res.statusCode == 200) {
|
|
160
|
+
// handle response
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
run();
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Retrieve details of an agent
|
|
169
|
+
|
|
170
|
+
Retrieve details of a specific agent
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
import { RetellClient } from "retell-sdk";
|
|
174
|
+
import { GetAgentRequest } from "retell-sdk/dist/models/operations";
|
|
175
|
+
|
|
176
|
+
async function run() {
|
|
177
|
+
const sdk = new RetellClient({
|
|
178
|
+
apiKey: "",
|
|
179
|
+
});
|
|
180
|
+
const agentId: string = "16b980523634a6dc504898cda492e939";
|
|
181
|
+
|
|
182
|
+
const res = await sdk.getAgent(agentId);
|
|
183
|
+
|
|
184
|
+
if (res.statusCode == 200) {
|
|
185
|
+
// handle response
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
run();
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Retrieve a on-going or finished call
|
|
194
|
+
|
|
195
|
+
Retrieve details of a specific call
|
|
196
|
+
|
|
197
|
+
```typescript
|
|
198
|
+
import { RetellClient } from "retell-sdk";
|
|
199
|
+
import { GetCallRequest } from "retell-sdk/dist/models/operations";
|
|
200
|
+
|
|
201
|
+
async function run() {
|
|
202
|
+
const sdk = new RetellClient({
|
|
203
|
+
apiKey: "",
|
|
204
|
+
});
|
|
205
|
+
const callId: string = "119c3f8e47135a29e65947eeb34cf12d";
|
|
206
|
+
|
|
207
|
+
const res = await sdk.getCall(callId);
|
|
208
|
+
|
|
209
|
+
if (res.statusCode == 200) {
|
|
210
|
+
// handle response
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
run();
|
|
215
|
+
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Retrieve info about a specific number
|
|
219
|
+
|
|
220
|
+
Retrieve info about a specific number
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
import { RetellClient } from "retell-sdk";
|
|
224
|
+
import { GetPhoneNumberRequest } from "retell-sdk/dist/models/operations";
|
|
225
|
+
|
|
226
|
+
async function run() {
|
|
227
|
+
const sdk = new RetellClient({
|
|
228
|
+
apiKey: "",
|
|
229
|
+
});
|
|
230
|
+
const phoneNumber: string = "+14159095857";
|
|
231
|
+
|
|
232
|
+
const res = await sdk.getPhoneNumber(phoneNumber);
|
|
233
|
+
|
|
234
|
+
if (res.statusCode == 200) {
|
|
235
|
+
// handle response
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
run();
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### List all agents
|
|
244
|
+
|
|
245
|
+
List all agents
|
|
246
|
+
|
|
247
|
+
```typescript
|
|
248
|
+
import { RetellClient } from "retell-sdk";
|
|
249
|
+
|
|
250
|
+
async function run() {
|
|
251
|
+
const sdk = new RetellClient({
|
|
252
|
+
apiKey: "",
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
const res = await sdk.listAgents();
|
|
256
|
+
|
|
257
|
+
if (res.statusCode == 200) {
|
|
258
|
+
// handle response
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
run();
|
|
263
|
+
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### List all web or phone calls
|
|
267
|
+
|
|
268
|
+
Retrieve call details
|
|
269
|
+
|
|
270
|
+
```typescript
|
|
271
|
+
import { RetellClient } from "retell-sdk";
|
|
272
|
+
import {
|
|
273
|
+
CallType,
|
|
274
|
+
FilterCriteria,
|
|
275
|
+
ListCallsRequest,
|
|
276
|
+
SortOrder,
|
|
277
|
+
} from "retell-sdk/dist/models/operations";
|
|
278
|
+
|
|
279
|
+
async function run() {
|
|
280
|
+
const sdk = new RetellClient({
|
|
281
|
+
apiKey: "",
|
|
282
|
+
});
|
|
283
|
+
const filterCriteria: FilterCriteria = {
|
|
284
|
+
afterEndTimestamp: 1703302428800,
|
|
285
|
+
afterStartTimestamp: 1703302407300,
|
|
286
|
+
agentId: ["oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD"],
|
|
287
|
+
beforeEndTimestamp: 1703302428899,
|
|
288
|
+
beforeStartTimestamp: 1703302407399,
|
|
289
|
+
callType: [CallType.InboundPhoneCall, CallType.OutboundPhoneCall],
|
|
290
|
+
};
|
|
291
|
+
const limit: number = 666195;
|
|
292
|
+
const sortOrder: SortOrder = SortOrder.Descending;
|
|
293
|
+
|
|
294
|
+
const res = await sdk.listCalls(filterCriteria, limit, sortOrder);
|
|
295
|
+
|
|
296
|
+
if (res.statusCode == 200) {
|
|
297
|
+
// handle response
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
run();
|
|
302
|
+
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### List all purchased and active phone numbers
|
|
306
|
+
|
|
307
|
+
List all purchased and active phone numbers
|
|
308
|
+
|
|
309
|
+
```typescript
|
|
310
|
+
import { RetellClient } from "retell-sdk";
|
|
311
|
+
|
|
312
|
+
async function run() {
|
|
313
|
+
const sdk = new RetellClient({
|
|
314
|
+
apiKey: "",
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
const res = await sdk.listPhoneNumbers();
|
|
318
|
+
|
|
319
|
+
if (res.statusCode == 200) {
|
|
320
|
+
// handle response
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
run();
|
|
325
|
+
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### Update an existing agent
|
|
329
|
+
|
|
330
|
+
Update an existing agent
|
|
331
|
+
|
|
332
|
+
```typescript
|
|
333
|
+
import { RetellClient } from "retell-sdk";
|
|
334
|
+
import { AgentNoDefaultNoRequired } from "retell-sdk/dist/models/components";
|
|
335
|
+
import { UpdateAgentRequest } from "retell-sdk/dist/models/operations";
|
|
336
|
+
|
|
337
|
+
async function run() {
|
|
338
|
+
const sdk = new RetellClient({
|
|
339
|
+
apiKey: "",
|
|
340
|
+
});
|
|
341
|
+
const agentNoDefaultNoRequired: AgentNoDefaultNoRequired = {
|
|
342
|
+
agentName: "Jarvis",
|
|
343
|
+
beginMessage: "Hello there, how can I help you.",
|
|
344
|
+
enableBeginMessage: true,
|
|
345
|
+
enableEndCall: true,
|
|
346
|
+
enableEndMessage: false,
|
|
347
|
+
endMessage: "Hope you have a good day, goodbye.",
|
|
348
|
+
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.",
|
|
349
|
+
voiceId: "elevenlabs-xxcrwXReTKMHWjqi7Q27",
|
|
350
|
+
};
|
|
351
|
+
const agentId: string = "16b980523634a6dc504898cda492e939";
|
|
352
|
+
|
|
353
|
+
const res = await sdk.updateAgent(agentNoDefaultNoRequired, agentId);
|
|
354
|
+
|
|
355
|
+
if (res.statusCode == 200) {
|
|
356
|
+
// handle response
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
run();
|
|
361
|
+
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### Update an existing phone number
|
|
365
|
+
|
|
366
|
+
Update an existing phone number
|
|
367
|
+
|
|
368
|
+
```typescript
|
|
369
|
+
import { RetellClient } from "retell-sdk";
|
|
370
|
+
import {
|
|
371
|
+
UpdatePhoneAgentRequest,
|
|
372
|
+
UpdatePhoneAgentRequestBody,
|
|
373
|
+
} from "retell-sdk/dist/models/operations";
|
|
374
|
+
|
|
375
|
+
async function run() {
|
|
376
|
+
const sdk = new RetellClient({
|
|
377
|
+
apiKey: "",
|
|
378
|
+
});
|
|
379
|
+
const requestBody: UpdatePhoneAgentRequestBody = {
|
|
380
|
+
agentId: "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
|
|
381
|
+
};
|
|
382
|
+
const phoneNumber: string = "+14159095857";
|
|
383
|
+
|
|
384
|
+
const res = await sdk.updatePhoneAgent(requestBody, phoneNumber);
|
|
385
|
+
|
|
386
|
+
if (res.statusCode == 200) {
|
|
387
|
+
// handle response
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
run();
|
|
392
|
+
|
|
393
|
+
```
|
|
394
|
+
<!-- End SDK Example Usage [usage] -->
|
|
395
|
+
|
|
396
|
+
<!-- Start Available Resources and Operations [operations] -->
|
|
397
|
+
## Available Resources and Operations
|
|
398
|
+
|
|
399
|
+
### [RetellClient SDK](docs/sdks/retellclient/README.md)
|
|
400
|
+
|
|
401
|
+
* [createAgent](docs/sdks/retellclient/README.md#createagent) - Create a new agent
|
|
402
|
+
* [createPhoneCall](docs/sdks/retellclient/README.md#createphonecall) - Initiate an outbound phone call.
|
|
403
|
+
* [createPhoneNumber](docs/sdks/retellclient/README.md#createphonenumber) - Create a new phone number
|
|
404
|
+
* [deleteAgent](docs/sdks/retellclient/README.md#deleteagent) - Delete an existing agent
|
|
405
|
+
* [deletePhoneNumber](docs/sdks/retellclient/README.md#deletephonenumber) - Delete a specific phone number
|
|
406
|
+
* [getAgent](docs/sdks/retellclient/README.md#getagent) - Retrieve details of a specific agent
|
|
407
|
+
* [getCall](docs/sdks/retellclient/README.md#getcall) - Retrieve details of a specific call
|
|
408
|
+
* [getPhoneNumber](docs/sdks/retellclient/README.md#getphonenumber) - Retrieve info about a specific number
|
|
409
|
+
* [listAgents](docs/sdks/retellclient/README.md#listagents) - List all agents
|
|
410
|
+
* [listCalls](docs/sdks/retellclient/README.md#listcalls) - Retrieve call details
|
|
411
|
+
* [listPhoneNumbers](docs/sdks/retellclient/README.md#listphonenumbers) - List all purchased and active phone numbers
|
|
412
|
+
* [updateAgent](docs/sdks/retellclient/README.md#updateagent) - Update an existing agent
|
|
413
|
+
* [updatePhoneAgent](docs/sdks/retellclient/README.md#updatephoneagent) - Update an existing phone number
|
|
414
|
+
<!-- End Available Resources and Operations [operations] -->
|
|
415
|
+
|
|
416
|
+
<!-- Start Error Handling [errors] -->
|
|
417
|
+
## Error Handling
|
|
418
|
+
|
|
419
|
+
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.
|
|
420
|
+
|
|
421
|
+
| Error Object | Status Code | Content Type |
|
|
422
|
+
| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- |
|
|
423
|
+
| errors.CreateAgentResponseBody | 400 | application/json |
|
|
424
|
+
| errors.CreateAgentResponseResponseBody | 401 | application/json |
|
|
425
|
+
| errors.CreateAgentResponse422ResponseBody | 422 | application/json |
|
|
426
|
+
| errors.CreateAgentResponse500ResponseBody | 500 | application/json |
|
|
427
|
+
| errors.SDKError | 400-600 | */* |
|
|
428
|
+
|
|
429
|
+
Example
|
|
430
|
+
|
|
431
|
+
```typescript
|
|
432
|
+
import { RetellClient } from "retell-sdk";
|
|
433
|
+
|
|
434
|
+
async function run() {
|
|
435
|
+
const sdk = new RetellClient({
|
|
436
|
+
apiKey: "",
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
let res;
|
|
440
|
+
try {
|
|
441
|
+
res = await sdk.createAgent({
|
|
442
|
+
agentName: "Jarvis",
|
|
443
|
+
beginMessage: "Hello there, how can I help you?",
|
|
444
|
+
enableBeginMessage: true,
|
|
445
|
+
enableEndCall: true,
|
|
446
|
+
enableEndMessage: false,
|
|
447
|
+
endMessage: "Hope you have a good day, goodbye.",
|
|
448
|
+
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.",
|
|
449
|
+
voiceId: "elevenlabs-xxcrwXReTKMHWjqi7Q27",
|
|
450
|
+
});
|
|
451
|
+
} catch (err) {
|
|
452
|
+
if (err instanceof errors.CreateAgentResponseBody) {
|
|
453
|
+
console.error(err); // handle exception
|
|
454
|
+
throw err;
|
|
455
|
+
} else if (err instanceof errors.CreateAgentResponseResponseBody) {
|
|
456
|
+
console.error(err); // handle exception
|
|
457
|
+
throw err;
|
|
458
|
+
} else if (err instanceof errors.CreateAgentResponse422ResponseBody) {
|
|
459
|
+
console.error(err); // handle exception
|
|
460
|
+
throw err;
|
|
461
|
+
} else if (err instanceof errors.CreateAgentResponse500ResponseBody) {
|
|
462
|
+
console.error(err); // handle exception
|
|
463
|
+
throw err;
|
|
464
|
+
} else if (err instanceof errors.SDKError) {
|
|
465
|
+
console.error(err); // handle exception
|
|
466
|
+
throw err;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
if (res.statusCode == 200) {
|
|
471
|
+
// handle response
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
run();
|
|
476
|
+
|
|
477
|
+
```
|
|
478
|
+
<!-- End Error Handling [errors] -->
|
|
479
|
+
|
|
480
|
+
<!-- Start Server Selection [server] -->
|
|
481
|
+
## Server Selection
|
|
482
|
+
|
|
483
|
+
### Select Server by Index
|
|
484
|
+
|
|
485
|
+
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:
|
|
486
|
+
|
|
487
|
+
| # | Server | Variables |
|
|
488
|
+
| - | ------ | --------- |
|
|
489
|
+
| 0 | `https://api.re-tell.ai` | None |
|
|
490
|
+
|
|
491
|
+
#### Example
|
|
492
|
+
|
|
493
|
+
```typescript
|
|
494
|
+
import { RetellClient } from "retell-sdk";
|
|
495
|
+
|
|
496
|
+
async function run() {
|
|
497
|
+
const sdk = new RetellClient({
|
|
498
|
+
serverIdx: 0,
|
|
499
|
+
apiKey: "",
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
const res = await sdk.createAgent({
|
|
503
|
+
agentName: "Jarvis",
|
|
504
|
+
beginMessage: "Hello there, how can I help you?",
|
|
505
|
+
enableBeginMessage: true,
|
|
506
|
+
enableEndCall: true,
|
|
507
|
+
enableEndMessage: false,
|
|
508
|
+
endMessage: "Hope you have a good day, goodbye.",
|
|
509
|
+
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.",
|
|
510
|
+
voiceId: "elevenlabs-xxcrwXReTKMHWjqi7Q27",
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
if (res.statusCode == 200) {
|
|
514
|
+
// handle response
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
run();
|
|
519
|
+
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
### Override Server URL Per-Client
|
|
524
|
+
|
|
525
|
+
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:
|
|
526
|
+
```typescript
|
|
527
|
+
import { RetellClient } from "retell-sdk";
|
|
528
|
+
|
|
529
|
+
async function run() {
|
|
530
|
+
const sdk = new RetellClient({
|
|
531
|
+
serverURL: "https://api.re-tell.ai",
|
|
532
|
+
apiKey: "",
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
const res = await sdk.createAgent({
|
|
536
|
+
agentName: "Jarvis",
|
|
537
|
+
beginMessage: "Hello there, how can I help you?",
|
|
538
|
+
enableBeginMessage: true,
|
|
539
|
+
enableEndCall: true,
|
|
540
|
+
enableEndMessage: false,
|
|
541
|
+
endMessage: "Hope you have a good day, goodbye.",
|
|
542
|
+
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.",
|
|
543
|
+
voiceId: "elevenlabs-xxcrwXReTKMHWjqi7Q27",
|
|
544
|
+
});
|
|
545
|
+
|
|
546
|
+
if (res.statusCode == 200) {
|
|
547
|
+
// handle response
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
run();
|
|
552
|
+
|
|
553
|
+
```
|
|
554
|
+
<!-- End Server Selection [server] -->
|
|
555
|
+
|
|
556
|
+
<!-- Start Custom HTTP Client [http-client] -->
|
|
557
|
+
## Custom HTTP Client
|
|
558
|
+
|
|
559
|
+
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.
|
|
560
|
+
|
|
561
|
+
For example, you could specify a header for every request that your sdk makes as follows:
|
|
562
|
+
|
|
563
|
+
```typescript
|
|
564
|
+
import { retell-sdk } from "RetellClient";
|
|
565
|
+
import axios from "axios";
|
|
566
|
+
|
|
567
|
+
const httpClient = axios.create({
|
|
568
|
+
headers: {'x-custom-header': 'someValue'}
|
|
569
|
+
})
|
|
570
|
+
|
|
571
|
+
const sdk = new RetellClient({defaultClient: httpClient});
|
|
572
|
+
```
|
|
573
|
+
<!-- End Custom HTTP Client [http-client] -->
|
|
574
|
+
|
|
575
|
+
<!-- Start Authentication [security] -->
|
|
576
|
+
## Authentication
|
|
577
|
+
|
|
578
|
+
### Per-Client Security Schemes
|
|
579
|
+
|
|
580
|
+
This SDK supports the following security scheme globally:
|
|
581
|
+
|
|
582
|
+
| Name | Type | Scheme |
|
|
583
|
+
| ----------- | ----------- | ----------- |
|
|
584
|
+
| `apiKey` | http | HTTP Bearer |
|
|
585
|
+
|
|
586
|
+
To authenticate with the API the `apiKey` parameter must be set when initializing the SDK client instance. For example:
|
|
587
|
+
```typescript
|
|
588
|
+
import { RetellClient } from "retell-sdk";
|
|
589
|
+
|
|
590
|
+
async function run() {
|
|
591
|
+
const sdk = new RetellClient({
|
|
592
|
+
apiKey: "",
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
const res = await sdk.createAgent({
|
|
596
|
+
agentName: "Jarvis",
|
|
597
|
+
beginMessage: "Hello there, how can I help you?",
|
|
598
|
+
enableBeginMessage: true,
|
|
599
|
+
enableEndCall: true,
|
|
600
|
+
enableEndMessage: false,
|
|
601
|
+
endMessage: "Hope you have a good day, goodbye.",
|
|
602
|
+
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.",
|
|
603
|
+
voiceId: "elevenlabs-xxcrwXReTKMHWjqi7Q27",
|
|
604
|
+
});
|
|
605
|
+
|
|
606
|
+
if (res.statusCode == 200) {
|
|
607
|
+
// handle response
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
run();
|
|
612
|
+
|
|
613
|
+
```
|
|
614
|
+
<!-- End Authentication [security] -->
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
|
|
7
618
|
<!-- Start SDK Installation -->
|
|
8
|
-
|
|
619
|
+
## SDK Installation
|
|
9
620
|
|
|
10
|
-
|
|
621
|
+
### NPM
|
|
11
622
|
|
|
12
623
|
```bash
|
|
13
|
-
npm add
|
|
624
|
+
npm add retell-sdk
|
|
14
625
|
```
|
|
15
626
|
|
|
16
|
-
|
|
627
|
+
### Yarn
|
|
17
628
|
|
|
18
629
|
```bash
|
|
19
|
-
yarn add
|
|
630
|
+
yarn add retell-sdk
|
|
20
631
|
```
|
|
21
632
|
<!-- End SDK Installation -->
|
|
22
633
|
|
|
634
|
+
|
|
635
|
+
|
|
23
636
|
## SDK Example Usage
|
|
24
637
|
<!-- Start SDK Example Usage -->
|
|
638
|
+
### Create a new voice AI agent
|
|
25
639
|
|
|
26
|
-
# Create a new voice AI agent
|
|
27
640
|
Create a new agent
|
|
641
|
+
|
|
28
642
|
```typescript
|
|
29
643
|
import { RetellClient } from "retell-sdk";
|
|
30
644
|
|
|
31
|
-
(async() => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// handle response
|
|
51
|
-
}
|
|
645
|
+
(async () => {
|
|
646
|
+
const sdk = new RetellClient({
|
|
647
|
+
apiKey: "",
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
const res = await sdk.createAgent({
|
|
651
|
+
agentName: "Jarvis",
|
|
652
|
+
beginMessage: "Hello there, how can I help you?",
|
|
653
|
+
enableBeginMessage: true,
|
|
654
|
+
enableEndCall: true,
|
|
655
|
+
enableEndMessage: false,
|
|
656
|
+
endMessage: "Hope you have a good day, goodbye.",
|
|
657
|
+
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.",
|
|
658
|
+
voiceId: "elevenlabs-xxcrwXReTKMHWjqi7Q27",
|
|
659
|
+
});
|
|
660
|
+
|
|
661
|
+
if (res.statusCode == 200) {
|
|
662
|
+
// handle response
|
|
663
|
+
}
|
|
52
664
|
})();
|
|
665
|
+
|
|
53
666
|
```
|
|
54
667
|
|
|
668
|
+
### Create an outbound phone call
|
|
55
669
|
|
|
56
|
-
# Create an outbound phone call
|
|
57
670
|
Initiate an outbound phone call.
|
|
671
|
+
|
|
58
672
|
```typescript
|
|
59
673
|
import { RetellClient } from "retell-sdk";
|
|
60
674
|
|
|
61
|
-
(async() => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
// handle response
|
|
83
|
-
}
|
|
675
|
+
(async () => {
|
|
676
|
+
const sdk = new RetellClient({
|
|
677
|
+
apiKey: "",
|
|
678
|
+
});
|
|
679
|
+
|
|
680
|
+
const res = await sdk.createPhoneCall({
|
|
681
|
+
agentPromptParams: [
|
|
682
|
+
{
|
|
683
|
+
name: "username",
|
|
684
|
+
value: "Adam",
|
|
685
|
+
},
|
|
686
|
+
],
|
|
687
|
+
phoneNumber: {
|
|
688
|
+
from: "+14159095857",
|
|
689
|
+
to: "+14159095858",
|
|
690
|
+
},
|
|
691
|
+
});
|
|
692
|
+
|
|
693
|
+
if (res.statusCode == 200) {
|
|
694
|
+
// handle response
|
|
695
|
+
}
|
|
84
696
|
})();
|
|
697
|
+
|
|
85
698
|
```
|
|
86
699
|
|
|
700
|
+
### Create a new phone number
|
|
87
701
|
|
|
88
|
-
# Create a new phone number
|
|
89
702
|
Create a new phone number
|
|
703
|
+
|
|
90
704
|
```typescript
|
|
91
705
|
import { RetellClient } from "retell-sdk";
|
|
92
706
|
|
|
93
|
-
(async() => {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
},
|
|
98
|
-
});
|
|
707
|
+
(async () => {
|
|
708
|
+
const sdk = new RetellClient({
|
|
709
|
+
apiKey: "",
|
|
710
|
+
});
|
|
99
711
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
712
|
+
const res = await sdk.createPhoneNumber({
|
|
713
|
+
agentId: "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
|
|
714
|
+
areaCode: 415,
|
|
715
|
+
});
|
|
104
716
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
717
|
+
if (res.statusCode == 200) {
|
|
718
|
+
// handle response
|
|
719
|
+
}
|
|
108
720
|
})();
|
|
721
|
+
|
|
109
722
|
```
|
|
110
723
|
|
|
724
|
+
### Delete an existing agent
|
|
111
725
|
|
|
112
|
-
# Delete an existing agent
|
|
113
726
|
Delete an existing agent
|
|
727
|
+
|
|
114
728
|
```typescript
|
|
115
729
|
import { RetellClient } from "retell-sdk";
|
|
116
|
-
import { DeleteAgentRequest } from "retell-sdk/dist/
|
|
730
|
+
import { DeleteAgentRequest } from "retell-sdk/dist/models/operations";
|
|
117
731
|
|
|
118
|
-
(async() => {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
});
|
|
124
|
-
const agentId: string = "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD";
|
|
732
|
+
(async () => {
|
|
733
|
+
const sdk = new RetellClient({
|
|
734
|
+
apiKey: "",
|
|
735
|
+
});
|
|
736
|
+
const agentId: string = "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD";
|
|
125
737
|
|
|
126
|
-
|
|
738
|
+
const res = await sdk.deleteAgent(agentId);
|
|
127
739
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
740
|
+
if (res.statusCode == 200) {
|
|
741
|
+
// handle response
|
|
742
|
+
}
|
|
131
743
|
})();
|
|
744
|
+
|
|
132
745
|
```
|
|
133
746
|
|
|
747
|
+
### Delete a specific phone number
|
|
134
748
|
|
|
135
|
-
# Delete a specific phone number
|
|
136
749
|
Delete a specific phone number
|
|
750
|
+
|
|
137
751
|
```typescript
|
|
138
752
|
import { RetellClient } from "retell-sdk";
|
|
139
|
-
import { DeletePhoneNumberRequest } from "retell-sdk/dist/
|
|
753
|
+
import { DeletePhoneNumberRequest } from "retell-sdk/dist/models/operations";
|
|
140
754
|
|
|
141
|
-
(async() => {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
});
|
|
147
|
-
const phoneNumber: string = "and";
|
|
755
|
+
(async () => {
|
|
756
|
+
const sdk = new RetellClient({
|
|
757
|
+
apiKey: "",
|
|
758
|
+
});
|
|
759
|
+
const phoneNumber: string = "string";
|
|
148
760
|
|
|
149
|
-
|
|
761
|
+
const res = await sdk.deletePhoneNumber(phoneNumber);
|
|
150
762
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
763
|
+
if (res.statusCode == 200) {
|
|
764
|
+
// handle response
|
|
765
|
+
}
|
|
154
766
|
})();
|
|
767
|
+
|
|
155
768
|
```
|
|
156
769
|
|
|
770
|
+
### Retrieve details of an agent
|
|
157
771
|
|
|
158
|
-
# Retrieve details of an agent
|
|
159
772
|
Retrieve details of a specific agent
|
|
773
|
+
|
|
160
774
|
```typescript
|
|
161
775
|
import { RetellClient } from "retell-sdk";
|
|
162
|
-
import { GetAgentRequest } from "retell-sdk/dist/
|
|
776
|
+
import { GetAgentRequest } from "retell-sdk/dist/models/operations";
|
|
163
777
|
|
|
164
|
-
(async() => {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
});
|
|
170
|
-
const agentId: string = "16b980523634a6dc504898cda492e939";
|
|
778
|
+
(async () => {
|
|
779
|
+
const sdk = new RetellClient({
|
|
780
|
+
apiKey: "",
|
|
781
|
+
});
|
|
782
|
+
const agentId: string = "16b980523634a6dc504898cda492e939";
|
|
171
783
|
|
|
172
|
-
|
|
784
|
+
const res = await sdk.getAgent(agentId);
|
|
173
785
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
786
|
+
if (res.statusCode == 200) {
|
|
787
|
+
// handle response
|
|
788
|
+
}
|
|
177
789
|
})();
|
|
790
|
+
|
|
178
791
|
```
|
|
179
792
|
|
|
793
|
+
### Retrieve a on-going or finished call
|
|
180
794
|
|
|
181
|
-
# Retrieve a on-going or finished call
|
|
182
795
|
Retrieve details of a specific call
|
|
796
|
+
|
|
183
797
|
```typescript
|
|
184
798
|
import { RetellClient } from "retell-sdk";
|
|
185
|
-
import { GetCallRequest } from "retell-sdk/dist/
|
|
799
|
+
import { GetCallRequest } from "retell-sdk/dist/models/operations";
|
|
186
800
|
|
|
187
|
-
(async() => {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
});
|
|
193
|
-
const callId: string = "119c3f8e47135a29e65947eeb34cf12d";
|
|
801
|
+
(async () => {
|
|
802
|
+
const sdk = new RetellClient({
|
|
803
|
+
apiKey: "",
|
|
804
|
+
});
|
|
805
|
+
const callId: string = "119c3f8e47135a29e65947eeb34cf12d";
|
|
194
806
|
|
|
195
|
-
|
|
807
|
+
const res = await sdk.getCall(callId);
|
|
196
808
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
809
|
+
if (res.statusCode == 200) {
|
|
810
|
+
// handle response
|
|
811
|
+
}
|
|
200
812
|
})();
|
|
813
|
+
|
|
201
814
|
```
|
|
202
815
|
|
|
816
|
+
### Retrieve info about a specific number
|
|
203
817
|
|
|
204
|
-
# Retrieve info about a specific number
|
|
205
818
|
Retrieve info about a specific number
|
|
819
|
+
|
|
206
820
|
```typescript
|
|
207
821
|
import { RetellClient } from "retell-sdk";
|
|
208
|
-
import { GetPhoneNumberRequest } from "retell-sdk/dist/
|
|
822
|
+
import { GetPhoneNumberRequest } from "retell-sdk/dist/models/operations";
|
|
209
823
|
|
|
210
|
-
(async() => {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
});
|
|
216
|
-
const phoneNumber: string = "+14159095857";
|
|
824
|
+
(async () => {
|
|
825
|
+
const sdk = new RetellClient({
|
|
826
|
+
apiKey: "",
|
|
827
|
+
});
|
|
828
|
+
const phoneNumber: string = "+14159095857";
|
|
217
829
|
|
|
218
|
-
|
|
830
|
+
const res = await sdk.getPhoneNumber(phoneNumber);
|
|
219
831
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
832
|
+
if (res.statusCode == 200) {
|
|
833
|
+
// handle response
|
|
834
|
+
}
|
|
223
835
|
})();
|
|
836
|
+
|
|
224
837
|
```
|
|
225
838
|
|
|
839
|
+
### List all agents
|
|
226
840
|
|
|
227
|
-
# List all agents
|
|
228
841
|
List all agents
|
|
842
|
+
|
|
229
843
|
```typescript
|
|
230
844
|
import { RetellClient } from "retell-sdk";
|
|
231
845
|
|
|
232
|
-
(async() => {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
},
|
|
237
|
-
});
|
|
846
|
+
(async () => {
|
|
847
|
+
const sdk = new RetellClient({
|
|
848
|
+
apiKey: "",
|
|
849
|
+
});
|
|
238
850
|
|
|
239
|
-
|
|
851
|
+
const res = await sdk.listAgents();
|
|
240
852
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
853
|
+
if (res.statusCode == 200) {
|
|
854
|
+
// handle response
|
|
855
|
+
}
|
|
244
856
|
})();
|
|
857
|
+
|
|
245
858
|
```
|
|
246
859
|
|
|
860
|
+
### List all web or phone calls
|
|
247
861
|
|
|
248
|
-
# List all web or phone calls
|
|
249
862
|
Retrieve call details
|
|
863
|
+
|
|
250
864
|
```typescript
|
|
251
865
|
import { RetellClient } from "retell-sdk";
|
|
252
866
|
import {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
} from "retell-sdk/dist/
|
|
258
|
-
|
|
259
|
-
(async() => {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
const sortOrder: ListCallsSortOrder = ListCallsSortOrder.Descending;
|
|
280
|
-
|
|
281
|
-
const res = await sdk.listCalls(filterCriteria, limit, sortOrder);
|
|
282
|
-
|
|
283
|
-
if (res.statusCode == 200) {
|
|
284
|
-
// handle response
|
|
285
|
-
}
|
|
867
|
+
CallType,
|
|
868
|
+
FilterCriteria,
|
|
869
|
+
ListCallsRequest,
|
|
870
|
+
SortOrder,
|
|
871
|
+
} from "retell-sdk/dist/models/operations";
|
|
872
|
+
|
|
873
|
+
(async () => {
|
|
874
|
+
const sdk = new RetellClient({
|
|
875
|
+
apiKey: "",
|
|
876
|
+
});
|
|
877
|
+
const filterCriteria: FilterCriteria = {
|
|
878
|
+
afterEndTimestamp: 1703302428800,
|
|
879
|
+
afterStartTimestamp: 1703302407300,
|
|
880
|
+
agentId: ["oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD"],
|
|
881
|
+
beforeEndTimestamp: 1703302428899,
|
|
882
|
+
beforeStartTimestamp: 1703302407399,
|
|
883
|
+
callType: [CallType.InboundPhoneCall, CallType.OutboundPhoneCall],
|
|
884
|
+
};
|
|
885
|
+
const limit: number = 666195;
|
|
886
|
+
const sortOrder: SortOrder = SortOrder.Descending;
|
|
887
|
+
|
|
888
|
+
const res = await sdk.listCalls(filterCriteria, limit, sortOrder);
|
|
889
|
+
|
|
890
|
+
if (res.statusCode == 200) {
|
|
891
|
+
// handle response
|
|
892
|
+
}
|
|
286
893
|
})();
|
|
894
|
+
|
|
287
895
|
```
|
|
288
896
|
|
|
897
|
+
### List all purchased and active phone numbers
|
|
289
898
|
|
|
290
|
-
# List all purchased and active phone numbers
|
|
291
899
|
List all purchased and active phone numbers
|
|
900
|
+
|
|
292
901
|
```typescript
|
|
293
902
|
import { RetellClient } from "retell-sdk";
|
|
294
903
|
|
|
295
|
-
(async() => {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
},
|
|
300
|
-
});
|
|
904
|
+
(async () => {
|
|
905
|
+
const sdk = new RetellClient({
|
|
906
|
+
apiKey: "",
|
|
907
|
+
});
|
|
301
908
|
|
|
302
|
-
|
|
909
|
+
const res = await sdk.listPhoneNumbers();
|
|
303
910
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
911
|
+
if (res.statusCode == 200) {
|
|
912
|
+
// handle response
|
|
913
|
+
}
|
|
307
914
|
})();
|
|
915
|
+
|
|
308
916
|
```
|
|
309
917
|
|
|
918
|
+
### Update an existing agent
|
|
310
919
|
|
|
311
|
-
# Update an existing agent
|
|
312
920
|
Update an existing agent
|
|
921
|
+
|
|
313
922
|
```typescript
|
|
314
923
|
import { RetellClient } from "retell-sdk";
|
|
315
|
-
import {
|
|
316
|
-
import {
|
|
317
|
-
|
|
318
|
-
(async() => {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
const
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
// handle response
|
|
340
|
-
}
|
|
924
|
+
import { AgentNoDefaultNoRequired } from "retell-sdk/dist/models/components";
|
|
925
|
+
import { UpdateAgentRequest } from "retell-sdk/dist/models/operations";
|
|
926
|
+
|
|
927
|
+
(async () => {
|
|
928
|
+
const sdk = new RetellClient({
|
|
929
|
+
apiKey: "",
|
|
930
|
+
});
|
|
931
|
+
const agentNoDefaultNoRequired: AgentNoDefaultNoRequired = {
|
|
932
|
+
agentName: "Jarvis",
|
|
933
|
+
beginMessage: "Hello there, how can I help you.",
|
|
934
|
+
enableBeginMessage: true,
|
|
935
|
+
enableEndCall: true,
|
|
936
|
+
enableEndMessage: false,
|
|
937
|
+
endMessage: "Hope you have a good day, goodbye.",
|
|
938
|
+
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.",
|
|
939
|
+
voiceId: "elevenlabs-xxcrwXReTKMHWjqi7Q27",
|
|
940
|
+
};
|
|
941
|
+
const agentId: string = "16b980523634a6dc504898cda492e939";
|
|
942
|
+
|
|
943
|
+
const res = await sdk.updateAgent(agentNoDefaultNoRequired, agentId);
|
|
944
|
+
|
|
945
|
+
if (res.statusCode == 200) {
|
|
946
|
+
// handle response
|
|
947
|
+
}
|
|
341
948
|
})();
|
|
949
|
+
|
|
342
950
|
```
|
|
343
951
|
|
|
952
|
+
### Update an existing phone number
|
|
344
953
|
|
|
345
|
-
# Update an existing phone number
|
|
346
954
|
Update an existing phone number
|
|
955
|
+
|
|
347
956
|
```typescript
|
|
348
957
|
import { RetellClient } from "retell-sdk";
|
|
349
|
-
import {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
958
|
+
import {
|
|
959
|
+
UpdatePhoneAgentRequest,
|
|
960
|
+
UpdatePhoneAgentRequestBody,
|
|
961
|
+
} from "retell-sdk/dist/models/operations";
|
|
962
|
+
|
|
963
|
+
(async () => {
|
|
964
|
+
const sdk = new RetellClient({
|
|
965
|
+
apiKey: "",
|
|
966
|
+
});
|
|
967
|
+
const requestBody: UpdatePhoneAgentRequestBody = {
|
|
968
|
+
agentId: "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
|
|
969
|
+
};
|
|
970
|
+
const phoneNumber: string = "+14159095857";
|
|
971
|
+
|
|
972
|
+
const res = await sdk.updatePhoneAgent(requestBody, phoneNumber);
|
|
973
|
+
|
|
974
|
+
if (res.statusCode == 200) {
|
|
975
|
+
// handle response
|
|
976
|
+
}
|
|
367
977
|
})();
|
|
978
|
+
|
|
368
979
|
```
|
|
369
980
|
<!-- End SDK Example Usage -->
|
|
370
981
|
|
|
982
|
+
|
|
983
|
+
|
|
371
984
|
<!-- Start SDK Available Operations -->
|
|
372
|
-
|
|
985
|
+
## Available Resources and Operations
|
|
373
986
|
|
|
374
|
-
|
|
987
|
+
### [RetellClient SDK](docs/sdks/retellclient/README.md)
|
|
375
988
|
|
|
376
989
|
* [createAgent](docs/sdks/retellclient/README.md#createagent) - Create a new agent
|
|
377
990
|
* [createPhoneCall](docs/sdks/retellclient/README.md#createphonecall) - Initiate an outbound phone call.
|
|
@@ -388,23 +1001,200 @@ const phoneNumber: string = "+14159095857";
|
|
|
388
1001
|
* [updatePhoneAgent](docs/sdks/retellclient/README.md#updatephoneagent) - Update an existing phone number
|
|
389
1002
|
<!-- End SDK Available Operations -->
|
|
390
1003
|
|
|
391
|
-
<!-- Start Dev Containers -->
|
|
392
1004
|
|
|
393
1005
|
|
|
1006
|
+
<!-- Start Error Handling -->
|
|
1007
|
+
## Error Handling
|
|
1008
|
+
|
|
1009
|
+
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.
|
|
1010
|
+
|
|
1011
|
+
| Error Object | Status Code | Content Type |
|
|
1012
|
+
| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- |
|
|
1013
|
+
| errors.CreateAgentResponseBody | 400 | application/json |
|
|
1014
|
+
| errors.CreateAgentResponseResponseBody | 401 | application/json |
|
|
1015
|
+
| errors.CreateAgentResponse422ResponseBody | 422 | application/json |
|
|
1016
|
+
| errors.CreateAgentResponse500ResponseBody | 500 | application/json |
|
|
1017
|
+
| errors.SDKError | 400-600 | */* |
|
|
1018
|
+
|
|
1019
|
+
Example
|
|
1020
|
+
|
|
1021
|
+
```typescript
|
|
1022
|
+
import { RetellClient } from "retell-sdk";
|
|
1023
|
+
|
|
1024
|
+
(async () => {
|
|
1025
|
+
const sdk = new RetellClient({
|
|
1026
|
+
apiKey: "",
|
|
1027
|
+
});
|
|
1028
|
+
|
|
1029
|
+
let res;
|
|
1030
|
+
try {
|
|
1031
|
+
res = await sdk.createAgent({
|
|
1032
|
+
agentName: "Jarvis",
|
|
1033
|
+
beginMessage: "Hello there, how can I help you?",
|
|
1034
|
+
enableBeginMessage: true,
|
|
1035
|
+
enableEndCall: true,
|
|
1036
|
+
enableEndMessage: false,
|
|
1037
|
+
endMessage: "Hope you have a good day, goodbye.",
|
|
1038
|
+
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.",
|
|
1039
|
+
voiceId: "elevenlabs-xxcrwXReTKMHWjqi7Q27",
|
|
1040
|
+
});
|
|
1041
|
+
} catch (e) {
|
|
1042
|
+
if (e instanceof errors.CreateAgentResponseBody) {
|
|
1043
|
+
console.error(e); // handle exception
|
|
1044
|
+
} else if (e instanceof errors.CreateAgentResponseResponseBody) {
|
|
1045
|
+
console.error(e); // handle exception
|
|
1046
|
+
} else if (e instanceof errors.CreateAgentResponse422ResponseBody) {
|
|
1047
|
+
console.error(e); // handle exception
|
|
1048
|
+
} else if (e instanceof errors.CreateAgentResponse500ResponseBody) {
|
|
1049
|
+
console.error(e); // handle exception
|
|
1050
|
+
} else if (e instanceof errors.SDKError) {
|
|
1051
|
+
console.error(e); // handle exception
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
if (res.statusCode == 200) {
|
|
1056
|
+
// handle response
|
|
1057
|
+
}
|
|
1058
|
+
})();
|
|
1059
|
+
|
|
1060
|
+
```
|
|
1061
|
+
<!-- End Error Handling -->
|
|
1062
|
+
|
|
1063
|
+
|
|
1064
|
+
|
|
1065
|
+
<!-- Start Server Selection -->
|
|
1066
|
+
## Server Selection
|
|
1067
|
+
|
|
1068
|
+
### Select Server by Index
|
|
1069
|
+
|
|
1070
|
+
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:
|
|
1071
|
+
|
|
1072
|
+
| # | Server | Variables |
|
|
1073
|
+
| - | ------ | --------- |
|
|
1074
|
+
| 0 | `https://api.re-tell.ai` | None |
|
|
1075
|
+
|
|
1076
|
+
#### Example
|
|
1077
|
+
|
|
1078
|
+
```typescript
|
|
1079
|
+
import { RetellClient } from "retell-sdk";
|
|
1080
|
+
|
|
1081
|
+
(async () => {
|
|
1082
|
+
const sdk = new RetellClient({
|
|
1083
|
+
serverIdx: 0,
|
|
1084
|
+
apiKey: "",
|
|
1085
|
+
});
|
|
1086
|
+
|
|
1087
|
+
const res = await sdk.createAgent({
|
|
1088
|
+
agentName: "Jarvis",
|
|
1089
|
+
beginMessage: "Hello there, how can I help you?",
|
|
1090
|
+
enableBeginMessage: true,
|
|
1091
|
+
enableEndCall: true,
|
|
1092
|
+
enableEndMessage: false,
|
|
1093
|
+
endMessage: "Hope you have a good day, goodbye.",
|
|
1094
|
+
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.",
|
|
1095
|
+
voiceId: "elevenlabs-xxcrwXReTKMHWjqi7Q27",
|
|
1096
|
+
});
|
|
1097
|
+
|
|
1098
|
+
if (res.statusCode == 200) {
|
|
1099
|
+
// handle response
|
|
1100
|
+
}
|
|
1101
|
+
})();
|
|
1102
|
+
|
|
1103
|
+
```
|
|
1104
|
+
|
|
1105
|
+
|
|
1106
|
+
### Override Server URL Per-Client
|
|
1107
|
+
|
|
1108
|
+
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:
|
|
1109
|
+
```typescript
|
|
1110
|
+
import { RetellClient } from "retell-sdk";
|
|
1111
|
+
|
|
1112
|
+
(async () => {
|
|
1113
|
+
const sdk = new RetellClient({
|
|
1114
|
+
serverURL: "https://api.re-tell.ai",
|
|
1115
|
+
apiKey: "",
|
|
1116
|
+
});
|
|
1117
|
+
|
|
1118
|
+
const res = await sdk.createAgent({
|
|
1119
|
+
agentName: "Jarvis",
|
|
1120
|
+
beginMessage: "Hello there, how can I help you?",
|
|
1121
|
+
enableBeginMessage: true,
|
|
1122
|
+
enableEndCall: true,
|
|
1123
|
+
enableEndMessage: false,
|
|
1124
|
+
endMessage: "Hope you have a good day, goodbye.",
|
|
1125
|
+
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.",
|
|
1126
|
+
voiceId: "elevenlabs-xxcrwXReTKMHWjqi7Q27",
|
|
1127
|
+
});
|
|
1128
|
+
|
|
1129
|
+
if (res.statusCode == 200) {
|
|
1130
|
+
// handle response
|
|
1131
|
+
}
|
|
1132
|
+
})();
|
|
1133
|
+
|
|
1134
|
+
```
|
|
1135
|
+
<!-- End Server Selection -->
|
|
1136
|
+
|
|
1137
|
+
|
|
1138
|
+
|
|
1139
|
+
<!-- Start Custom HTTP Client -->
|
|
1140
|
+
## Custom HTTP Client
|
|
394
1141
|
|
|
395
|
-
|
|
1142
|
+
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.
|
|
396
1143
|
|
|
397
|
-
|
|
398
|
-
|
|
1144
|
+
For example, you could specify a header for every request that your sdk makes as follows:
|
|
1145
|
+
|
|
1146
|
+
```typescript
|
|
1147
|
+
from retell-sdk import RetellClient;
|
|
1148
|
+
import axios;
|
|
1149
|
+
|
|
1150
|
+
const httpClient = axios.create({
|
|
1151
|
+
headers: {'x-custom-header': 'someValue'}
|
|
1152
|
+
})
|
|
1153
|
+
|
|
1154
|
+
const sdk = new RetellClient({defaultClient: httpClient});
|
|
1155
|
+
```
|
|
1156
|
+
<!-- End Custom HTTP Client -->
|
|
399
1157
|
|
|
400
|
-
Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the
|
|
401
|
-
returned response object will have a `next` method that can be called to pull down the next group of results. If the
|
|
402
|
-
return value of `next` is `null`, then there are no more pages to be fetched.
|
|
403
1158
|
|
|
404
|
-
Here's an example of one such pagination call:
|
|
405
1159
|
|
|
1160
|
+
<!-- Start Authentication -->
|
|
1161
|
+
## Authentication
|
|
406
1162
|
|
|
407
|
-
|
|
1163
|
+
### Per-Client Security Schemes
|
|
1164
|
+
|
|
1165
|
+
This SDK supports the following security scheme globally:
|
|
1166
|
+
|
|
1167
|
+
| Name | Type | Scheme |
|
|
1168
|
+
| ----------- | ----------- | ----------- |
|
|
1169
|
+
| `apiKey` | http | HTTP Bearer |
|
|
1170
|
+
|
|
1171
|
+
To authenticate with the API the `apiKey` parameter must be set when initializing the SDK client instance. For example:
|
|
1172
|
+
```typescript
|
|
1173
|
+
import { RetellClient } from "retell-sdk";
|
|
1174
|
+
|
|
1175
|
+
(async () => {
|
|
1176
|
+
const sdk = new RetellClient({
|
|
1177
|
+
apiKey: "",
|
|
1178
|
+
});
|
|
1179
|
+
|
|
1180
|
+
const res = await sdk.createAgent({
|
|
1181
|
+
agentName: "Jarvis",
|
|
1182
|
+
beginMessage: "Hello there, how can I help you?",
|
|
1183
|
+
enableBeginMessage: true,
|
|
1184
|
+
enableEndCall: true,
|
|
1185
|
+
enableEndMessage: false,
|
|
1186
|
+
endMessage: "Hope you have a good day, goodbye.",
|
|
1187
|
+
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.",
|
|
1188
|
+
voiceId: "elevenlabs-xxcrwXReTKMHWjqi7Q27",
|
|
1189
|
+
});
|
|
1190
|
+
|
|
1191
|
+
if (res.statusCode == 200) {
|
|
1192
|
+
// handle response
|
|
1193
|
+
}
|
|
1194
|
+
})();
|
|
1195
|
+
|
|
1196
|
+
```
|
|
1197
|
+
<!-- End Authentication -->
|
|
408
1198
|
|
|
409
1199
|
<!-- Placeholder for Future Speakeasy SDK Sections -->
|
|
410
1200
|
|