Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
virtual-google-assistant
Advanced tools
Virtual Google Assistant
Interact with actions intuitively and programmatically.
Virtual Google Assistant allows for interacting with Actions on Google programmatically.
The core Virtual Google Assistant API provides several routines - the three most essential ones:
* launch: Generates JSON for a launch request
* utter: Generates JSON as if the user said the given phrase
* intend: Generates JSON as if the given intent was uttered
This library allows for easy testing of actions on google.
You can use it for:
npm install virtual-google-assistant --save-dev
Easy! Just add a line of code like so:
const vga = require("virtual-google-assistant");
const assistant = vga.VirtualGoogleAssistant.Builder()
.handler("index.handler") // Google Cloud Function file and name
.directory("./dialogFlowFolder") // Path to the Dialog Flow exported model
.create();
assistant.utter("play").then((payload) => {
console.log("OutputSpeech: " + result.speech);
// Prints out returned SSML, e.g., "<speak> Welcome to my Action </speak>"
});
Currently we have three ways of setting up the virtual google assistant in order to work with your code.
Just set the complete url and we will send the Requests payloads to it.
const vga = require("virtual-google-assistant");
const assistant = vga.VirtualGoogleAssistant.Builder()
.actionUrl("http://myServer:3000/") // Example of a running server
.directory("./dialogFlowFolder") // Path to the Dialog Flow exported model
.create();
Set the path to the Action on Google code.
const vga = require("virtual-google-assistant");
const assistant = vga.VirtualGoogleAssistant.Builder()
.handler("index.handler") // Google Cloud Function file and name
.directory("./dialogFlowFolder") // Path to the Dialog Flow exported model
.create();
Set the path to the file were your server is, along the port that you use.
const vga = require("virtual-google-assistant");
const assistant = vga.VirtualGoogleAssistant.Builder()
.expressModule("index", 3000) // Express server file and port
.directory("./dialogFlowFolder") // Path to the Dialog Flow exported model
.create();
For this to work correctly, we need the generated server to be exported, for example:
var server = app.listen(3000, function () {
console.log('Example app listening on port 3000!');
});
module.exports = server;
The filter is a powerful tool for manipulating the request payloads that are made to your Action on Google.
assistant.addFilter((requestJSON) => {
// Do something with the request
request.result.resolvedQuery = "actions_intent_PERMISSION"; // Arbitrary example of changing the request payload
});
If the filters are no longer useful, you can remove all filters from the instance by using this method
assistant.resetFilters();
The virtual google assistant instance will keep your context from request to request automatically so that you can test multiturn actions too. If you need to force the context removal, you can use the following method
assistant.removeContext();
Easy, you can open an issue here, or find us on our Gitter.
We are also on the Alexa Slack channel - @jpkbst, @jperata and @ankraiza.
We look forward to hearing from you!
FAQs
Unknown package
The npm package virtual-google-assistant receives a total of 3,750 weekly downloads. As such, virtual-google-assistant popularity was classified as popular.
We found that virtual-google-assistant demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.