Skip to content
This repository was archived by the owner on Nov 10, 2022. It is now read-only.
This repository was archived by the owner on Nov 10, 2022. It is now read-only.

dialogflow heartbeat/ping using SDK #14

@prayagupa

Description

@prayagupa

Is there a way to check if my app is able to talk to dialogflow agent using java SDK. The purpose is just to verify the credentials are working and connectivity is working when I deploy my application, before actual traffic flows in.

One way I can think of is make a intent-request itself which is not a good solution in my opinion; I wrote something as below (in clojure using java sdk)

(defn heartbeat [{nlu-agent :nlu-agent utterance :utterance creds-file :creds-file}]
  (try
    (send-intent-request
     {:nlu-agent  nlu-agent
      :utterance  utterance
      :creds-file creds-file})
    "success"
    (catch Throwable e
      (.getMessage e))))

And obviously I'm using credentials.json provided my gcloud which looks as below (taken from https://cloud.google.com/video-intelligence/docs/common/auth#authenticating_with_application_default_credentials);

{
  "type": "service_account",
  "project_id": "project-id",
  "private_key_id": "some_number",
  "private_key": "-----BEGIN PRIVATE KEY-----\n....
  =\n-----END PRIVATE KEY-----\n",
  "client_email": "<api-name>[email protected]",
  "client_id": "...",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://accounts.google.com/o/oauth2/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/...<api-name>api%40project-id.iam.gserviceaccount.com"
}

But don't want to send actual intent-requests in PROD every minute just for the sake of heartbeat.

cc @nnegrey

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions