Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@google-cloud/dialogflow-cx
Advanced tools
Cx client for Node.js
A comprehensive list of changes in each version may be found in the CHANGELOG.
Read more about the client libraries for Cloud APIs, including the older Google APIs Client Libraries, in Client Libraries Explained.
Table of contents:
npm install @google-cloud/dialogflow-cx
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
// const projectId = 'my-project';
// const location = 'global';
// const agentId = 'my-agent';
// const audioFileName = '/path/to/audio.raw';
// const encoding = 'AUDIO_ENCODING_LINEAR_16';
// const sampleRateHertz = 16000;
// const languageCode = 'en'
// Imports the Google Cloud Some API library
const {SessionsClient} = require('@google-cloud/dialogflow-cx');
/**
* Example for regional endpoint:
* const location = 'us-central1'
* const client = new SessionsClient({apiEndpoint: 'us-central1-dialogflow.googleapis.com'})
*/
const client = new SessionsClient();
const fs = require('fs');
const util = require('util');
// Assumes uuid module has been installed from npm,
// npm i uuid:
const {v4} = require('uuid');
async function detectIntentAudio() {
const sessionId = v4();
const sessionPath = client.projectLocationAgentSessionPath(
projectId,
location,
agentId,
sessionId
);
// 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}`
);
}
detectIntentAudio();
Samples are in the samples/
directory. Each sample's README.md
has instructions for running its sample.
Sample | Source Code | Try it |
---|---|---|
Agents.create_agent | source code | |
Agents.delete_agent | source code | |
Agents.export_agent | source code | |
Agents.get_agent | source code | |
Agents.get_agent_validation_result | source code | |
Agents.get_generative_settings | source code | |
Agents.list_agents | source code | |
Agents.restore_agent | source code | |
Agents.update_agent | source code | |
Agents.update_generative_settings | source code | |
Agents.validate_agent | source code | |
Changelogs.get_changelog | source code | |
Changelogs.list_changelogs | source code | |
Deployments.get_deployment | source code | |
Deployments.list_deployments | source code | |
Entity_types.create_entity_type | source code | |
Entity_types.delete_entity_type | source code | |
Entity_types.export_entity_types | source code | |
Entity_types.get_entity_type | source code | |
Entity_types.import_entity_types | source code | |
Entity_types.list_entity_types | source code | |
Entity_types.update_entity_type | source code | |
Environments.create_environment | source code | |
Environments.delete_environment | source code | |
Environments.deploy_flow | source code | |
Environments.get_environment | source code | |
Environments.list_continuous_test_results | source code | |
Environments.list_environments | source code | |
Environments.lookup_environment_history | source code | |
Environments.run_continuous_test | source code | |
Environments.update_environment | source code | |
Experiments.create_experiment | source code | |
Experiments.delete_experiment | source code | |
Experiments.get_experiment | source code | |
Experiments.list_experiments | source code | |
Experiments.start_experiment | source code | |
Experiments.stop_experiment | source code | |
Experiments.update_experiment | source code | |
Flows.create_flow | source code | |
Flows.delete_flow | source code | |
Flows.export_flow | source code | |
Flows.get_flow | source code | |
Flows.get_flow_validation_result | source code | |
Flows.import_flow | source code | |
Flows.list_flows | source code | |
Flows.train_flow | source code | |
Flows.update_flow | source code | |
Flows.validate_flow | source code | |
Generators.create_generator | source code | |
Generators.delete_generator | source code | |
Generators.get_generator | source code | |
Generators.list_generators | source code | |
Generators.update_generator | source code | |
Intents.create_intent | source code | |
Intents.delete_intent | source code | |
Intents.export_intents | source code | |
Intents.get_intent | source code | |
Intents.import_intents | source code | |
Intents.list_intents | source code | |
Intents.update_intent | source code | |
Pages.create_page | source code | |
Pages.delete_page | source code | |
Pages.get_page | source code | |
Pages.list_pages | source code | |
Pages.update_page | source code | |
Security_settings_service.create_security_settings | source code | |
Security_settings_service.delete_security_settings | source code | |
Security_settings_service.get_security_settings | source code | |
Security_settings_service.list_security_settings | source code | |
Security_settings_service.update_security_settings | source code | |
Session_entity_types.create_session_entity_type | source code | |
Session_entity_types.delete_session_entity_type | source code | |
Session_entity_types.get_session_entity_type | source code | |
Session_entity_types.list_session_entity_types | source code | |
Session_entity_types.update_session_entity_type | source code | |
Sessions.detect_intent | source code | |
Sessions.fulfill_intent | source code | |
Sessions.match_intent | source code | |
Sessions.server_streaming_detect_intent | source code | |
Sessions.streaming_detect_intent | source code | |
Sessions.submit_answer_feedback | source code | |
Test_cases.batch_delete_test_cases | source code | |
Test_cases.batch_run_test_cases | source code | |
Test_cases.calculate_coverage | source code | |
Test_cases.create_test_case | source code | |
Test_cases.export_test_cases | source code | |
Test_cases.get_test_case | source code | |
Test_cases.get_test_case_result | source code | |
Test_cases.import_test_cases | source code | |
Test_cases.list_test_case_results | source code | |
Test_cases.list_test_cases | source code | |
Test_cases.run_test_case | source code | |
Test_cases.update_test_case | source code | |
Transition_route_groups.create_transition_route_group | source code | |
Transition_route_groups.delete_transition_route_group | source code | |
Transition_route_groups.get_transition_route_group | source code | |
Transition_route_groups.list_transition_route_groups | source code | |
Transition_route_groups.update_transition_route_group | source code | |
Versions.compare_versions | source code | |
Versions.create_version | source code | |
Versions.delete_version | source code | |
Versions.get_version | source code | |
Versions.list_versions | source code | |
Versions.load_version | source code | |
Versions.update_version | source code | |
Webhooks.create_webhook | source code | |
Webhooks.delete_webhook | source code | |
Webhooks.get_webhook | source code | |
Webhooks.list_webhooks | source code | |
Webhooks.update_webhook | source code | |
Agents.create_agent | source code | |
Agents.delete_agent | source code | |
Agents.export_agent | source code | |
Agents.get_agent | source code | |
Agents.get_agent_validation_result | source code | |
Agents.get_generative_settings | source code | |
Agents.list_agents | source code | |
Agents.restore_agent | source code | |
Agents.update_agent | source code | |
Agents.update_generative_settings | source code | |
Agents.validate_agent | source code | |
Changelogs.get_changelog | source code | |
Changelogs.list_changelogs | source code | |
Conversation_history.delete_conversation | source code | |
Conversation_history.get_conversation | source code | |
Conversation_history.list_conversations | source code | |
Deployments.get_deployment | source code | |
Deployments.list_deployments | source code | |
Entity_types.create_entity_type | source code | |
Entity_types.delete_entity_type | source code | |
Entity_types.export_entity_types | source code | |
Entity_types.get_entity_type | source code | |
Entity_types.import_entity_types | source code | |
Entity_types.list_entity_types | source code | |
Entity_types.update_entity_type | source code | |
Environments.create_environment | source code | |
Environments.delete_environment | source code | |
Environments.deploy_flow | source code | |
Environments.get_environment | source code | |
Environments.list_continuous_test_results | source code | |
Environments.list_environments | source code | |
Environments.lookup_environment_history | source code | |
Environments.run_continuous_test | source code | |
Environments.update_environment | source code | |
Examples.create_example | source code | |
Examples.delete_example | source code | |
Examples.get_example | source code | |
Examples.list_examples | source code | |
Examples.update_example | source code | |
Experiments.create_experiment | source code | |
Experiments.delete_experiment | source code | |
Experiments.get_experiment | source code | |
Experiments.list_experiments | source code | |
Experiments.start_experiment | source code | |
Experiments.stop_experiment | source code | |
Experiments.update_experiment | source code | |
Flows.create_flow | source code | |
Flows.delete_flow | source code | |
Flows.export_flow | source code | |
Flows.get_flow | source code | |
Flows.get_flow_validation_result | source code | |
Flows.import_flow | source code | |
Flows.list_flows | source code | |
Flows.train_flow | source code | |
Flows.update_flow | source code | |
Flows.validate_flow | source code | |
Generators.create_generator | source code | |
Generators.delete_generator | source code | |
Generators.get_generator | source code | |
Generators.list_generators | source code | |
Generators.update_generator | source code | |
Intents.create_intent | source code | |
Intents.delete_intent | source code | |
Intents.export_intents | source code | |
Intents.get_intent | source code | |
Intents.import_intents | source code | |
Intents.list_intents | source code | |
Intents.update_intent | source code | |
Pages.create_page | source code | |
Pages.delete_page | source code | |
Pages.get_page | source code | |
Pages.list_pages | source code | |
Pages.update_page | source code | |
Playbooks.create_playbook | source code | |
Playbooks.create_playbook_version | source code | |
Playbooks.delete_playbook | source code | |
Playbooks.delete_playbook_version | source code | |
Playbooks.get_playbook | source code | |
Playbooks.get_playbook_version | source code | |
Playbooks.list_playbook_versions | source code | |
Playbooks.list_playbooks | source code | |
Playbooks.update_playbook | source code | |
Security_settings_service.create_security_settings | source code | |
Security_settings_service.delete_security_settings | source code | |
Security_settings_service.get_security_settings | source code | |
Security_settings_service.list_security_settings | source code | |
Security_settings_service.update_security_settings | source code | |
Session_entity_types.create_session_entity_type | source code | |
Session_entity_types.delete_session_entity_type | source code | |
Session_entity_types.get_session_entity_type | source code | |
Session_entity_types.list_session_entity_types | source code | |
Session_entity_types.update_session_entity_type | source code | |
Sessions.detect_intent | source code | |
Sessions.fulfill_intent | source code | |
Sessions.match_intent | source code | |
Sessions.server_streaming_detect_intent | source code | |
Sessions.streaming_detect_intent | source code | |
Sessions.submit_answer_feedback | source code | |
Test_cases.batch_delete_test_cases | source code | |
Test_cases.batch_run_test_cases | source code | |
Test_cases.calculate_coverage | source code | |
Test_cases.create_test_case | source code | |
Test_cases.export_test_cases | source code | |
Test_cases.get_test_case | source code | |
Test_cases.get_test_case_result | source code | |
Test_cases.import_test_cases | source code | |
Test_cases.list_test_case_results | source code | |
Test_cases.list_test_cases | source code | |
Test_cases.run_test_case | source code | |
Test_cases.update_test_case | source code | |
Tools.create_tool | source code | |
Tools.delete_tool | source code | |
Tools.export_tools | source code | |
Tools.get_tool | source code | |
Tools.list_tools | source code | |
Tools.update_tool | source code | |
Transition_route_groups.create_transition_route_group | source code | |
Transition_route_groups.delete_transition_route_group | source code | |
Transition_route_groups.get_transition_route_group | source code | |
Transition_route_groups.list_transition_route_groups | source code | |
Transition_route_groups.update_transition_route_group | source code | |
Versions.compare_versions | source code | |
Versions.create_version | source code | |
Versions.delete_version | source code | |
Versions.get_version | source code | |
Versions.list_versions | source code | |
Versions.load_version | source code | |
Versions.update_version | source code | |
Webhooks.create_webhook | source code | |
Webhooks.delete_webhook | source code | |
Webhooks.get_webhook | source code | |
Webhooks.list_webhooks | source code | |
Webhooks.update_webhook | source code | |
Quickstart | source code |
The Dialogflow CX API Node.js Client API Reference documentation also contains samples.
Our client libraries follow the Node.js release schedule. Libraries are compatible with all current active and maintenance versions of Node.js. If you are using an end-of-life version of Node.js, we recommend that you update as soon as possible to an actively supported LTS version.
Google's client libraries support legacy versions of Node.js runtimes on a best-efforts basis with the following warnings:
Client libraries targeting some end-of-life versions of Node.js are available, and
can be installed through npm dist-tags.
The dist-tags follow the naming convention legacy-(version)
.
For example, npm install @google-cloud/dialogflow-cx@legacy-8
installs client libraries
for versions compatible with Node.js 8.
This library follows Semantic Versioning.
This library is considered to be stable. The code surface will not change in backwards-incompatible ways unless absolutely necessary (e.g. because of critical security issues) or with an extensive deprecation period. Issues and requests against stable libraries are addressed with the highest priority.
More Information: Google Cloud Platform Launch Stages
Contributions welcome! See the Contributing Guide.
Please note that this README.md
, the samples/README.md
,
and a variety of configuration files in this repository (including .nycrc
and tsconfig.json
)
are generated from a central template. To edit one of these files, make an edit
to its templates in
directory.
Apache Version 2.0
See LICENSE
FAQs
Cx client for Node.js
We found that @google-cloud/dialogflow-cx demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.