4

I am trying to interact with a Dialogflow CX agent using the RPC DetectIntent method but I am getting the error "Please switch to 'us-east1-dialogflow.googleapis.com' to access resources located in 'us-east1'".

My agent is located in 'us-east1'. The session path I am providing to the API is in the following format: "projects/myproject/locations/us-east1/agents/my-agent-id/sessions/mysessionid

My imports are:

cx "cloud.google.com/go/dialogflow/cx/apiv3"

cxpb "goolge.golang.org/genproto/goolgeapis/cloud/dialogflow/cx/v3"

I have this working in Python using a similar session path, I don't understand what the GO API wants. Can anyone tell me what this error means?

JonK
  • 61
  • 3

2 Answers2

2

I figured it out. It was referring to the endpoint ID. The agents needs to be created with an endpoint ID referencing the location.

dialogflow.NewSessionsClient(ctx, option.WithEndpoint("us-east1-dialogflow.googleapis.com:443"))

JonK
  • 61
  • 3
0

What worked for me was to add the location when instantiating the client.

const options = {
keyFilename : creds_path,
apiEndpoint: "us-east1-dialogflow.googleapis.com"
};
const ic = new dialogflow.IntentsClient(options);

projectId = "your-id"
location = "us-east1"
agentId = "your-agent-id"
const parent = ic.agentPath(projectId, location, agentId)
Arash
  • 63
  • 5