{"id":19778875,"url":"https://github.com/dialogflow/fulfillment-telephony-nodejs","last_synced_at":"2025-04-30T21:31:15.202Z","repository":{"id":82729684,"uuid":"156266246","full_name":"dialogflow/fulfillment-telephony-nodejs","owner":"dialogflow","description":" Sample integrating Telephony, Google Sheets, and Slot Filling with Dialogflow","archived":false,"fork":false,"pushed_at":"2018-11-05T20:15:56.000Z","size":27,"stargazers_count":24,"open_issues_count":0,"forks_count":13,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-06T04:41:44.183Z","etag":null,"topics":["add-to-dialogflow","dialogflow-fulfillment-nodejs","google-sheets-api-v4","slot-filling","telephony"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dialogflow.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":"2018-11-05T18:48:49.000Z","updated_at":"2021-12-06T23:27:38.000Z","dependencies_parsed_at":"2023-03-18T08:00:12.923Z","dependency_job_id":null,"html_url":"https://github.com/dialogflow/fulfillment-telephony-nodejs","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/dialogflow%2Ffulfillment-telephony-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dialogflow%2Ffulfillment-telephony-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dialogflow%2Ffulfillment-telephony-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dialogflow%2Ffulfillment-telephony-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dialogflow","download_url":"https://codeload.github.com/dialogflow/fulfillment-telephony-nodejs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251785406,"owners_count":21643475,"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":["add-to-dialogflow","dialogflow-fulfillment-nodejs","google-sheets-api-v4","slot-filling","telephony"],"created_at":"2024-11-12T05:32:31.517Z","updated_at":"2025-04-30T21:31:15.181Z","avatar_url":"https://github.com/dialogflow.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Dialogflow Fulfillment with Telephony, Google Sheets API, and Slot Filling\n\nThe following is a restaurant reservation sample that involves interacting with the restaurant's agent through a provided Dialogflow Telephony Gateway phone number in order to make a reservation and alternatively, the user can opt to have a call be placed to the restaurant's main line. This sample will highlight certain Telephony features that can bring more depth and substance to a typical agent.\n\nTelephony features:\n    + Synthesize speech for SSML support\n    + Playing audio\n    + Call transfers\n\nThe reservation data will be saved using the Google Sheets API. In addition, slot filling simplifies your agent by letting you obtain multiple, required parameters within a single intent as well as automatically managing contexts via output contexts. If any parameters are missing from a user utterance, your agent will automatically prompt users for the required parameters.\n\n## Setup\n\nSelect **only one** of the options below.\n\n### Option 1: Add to Dialogflow (Recommended)\nTo create this agent from our template:\n\n\u003ca href=\"https://console.dialogflow.com/api-client/oneclick?templateUrl=https://oneclickgithub.appspot.com/dialogflow/fulfillment-telephony-nodejs\u0026agentName=TelephonyReservations\" target=\"blank\"\u003e\n  \u003cimg src=\"https://dialogflow.com/images/deploy.png\"\u003e\n\u003c/a\u003e\n\n### Option 2: Firebase CLI\n1. Create a [Dialogflow Agent](https://console.dialogflow.com/).\n2. `git clone https://github.com/dialogflow/fulfillment-telephony-nodejs.git`\n3. Go to **Settings** ⚙ \u003e **Export and Import** \u003e **Restore from zip** using the `dialogflow-agent.zip` in this directory.\n4. `cd` to the `functions` directory\n5. Run `npm install`.\n6. Install the Firebase CLI by running `npm install -g firebase-tools`\n7. Login with your Google account, `firebase login`\n8.  Add your project to the sample with `firebase use \u003cproject ID\u003e`\n  + In Dialogflow console under **Settings** ⚙ \u003e **General** tab \u003e copy **Project ID**.\n9. Run `firebase deploy --only functions:dialogflowFulfillment`\n10. Back in Dialogflow Console \u003e **Fulfullment** \u003e **Enable** Webhook.\n11. Paste the URL from the Firebase Console’s events column into the **URL** field \u003e **Save**.\n\n## Configuration\n#### Service Account Authentication with JWT/OAuth 2.0\n1. From the [Dialogflow's console](https://console.dialogflow.com) \u003e go to **Settings ⚙** and under the `General` tab \u003e go the `Project Id` link, which will take you to the **Google Cloud Platform** console\n2. In the Cloud console, go to **Menu ☰** \u003e **APIs \u0026 Services** \u003e **Library**\n3. Select **Google Sheets API** \u003e **Enable**\n4. Under **Menu ☰** \u003e **APIs \u0026 Services** \u003e **Credentials** \u003e **Create Credentials** \u003e **Service Account Key**.\n5. From the dropdown, select **New Service Account**\n    + name:  `telephony-sample`\n    + role:  **Project/Owner**\n    + key type: **JSON** \u003e **Create**\n    + JSON file will be downloaded to your local machine\n\n#### Adding Service Account Details to Agent and a Google Sheet\n1. From your preferred Google Drive account, create a new spreadsheet and **Share** with the service account email\n    + Should resemble `telephonyfulfillment@telephonysample.iam.gserviceaccount.com`\n    + To find the Service account email, look in the private JSON file \u003e **client_email**\n2. In the Dialogflow console \u003e **Fulfillment** section \u003e replace `line 26` with the private JSON contents and `line 56` with the service account-shared spreadsheetId.\n    + You can find the spreadsheetId from the Google Sheets URL:       `https://docs.google.com/spreadsheets/d/\u003cSPREADSHEETID\u003e/`\n\n#### Getting a Dialogflow Telephony Gateway Phone Number\n1. From **Settings ⚙** \u003e **General** tab \u003e **Enable Beta features and APIs** \u003e **Save**\n2. Go to the **Integrations** section \u003e\n      + Select an Area Code (optional) \u003e **Next** \u003e Choose a number\n      + You can always view your agent's number by visiting **Integrations \u003e Dialogflow Telephony Gateway**\n\n#### Testing this Sample\n1. From the Dialogflow console, replace all the phone numbers in the Telephony `Call transfer` responses to a number that you can ensure it is working as expected.\n2. Add the following columns to your Google Sheet (A1 to E1): `Date`, `Time (24HR)`, `Name`, `Group`, `Number`\n3. Now you can test out this sample by calling the Dialogflow Telephony agent's number at `+1 415-582-6862`.\n\n#### Adding Audio Files to Agent (Optional)\nFor Telephony's playing audio files feature, you can use VLC in order to properly reformat a given .wav file with the following steps:\n1. **File \u003e Convert/Stream**\n2. **Choose Profile \u003e Audio CD \u003e Customize \u003e Audio codec**\n      + WAV\n      + Bitrate = 16\n      + Channels = 1\n      + Samplerate = 8000 \u003e **Apply** \u003e **Save as File**\n\n3. Upload this file through **Google Cloud Platform** console \u003e **Menu ☰** \u003e **Storage** \u003e **Browser** \u003e select a bucket link and upload your audio file.\n4. Back in the Dialogflow console, you can now add Telephony `Play audio` responses with the following format:\n      + Generally: `gs://\u003cbucket\u003e/\u003cobject\u003e`\n      + Ex: `gs://telephonysample.appspot.com/gcloud-multi.wav`\n\n## Related Samples\n| Name       | Language           |\n| ------------- |:-------------:|\n| [Fulfillment \u0026 Regex Validation](https://github.com/dialogflow/fulfillment-regex-nodejs)      | Node.js |\n| [Weather: Fulfillment \u0026 WWO API](https://github.com/dialogflow/fulfillment-weather-nodejs)     | Node.js      |  \n| [Basic Slot Filling](https://github.com/dialogflow/fulfillment-slot-filling-nodejs) | Node.js |\n| [Bike Shop: Fulfillment \u0026 Google Calendar API](https://github.com/dialogflow/fulfillment-bike-shop-nodejs)| Node.js |\n| [Temperature Trivia: Fulfillment \u0026 Actions on Google](https://github.com/dialogflow/fulfillment-temperature-converter-nodejs) | Node.js |\n| [Fulfillment \u0026 Actions on Google](https://github.com/dialogflow/fulfillment-actions-library-nodejs) | Node.js |\n| [Fulfillment \u0026 Firestore Database](https://github.com/dialogflow/fulfillment-firestore-nodejs) | Node.js |\n| [Multi-language/locale](https://github.com/dialogflow/fulfillment-multi-locale-nodejs) | Node.js |\n\nFor Fulfillment Webhook [JSON Requests \u0026 Responses](https://github.com/dialogflow/fulfillment-webhook-json).\n\n\n## References \u0026 Issues\n+ Questions? Try [StackOverflow](https://stackoverflow.com/questions/tagged/dialogflow),  [Dialogflow Help Forum](https://productforums.google.com/forum/#!forum/dialogflow), or [Support](https://dialogflow.com/support).\n+ For bugs, please report an issue on [Github](https://github.com/dialogflow/dialogflow-fulfillment-nodejs/issues).\n+ Dialogflow [Documentation](https://docs.dialogflow.com).\n+ Dialogflow [Fulfillment Classes Reference](https://github.com/dialogflow/dialogflow-fulfillment-nodejs/tree/master/docs).\n+ For more info on the [Actions on Google NPM module](https://github.com/actions-on-google/actions-on-google-nodejs)\n+ For more info on [Building Actions on Google with Dialogflow Agents Documentation](https://developers.google.com/actions/dialogflow/)\n\n## Make Contributions\nPlease read and follow the steps in the CONTRIBUTING.md\n\n## License\nSee LICENSE.md\n\n## Terms\nYour use of this sample is subject to, and by using or downloading the sample files you agree to comply with, the [Google APIs Terms of Service](https://developers.google.com/terms/) and [Dialogflow's Terms of Use and Privacy Policy](https://dialogflow.com/terms-and-privacy).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdialogflow%2Ffulfillment-telephony-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdialogflow%2Ffulfillment-telephony-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdialogflow%2Ffulfillment-telephony-nodejs/lists"}