Skip to content

Error when getting calls #1

@Hades32

Description

@Hades32

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions