{"id":23175948,"url":"https://github.com/nexmo-community/dialogflow-reference-connection","last_synced_at":"2025-08-18T10:31:52.861Z","repository":{"id":104492180,"uuid":"386589693","full_name":"nexmo-community/dialogflow-reference-connection","owner":"nexmo-community","description":"Dialogflow Reference Connection ","archived":false,"fork":false,"pushed_at":"2024-12-17T08:22:42.000Z","size":70,"stargazers_count":3,"open_issues_count":9,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-12-17T09:29:45.893Z","etag":null,"topics":["dialogflow","heroku","javascript","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nexmo-community.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-16T09:56:45.000Z","updated_at":"2024-08-25T23:16:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"a0961fc8-26a8-4b48-915b-7ec190180a39","html_url":"https://github.com/nexmo-community/dialogflow-reference-connection","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nexmo-community%2Fdialogflow-reference-connection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nexmo-community%2Fdialogflow-reference-connection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nexmo-community%2Fdialogflow-reference-connection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nexmo-community%2Fdialogflow-reference-connection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nexmo-community","download_url":"https://codeload.github.com/nexmo-community/dialogflow-reference-connection/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230225635,"owners_count":18193014,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dialogflow","heroku","javascript","nodejs"],"created_at":"2024-12-18T06:10:41.641Z","updated_at":"2024-12-18T06:10:42.897Z","avatar_url":"https://github.com/nexmo-community.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dialogflow reference connection code\n\nYou can use the Dialogflow reference connection code to connect a Vonage Voice API call to a Google Dialogflow agent and then have an audio conversation with the agent. Speech transcripts and sentiment analysis are posted back to the Vonage Voice API application.\n\n## About this reference connection code\n\nDialogflow reference connection makes use of the [WebSockets feature](https://docs.nexmo.com/voice/voice-api/websockets) of Vonage Voice API. When a voice call is established, a Voice API application triggers a WebSocket connection to this Dialogflow reference connection and streams the audio to and from the voice call in real time.\n\nSee the [**sample Voice API application**](https://github.com/nexmo-community/dialogflow-sample-voice-application) for a  using this Dialogflow reference connection code to connect voice calls to a Google Dialogflow agent.\n\n## Transcripts and sentiment scores\n\nThis reference connection code will send caller's speech transcript and sentiment score, and Dialogflow agent's transcript to the Voice API application via webhook calls.\n\n## Dialogflow agent\n\nYou may already have a Google Dialogflow agent ready, if not, please create one that will be used for the purpose here.\n\nFor the next sections, we will need the corresponding Google Cloud Project ID value as well as Google Application Credentials JSON file (actual credentials file name has \".json\" extension).\n\nTo retrieve them:\u003c/br\u003e\n- Go to the [dialogflow console](https://dialogflow.cloud.google.com), go to the relevant Dialogflow agent, click on the gear icon, you will see the Project ID, we will use that value to set the parameter **GCLOUD_PROJECT_ID** in the next sections,\u003c/br\u003e\u003c/br\u003e\n- To retrieve the application credentials:\nclick on the Project ID link (as mentioned above),\u003c/br\u003e\nclick on '-\u003e Go to project settings',\u003c/br\u003e\n'Service Accounts',\u003c/br\u003e\n'+ CREATE SERVICE ACCOUNT',\u003c/br\u003e\nenter a name for 'Service account name' , e.g. *VonageDF*\u003c/br\u003e \nclick CREATE\u003c/br\u003e\nselect 'Dialogflow API' client as role (note: role permissions are beyond the scope of this demo)\u003c/br\u003e\nclick CONTINUE\u003c/br\u003e\nclick DONE\u003c/br\u003e\nclick on the 3 vertical dots (under Actions), Create key, JSON, CREATE, save the created file in your application folder\u003c/br\u003e\nthat key file name (ending with .json) is the value, e.g. *mydfagent-vonage-05768e59b7c5.json*\u003c/br\u003e\nwe will use that value to set the parameter **GOOGLE_APPLICATION_CREDENTIALS** in the next sections.\u003c/br\u003e\u003c/br\u003e\n\n## Enabling APIs on your Google project\n\nUsing your Google Cloud Console, on your corresponding Google project, make sure that both the **Dialogflow API** and the **Cloud Natural Language API** are enabled.\n\n## Running Dialogflow reference connection code\n\nYou deploy the Dialogflow reference connection code in one of the following couple of ways.\n\n### Local deployment\n\nTo run your own instance of this sample application locally, you'll need an up-to-date version of Node.js (we tested with version 14.3.0).\n\nDownload this sample application code to a local folder, then go to that folder.\n\nCopy the `.env.example` file over to a new file called `.env`:\n```bash\ncp .env.example .env\n```\n\nEdit `.env` file, and set both parameter values:\u003c/br\u003e\nGCLOUD_PROJECT_ID= \u003c/br\u003e\nGOOGLE_APPLICATION_CREDENTIALS=xxxxxxxxxxxxxxx.json\u003c/br\u003e\n\nInstall dependencies once:\n```bash\nnpm install\n```\n\nLaunch the applicatiom:\n```bash\nnode df-connecting-server\n```\n\n### Command Line Heroku deployment\n\nYou must first have deployed your application locally, as explained in previous section, and verified it is working.\n\nInstall [git](https://git-scm.com/downloads).\n\nInstall [Heroku command line](https://devcenter.heroku.com/categories/command-line) and login to your Heroku account.\n\nIf you do not yet have a local git repository, create one:\u003c/br\u003e\n```bash\ngit init\ngit add .\ngit commit -am \"initial\"\n```\n\nStart by creating this application on Heroku from the command line using the Heroku CLI:\n\n```bash\nheroku create thisappname\n```\n\nNote: In above command, replace \"thisappname\" with a unique name on the whole Heroku platform.\n\nOn your Heroku dashboard where your application page is shown, click on `Settings` button,\nadd the following `Config Vars` and set them with their respective values:\u003c/br\u003e\nGCLOUD_PROJECT_ID\u003c/br\u003e\nGOOGLE_APPLICATION_CREDENTIALS\u003c/br\u003e\n\nDeploy the application:\n\n```bash\ngit push heroku master\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnexmo-community%2Fdialogflow-reference-connection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnexmo-community%2Fdialogflow-reference-connection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnexmo-community%2Fdialogflow-reference-connection/lists"}