async function detectIntentAudio() {
    const sessionId = Math.random().toString(36).substring(7);
    const sessionPath = client.projectLocationAgentSessionPath(
      projectId,
      location,
      agentId,
      sessionId
    );
    console.info(sessionPath);

    // Read the content of the audio file and send it as part of the request.
    const readFile = util.promisify(fs.readFile);
    const inputAudio = await readFile(audioFileName);

    const request = {
      session: sessionPath,
      queryInput: {
        audio: {
          config: {
            audioEncoding: encoding,
            sampleRateHertz: sampleRateHertz,
          },
          audio: inputAudio,
        },
        languageCode,
      },
    };
    const [response] = await client.detectIntent(request);
    console.log(`User Query: ${response.queryResult.transcript}`);
    for (const message of response.queryResult.responseMessages) {
      if (message.text) {
        console.log(`Agent Response: ${message.text.text}`);
      }
    }
    if (response.queryResult.match.intent) {
      console.log(
        `Matched Intent: ${response.queryResult.match.intent.displayName}`
      );
    }
    console.log(
      `Current Page: ${response.queryResult.currentPage.displayName}`
    );
  }
Example for regional endpoint:
  const location = 'us-central1'
  const client = new SessionsClient({apiEndpoint: 'us-central1-dialogflow.googleapis.com'})