Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when getting calls #1

Open
Hades32 opened this issue Nov 8, 2024 · 1 comment
Open

Error when getting calls #1

Hades32 opened this issue Nov 8, 2024 · 1 comment

Comments

@Hades32
Copy link

Hades32 commented Nov 8, 2024

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)
	}
@Hades32
Copy link
Author

Hades32 commented Nov 8, 2024

so I still consider this a bug, since the error isn't correct, but I figured out this happens when you accidentally pass in an empty string as the call ID

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant