retell-sdk 1.15.15 → 1.15.17
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 +12 -583
- package/dist/sdk/sdk.d.ts +17 -1
- package/dist/sdk/sdk.js +127 -15
- package/package.json +7 -6
- package/dist/sdk/models/errors/createagent.d.ts +0 -45
- package/dist/sdk/models/errors/createagent.js +0 -144
- package/dist/sdk/models/errors/createphonecall.d.ts +0 -67
- package/dist/sdk/models/errors/createphonecall.js +0 -200
- package/dist/sdk/models/errors/createphonenumber.d.ts +0 -56
- package/dist/sdk/models/errors/createphonenumber.js +0 -172
- package/dist/sdk/models/errors/deleteagent.d.ts +0 -45
- package/dist/sdk/models/errors/deleteagent.js +0 -144
- package/dist/sdk/models/errors/deletephonenumber.d.ts +0 -45
- package/dist/sdk/models/errors/deletephonenumber.js +0 -144
- package/dist/sdk/models/errors/getagent.d.ts +0 -45
- package/dist/sdk/models/errors/getagent.js +0 -144
- package/dist/sdk/models/errors/getcall.d.ts +0 -45
- package/dist/sdk/models/errors/getcall.js +0 -144
- package/dist/sdk/models/errors/getphonenumber.d.ts +0 -45
- package/dist/sdk/models/errors/getphonenumber.js +0 -144
- package/dist/sdk/models/errors/index.d.ts +0 -14
- package/dist/sdk/models/errors/index.js +0 -33
- package/dist/sdk/models/errors/listagents.d.ts +0 -23
- package/dist/sdk/models/errors/listagents.js +0 -88
- package/dist/sdk/models/errors/listcalls.d.ts +0 -34
- package/dist/sdk/models/errors/listcalls.js +0 -116
- package/dist/sdk/models/errors/listphonenumbers.d.ts +0 -34
- package/dist/sdk/models/errors/listphonenumbers.js +0 -116
- package/dist/sdk/models/errors/sdkerror.d.ts +0 -7
- package/dist/sdk/models/errors/sdkerror.js +0 -40
- package/dist/sdk/models/errors/updateagent.d.ts +0 -45
- package/dist/sdk/models/errors/updateagent.js +0 -144
- package/dist/sdk/models/errors/updatephoneagent.d.ts +0 -45
- package/dist/sdk/models/errors/updatephoneagent.js +0 -144
- package/dist/sdk/models/operations/createagent.d.ts +0 -55
- package/dist/sdk/models/operations/createagent.js +0 -128
- package/dist/sdk/models/operations/createphonecall.d.ts +0 -87
- package/dist/sdk/models/operations/createphonecall.js +0 -187
- package/dist/sdk/models/operations/createphonenumber.d.ts +0 -31
- package/dist/sdk/models/operations/createphonenumber.js +0 -98
- package/dist/sdk/models/operations/deleteagent.d.ts +0 -22
- package/dist/sdk/models/operations/deleteagent.js +0 -63
- package/dist/sdk/models/operations/deletephonenumber.d.ts +0 -22
- package/dist/sdk/models/operations/deletephonenumber.js +0 -63
- package/dist/sdk/models/operations/getagent.d.ts +0 -27
- package/dist/sdk/models/operations/getagent.js +0 -91
- package/dist/sdk/models/operations/getcall.d.ts +0 -27
- package/dist/sdk/models/operations/getcall.js +0 -91
- package/dist/sdk/models/operations/getphonenumber.d.ts +0 -27
- package/dist/sdk/models/operations/getphonenumber.js +0 -91
- package/dist/sdk/models/operations/index.d.ts +0 -13
- package/dist/sdk/models/operations/index.js +0 -32
- package/dist/sdk/models/operations/listagents.d.ts +0 -21
- package/dist/sdk/models/operations/listagents.js +0 -79
- package/dist/sdk/models/operations/listcalls.d.ts +0 -70
- package/dist/sdk/models/operations/listcalls.js +0 -145
- package/dist/sdk/models/operations/listphonenumbers.d.ts +0 -21
- package/dist/sdk/models/operations/listphonenumbers.js +0 -79
- package/dist/sdk/models/operations/updateagent.d.ts +0 -28
- package/dist/sdk/models/operations/updateagent.js +0 -95
- package/dist/sdk/models/operations/updatephoneagent.d.ts +0 -34
- package/dist/sdk/models/operations/updatephoneagent.js +0 -109
- package/dist/sdk/models/shared/agent.d.ts +0 -43
- package/dist/sdk/models/shared/agent.js +0 -90
- package/dist/sdk/models/shared/agentnodefaultnorequired.d.ts +0 -35
- package/dist/sdk/models/shared/agentnodefaultnorequired.js +0 -80
- package/dist/sdk/models/shared/agentpromptparams.d.ts +0 -11
- package/dist/sdk/models/shared/agentpromptparams.js +0 -50
- package/dist/sdk/models/shared/calldetail.d.ts +0 -58
- package/dist/sdk/models/shared/calldetail.js +0 -112
- package/dist/sdk/models/shared/callphonenumber.d.ts +0 -14
- package/dist/sdk/models/shared/callphonenumber.js +0 -53
- package/dist/sdk/models/shared/index.d.ts +0 -7
- package/dist/sdk/models/shared/index.js +0 -26
- package/dist/sdk/models/shared/phonenumber.d.ts +0 -23
- package/dist/sdk/models/shared/phonenumber.js +0 -65
- package/dist/sdk/models/shared/security.d.ts +0 -4
- package/dist/sdk/models/shared/security.js +0 -45
- package/dist/sdk/types/index.d.ts +0 -1
- package/dist/sdk/types/index.js +0 -20
- package/dist/sdk/types/rfcdate.d.ts +0 -9
- package/dist/sdk/types/rfcdate.js +0 -59
package/README.md
CHANGED
|
@@ -2,8 +2,20 @@
|
|
|
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
|
|
|
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
|
+
|
|
7
19
|
<!-- Start SDK Installation [installation] -->
|
|
8
20
|
## SDK Installation
|
|
9
21
|
|
|
@@ -613,589 +625,6 @@ run();
|
|
|
613
625
|
```
|
|
614
626
|
<!-- End Authentication [security] -->
|
|
615
627
|
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
<!-- Start SDK Installation -->
|
|
619
|
-
## SDK Installation
|
|
620
|
-
|
|
621
|
-
### NPM
|
|
622
|
-
|
|
623
|
-
```bash
|
|
624
|
-
npm add retell-sdk
|
|
625
|
-
```
|
|
626
|
-
|
|
627
|
-
### Yarn
|
|
628
|
-
|
|
629
|
-
```bash
|
|
630
|
-
yarn add retell-sdk
|
|
631
|
-
```
|
|
632
|
-
<!-- End SDK Installation -->
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
## SDK Example Usage
|
|
637
|
-
<!-- Start SDK Example Usage -->
|
|
638
|
-
### Create a new voice AI agent
|
|
639
|
-
|
|
640
|
-
Create a new agent
|
|
641
|
-
|
|
642
|
-
```typescript
|
|
643
|
-
import { RetellClient } from "retell-sdk";
|
|
644
|
-
|
|
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
|
-
}
|
|
664
|
-
})();
|
|
665
|
-
|
|
666
|
-
```
|
|
667
|
-
|
|
668
|
-
### Create an outbound phone call
|
|
669
|
-
|
|
670
|
-
Initiate an outbound phone call.
|
|
671
|
-
|
|
672
|
-
```typescript
|
|
673
|
-
import { RetellClient } from "retell-sdk";
|
|
674
|
-
|
|
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
|
-
}
|
|
696
|
-
})();
|
|
697
|
-
|
|
698
|
-
```
|
|
699
|
-
|
|
700
|
-
### Create a new phone number
|
|
701
|
-
|
|
702
|
-
Create a new phone number
|
|
703
|
-
|
|
704
|
-
```typescript
|
|
705
|
-
import { RetellClient } from "retell-sdk";
|
|
706
|
-
|
|
707
|
-
(async () => {
|
|
708
|
-
const sdk = new RetellClient({
|
|
709
|
-
apiKey: "",
|
|
710
|
-
});
|
|
711
|
-
|
|
712
|
-
const res = await sdk.createPhoneNumber({
|
|
713
|
-
agentId: "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
|
|
714
|
-
areaCode: 415,
|
|
715
|
-
});
|
|
716
|
-
|
|
717
|
-
if (res.statusCode == 200) {
|
|
718
|
-
// handle response
|
|
719
|
-
}
|
|
720
|
-
})();
|
|
721
|
-
|
|
722
|
-
```
|
|
723
|
-
|
|
724
|
-
### Delete an existing agent
|
|
725
|
-
|
|
726
|
-
Delete an existing agent
|
|
727
|
-
|
|
728
|
-
```typescript
|
|
729
|
-
import { RetellClient } from "retell-sdk";
|
|
730
|
-
import { DeleteAgentRequest } from "retell-sdk/dist/models/operations";
|
|
731
|
-
|
|
732
|
-
(async () => {
|
|
733
|
-
const sdk = new RetellClient({
|
|
734
|
-
apiKey: "",
|
|
735
|
-
});
|
|
736
|
-
const agentId: string = "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD";
|
|
737
|
-
|
|
738
|
-
const res = await sdk.deleteAgent(agentId);
|
|
739
|
-
|
|
740
|
-
if (res.statusCode == 200) {
|
|
741
|
-
// handle response
|
|
742
|
-
}
|
|
743
|
-
})();
|
|
744
|
-
|
|
745
|
-
```
|
|
746
|
-
|
|
747
|
-
### Delete a specific phone number
|
|
748
|
-
|
|
749
|
-
Delete a specific phone number
|
|
750
|
-
|
|
751
|
-
```typescript
|
|
752
|
-
import { RetellClient } from "retell-sdk";
|
|
753
|
-
import { DeletePhoneNumberRequest } from "retell-sdk/dist/models/operations";
|
|
754
|
-
|
|
755
|
-
(async () => {
|
|
756
|
-
const sdk = new RetellClient({
|
|
757
|
-
apiKey: "",
|
|
758
|
-
});
|
|
759
|
-
const phoneNumber: string = "string";
|
|
760
|
-
|
|
761
|
-
const res = await sdk.deletePhoneNumber(phoneNumber);
|
|
762
|
-
|
|
763
|
-
if (res.statusCode == 200) {
|
|
764
|
-
// handle response
|
|
765
|
-
}
|
|
766
|
-
})();
|
|
767
|
-
|
|
768
|
-
```
|
|
769
|
-
|
|
770
|
-
### Retrieve details of an agent
|
|
771
|
-
|
|
772
|
-
Retrieve details of a specific agent
|
|
773
|
-
|
|
774
|
-
```typescript
|
|
775
|
-
import { RetellClient } from "retell-sdk";
|
|
776
|
-
import { GetAgentRequest } from "retell-sdk/dist/models/operations";
|
|
777
|
-
|
|
778
|
-
(async () => {
|
|
779
|
-
const sdk = new RetellClient({
|
|
780
|
-
apiKey: "",
|
|
781
|
-
});
|
|
782
|
-
const agentId: string = "16b980523634a6dc504898cda492e939";
|
|
783
|
-
|
|
784
|
-
const res = await sdk.getAgent(agentId);
|
|
785
|
-
|
|
786
|
-
if (res.statusCode == 200) {
|
|
787
|
-
// handle response
|
|
788
|
-
}
|
|
789
|
-
})();
|
|
790
|
-
|
|
791
|
-
```
|
|
792
|
-
|
|
793
|
-
### Retrieve a on-going or finished call
|
|
794
|
-
|
|
795
|
-
Retrieve details of a specific call
|
|
796
|
-
|
|
797
|
-
```typescript
|
|
798
|
-
import { RetellClient } from "retell-sdk";
|
|
799
|
-
import { GetCallRequest } from "retell-sdk/dist/models/operations";
|
|
800
|
-
|
|
801
|
-
(async () => {
|
|
802
|
-
const sdk = new RetellClient({
|
|
803
|
-
apiKey: "",
|
|
804
|
-
});
|
|
805
|
-
const callId: string = "119c3f8e47135a29e65947eeb34cf12d";
|
|
806
|
-
|
|
807
|
-
const res = await sdk.getCall(callId);
|
|
808
|
-
|
|
809
|
-
if (res.statusCode == 200) {
|
|
810
|
-
// handle response
|
|
811
|
-
}
|
|
812
|
-
})();
|
|
813
|
-
|
|
814
|
-
```
|
|
815
|
-
|
|
816
|
-
### Retrieve info about a specific number
|
|
817
|
-
|
|
818
|
-
Retrieve info about a specific number
|
|
819
|
-
|
|
820
|
-
```typescript
|
|
821
|
-
import { RetellClient } from "retell-sdk";
|
|
822
|
-
import { GetPhoneNumberRequest } from "retell-sdk/dist/models/operations";
|
|
823
|
-
|
|
824
|
-
(async () => {
|
|
825
|
-
const sdk = new RetellClient({
|
|
826
|
-
apiKey: "",
|
|
827
|
-
});
|
|
828
|
-
const phoneNumber: string = "+14159095857";
|
|
829
|
-
|
|
830
|
-
const res = await sdk.getPhoneNumber(phoneNumber);
|
|
831
|
-
|
|
832
|
-
if (res.statusCode == 200) {
|
|
833
|
-
// handle response
|
|
834
|
-
}
|
|
835
|
-
})();
|
|
836
|
-
|
|
837
|
-
```
|
|
838
|
-
|
|
839
|
-
### List all agents
|
|
840
|
-
|
|
841
|
-
List all agents
|
|
842
|
-
|
|
843
|
-
```typescript
|
|
844
|
-
import { RetellClient } from "retell-sdk";
|
|
845
|
-
|
|
846
|
-
(async () => {
|
|
847
|
-
const sdk = new RetellClient({
|
|
848
|
-
apiKey: "",
|
|
849
|
-
});
|
|
850
|
-
|
|
851
|
-
const res = await sdk.listAgents();
|
|
852
|
-
|
|
853
|
-
if (res.statusCode == 200) {
|
|
854
|
-
// handle response
|
|
855
|
-
}
|
|
856
|
-
})();
|
|
857
|
-
|
|
858
|
-
```
|
|
859
|
-
|
|
860
|
-
### List all web or phone calls
|
|
861
|
-
|
|
862
|
-
Retrieve call details
|
|
863
|
-
|
|
864
|
-
```typescript
|
|
865
|
-
import { RetellClient } from "retell-sdk";
|
|
866
|
-
import {
|
|
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
|
-
}
|
|
893
|
-
})();
|
|
894
|
-
|
|
895
|
-
```
|
|
896
|
-
|
|
897
|
-
### List all purchased and active phone numbers
|
|
898
|
-
|
|
899
|
-
List all purchased and active phone numbers
|
|
900
|
-
|
|
901
|
-
```typescript
|
|
902
|
-
import { RetellClient } from "retell-sdk";
|
|
903
|
-
|
|
904
|
-
(async () => {
|
|
905
|
-
const sdk = new RetellClient({
|
|
906
|
-
apiKey: "",
|
|
907
|
-
});
|
|
908
|
-
|
|
909
|
-
const res = await sdk.listPhoneNumbers();
|
|
910
|
-
|
|
911
|
-
if (res.statusCode == 200) {
|
|
912
|
-
// handle response
|
|
913
|
-
}
|
|
914
|
-
})();
|
|
915
|
-
|
|
916
|
-
```
|
|
917
|
-
|
|
918
|
-
### Update an existing agent
|
|
919
|
-
|
|
920
|
-
Update an existing agent
|
|
921
|
-
|
|
922
|
-
```typescript
|
|
923
|
-
import { RetellClient } from "retell-sdk";
|
|
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
|
-
}
|
|
948
|
-
})();
|
|
949
|
-
|
|
950
|
-
```
|
|
951
|
-
|
|
952
|
-
### Update an existing phone number
|
|
953
|
-
|
|
954
|
-
Update an existing phone number
|
|
955
|
-
|
|
956
|
-
```typescript
|
|
957
|
-
import { RetellClient } from "retell-sdk";
|
|
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
|
-
}
|
|
977
|
-
})();
|
|
978
|
-
|
|
979
|
-
```
|
|
980
|
-
<!-- End SDK Example Usage -->
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
<!-- Start SDK Available Operations -->
|
|
985
|
-
## Available Resources and Operations
|
|
986
|
-
|
|
987
|
-
### [RetellClient SDK](docs/sdks/retellclient/README.md)
|
|
988
|
-
|
|
989
|
-
* [createAgent](docs/sdks/retellclient/README.md#createagent) - Create a new agent
|
|
990
|
-
* [createPhoneCall](docs/sdks/retellclient/README.md#createphonecall) - Initiate an outbound phone call.
|
|
991
|
-
* [createPhoneNumber](docs/sdks/retellclient/README.md#createphonenumber) - Create a new phone number
|
|
992
|
-
* [deleteAgent](docs/sdks/retellclient/README.md#deleteagent) - Delete an existing agent
|
|
993
|
-
* [deletePhoneNumber](docs/sdks/retellclient/README.md#deletephonenumber) - Delete a specific phone number
|
|
994
|
-
* [getAgent](docs/sdks/retellclient/README.md#getagent) - Retrieve details of a specific agent
|
|
995
|
-
* [getCall](docs/sdks/retellclient/README.md#getcall) - Retrieve details of a specific call
|
|
996
|
-
* [getPhoneNumber](docs/sdks/retellclient/README.md#getphonenumber) - Retrieve info about a specific number
|
|
997
|
-
* [listAgents](docs/sdks/retellclient/README.md#listagents) - List all agents
|
|
998
|
-
* [listCalls](docs/sdks/retellclient/README.md#listcalls) - Retrieve call details
|
|
999
|
-
* [listPhoneNumbers](docs/sdks/retellclient/README.md#listphonenumbers) - List all purchased and active phone numbers
|
|
1000
|
-
* [updateAgent](docs/sdks/retellclient/README.md#updateagent) - Update an existing agent
|
|
1001
|
-
* [updatePhoneAgent](docs/sdks/retellclient/README.md#updatephoneagent) - Update an existing phone number
|
|
1002
|
-
<!-- End SDK Available Operations -->
|
|
1003
|
-
|
|
1004
|
-
|
|
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
|
|
1141
|
-
|
|
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.
|
|
1143
|
-
|
|
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 -->
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
<!-- Start Authentication -->
|
|
1161
|
-
## Authentication
|
|
1162
|
-
|
|
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 -->
|
|
1198
|
-
|
|
1199
628
|
<!-- Placeholder for Future Speakeasy SDK Sections -->
|
|
1200
629
|
|
|
1201
630
|
# Development
|
package/dist/sdk/sdk.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { WebSocket } from "undici-types";
|
|
1
3
|
import * as utils from "../internal/utils";
|
|
2
4
|
import * as components from "../models/components";
|
|
3
5
|
import * as operations from "../models/operations";
|
|
4
6
|
import { AxiosInstance, AxiosRequestConfig } from "axios";
|
|
7
|
+
import { EventEmitter } from "events";
|
|
5
8
|
/**
|
|
6
9
|
* Contains the list of servers available to the SDK
|
|
7
10
|
*/
|
|
@@ -37,10 +40,22 @@ export declare class SDKConfiguration {
|
|
|
37
40
|
openapiDocVersion: string;
|
|
38
41
|
sdkVersion: string;
|
|
39
42
|
genVersion: string;
|
|
40
|
-
userAgent: string;
|
|
41
43
|
retryConfig?: utils.RetryConfig;
|
|
42
44
|
constructor(init?: Partial<SDKConfiguration>);
|
|
43
45
|
}
|
|
46
|
+
interface PromptParam {
|
|
47
|
+
name: string;
|
|
48
|
+
value: string;
|
|
49
|
+
}
|
|
50
|
+
export declare class LiveClient extends EventEmitter {
|
|
51
|
+
ws: WebSocket;
|
|
52
|
+
constructor(apiKey: string, agentId: string, sampleRate: number, agentPromptParams: PromptParam[], baseEndpoint: string);
|
|
53
|
+
waitForReady(): Promise<void>;
|
|
54
|
+
send(audio: Uint8Array): void;
|
|
55
|
+
close(): void;
|
|
56
|
+
}
|
|
57
|
+
export declare function convertPCM16ToFloat32(array: Uint8Array): Float32Array;
|
|
58
|
+
export declare function convertFloat32ToPCM16(array: Float32Array): Uint8Array;
|
|
44
59
|
export declare class RetellClient {
|
|
45
60
|
private sdkConfiguration;
|
|
46
61
|
constructor(props?: SDKProps);
|
|
@@ -97,3 +112,4 @@ export declare class RetellClient {
|
|
|
97
112
|
*/
|
|
98
113
|
updatePhoneAgent(requestBody: operations.UpdatePhoneAgentRequestBody, phoneNumber: string, config?: AxiosRequestConfig): Promise<operations.UpdatePhoneAgentResponse>;
|
|
99
114
|
}
|
|
115
|
+
export {};
|