npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dialogflow-state-handler

v0.1.2

Published

Dialogflow Fulfillment Library for Node.js

Downloads

11

Readme

Dialogflow State Handler

This project is a modification of the dialogflow-fulfillment package with the aim of fixing two main problems.

  1. Patching bugs and issues from the original package that were not completed when the library became unmaintained.
  2. Adding helpful methods to allow easy state management and deeper conversations.

New Features

In addition to bug fixes and what's available in the original package, this project adds:

  • 2 additional fields to the constructor
    • views - A JSON file containing replies that can be accessed using the new "reply" method.
    • variables - A file containing exported functions that allow templated responses.
  • State handler methods
  • A new reply method (see below) for templated responses and state handling

Views, Variables and Templating

One of the main benefits of this project is the easy ability to create manageable and templated responses. Rather than having all of your responses scattered around a project, they can be easily managed in one file, and called from multiple locations. You can also easily fill a response with variables as seen below.

Variables

// TypeScript - variables.ts
export const DOB = () => "25th of December";
or
export const DOB = (agent:IDialogflowAgent) => agent.data.DOB;

// JavaScript - variables.js
module.exports.DOB = () => "25th of December";
or
module.exports.DOB = (agent) => agent.data.DOB;

Views

//views.json
{ "User.DateOfBirth" : [ "My date of birth is {DOB}" ] }

Response

const agent = new WebhookClient({ request, response, views, variables });
agent.reply("User.DateOfBirth")

Output

My date of birth is 25th of December

Dialogflow Fulfillment Library

The Dialogflow Fulfillment Library allows you to connect natural language understanding and processing to your own systems, APIs, and databases. Using Fulfillment, you can surface commands and information from your services to your users through a natural conversational interface.

Dialogflow Fulfillment makes creating fulfillment for Dialogflow v1 and v2 agents for 8 chat and voice platforms on Node.js easy and simple.

fulfillment library works with 8 platforms

Supported features

  • Text
  • Cards
  • Images
  • Suggestion Chips (Quick Replies)
  • Payloads (Platform-specific responses)

This library is intended to help build Node.js Dialogflow Fulfillment for multiple integrations including Google Assistant, Slack, Facebook, Telegram, Kik, Skype, Line, and Viber. See the reference documentation for more: https://dialogflow.com/docs/reference/fulfillment-library/webhook-client

If only building Dialogflow Fulfillment for the Google Assistant and no other integrations, use the Actions of Google NPM module (actions-on-google) which supports all Actions on Google features.

Setup Instructions

// Import the appropriate class
const { WebhookClient } = require('dialogflow-state-handler');

 //Create an instance
const agent = new WebhookClient({request: request, response: response, views: views, variables: variables});

Samples

| Name | Language | | ------------------------------------ |:---------------------------------| | Dialogflow Fulfillment & Actions on Google | Node.js | | Dialogflow & Firebase's Firestore DB | Node.js | | Bike Shop-Google Calendar API| Node.js| | Temperature Trivia | Node.js | | Multi-language/locale| Node.js | | Dialogflow's Inline Editor Template| Node.js |

References & Issues

Limitations

No verification for platforms-specific incompatible response combinations (i.e. multiple cards are not supported in a single Actions on Google response).