-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
I'm getting this when getting a call
error="error in VapiClient
.Calls.Get: json: cannot unmarshal array into Go value of type struct { api.embed; CreatedAt *core.DateTime \"json:\\\"createdAt\\\"\"; UpdatedAt *core.DateTime \"json:\\\"updatedAt\\\"\";
StartedAt *core.DateTime \"json:\\\"startedAt,omitempty\\\"\"; EndedAt *core.DateTime \"json:\\\"endedAt,omitempty\\\"\" }"
calling code
call, err := clients.VapiClient.Calls.Get(ctx, params.ActivityParams.CallID)
if err != nil {
return nil, fmt.Errorf("error in VapiClient.Calls.Get: %w", err)
}creating code
callConfig := &vapisdk.CreateCallDto{
// the call name is just for our reference, and we use it for idempotency
Name: utils.Ptr(params.IdempotencyKey),
Assistant: &vapisdk.CreateAssistantDto{
Transcriber: &vapisdk.CreateAssistantDtoTranscriber{
DeepgramTranscriber: &vapisdk.DeepgramTranscriber{
Model: utils.Ptr(vapisdk.DeepgramTranscriberModelNova2),
},
},
Model: &vapisdk.CreateAssistantDtoModel{
OpenAiModel: &vapisdk.OpenAiModel{
Messages: []*vapisdk.OpenAiMessage{{
Role: "system",
Content: &systemPrompt,
}},
Model: llmModel,
MaxTokens: &maxTokens,
},
},
Voice: &vapisdk.CreateAssistantDtoVoice{
ElevenLabsVoice: &vapisdk.ElevenLabsVoice{
VoiceId: &vapisdk.ElevenLabsVoiceId{
String: voiceID,
},
Model: utils.Ptr(ttsModel),
},
},
HipaaEnabled: utils.Ptr(false),
SilenceTimeoutSeconds: nil,
MaxDurationSeconds: &maxCallSeconds,
Name: &agentName,
EndCallMessage: nil,
EndCallPhrases: []string{"goodbye"},
Metadata: map[string]any{
"idempotencyKey": params.IdempotencyKey,
"createdAt": time.Now(),
},
ServerUrl: &env.SelfURL,
ServerUrlSecret: &env.VAPIWebhookSecret,
ArtifactPlan: &vapisdk.ArtifactPlan{
RecordingEnabled: utils.Ptr(true),
TranscriptPlan: &vapisdk.TranscriptPlan{
Enabled: utils.Ptr(true),
},
},
MessagePlan: &vapisdk.MessagePlan{},
FirstMessageMode: utils.Ptr(vapisdk.CreateAssistantDtoFirstMessageModeAssistantWaitsForUser),
BackchannelingEnabled: utils.Ptr(false),
// TODO
VoicemailMessage: utils.Ptr("I'll call back later"),
VoicemailDetection: &vapisdk.TwilioVoicemailDetection{
Enabled: utils.Ptr(true),
},
},
call, err := clients.VapiClient.Calls.Create(ctx, callConfig)
if err != nil {
return nil, fmt.Errorf("failed to create call: %w", err)
}Metadata
Metadata
Assignees
Labels
No labels