
Security News
npm ‘is’ Package Hijacked in Expanding Supply Chain Attack
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
dialogflow-api-utils
Advanced tools
Utility lib for working with the Dialogflow (formerly api.ai) API response data
Utility lib for working with Dialogflow (formerly api.ai) API response data
npm
:npm install --save dialogflow-api-utils
Below is an example how to use the module along with the api
module.
const apiai = require('apiai');
// Utilities for v1 of the Dialogflow API
const dfUtils = require('dialogflow-api-utils').v1;
const app = apiai("<your client access token>");
var request = app.textRequest('<Your text query>', {
sessionId: '<unique session id>'
});
request.on('response', function(response) {
// get all the parameters
var params = dfUtils.Query.getResultParameters(response);
// get the value of parameter 'foo', if it isn't set, the return 'bar'
var fooParam = dfUtils.Query.getResultParameter(response, 'foo', 'bar');
// get all the messages from fulfillment
var messages = dfUtils.Query.getFulfillmentMessages(response);
// only get the messages for Facebook Messenger
var fbMessages = dfUtils.Query.getFulfillmentMessages(response, 'facebook');
// only get the messages for Slack
var slackMessages = dfUtils.Query.getFulfillmentMessages(response, 'slack');
// get the context 'userProfile'
var userProfileContext = dfUtils.Query.getResponseContext(response, 'userProfile');
// code to send messages
});
request.on('error', function(error) {
console.log(error);
});
request.end();
View documentation for an overview of all functions and their parameters
See LICENSE.
FAQs
Utility lib for working with the Dialogflow (formerly api.ai) API response data
We found that dialogflow-api-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
Security News
A critical flaw in the popular npm form-data package could allow HTTP parameter pollution, affecting millions of projects until patched versions are adopted.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.