Noteworthy Programs Map

    @google/chat-sdk-dialogflow
    TypeScript icon, indicating that this package has built-in type declarations

    0.2.4 • Public • Published

    Dialogflow ES adapter for Google Chat bot toolkit

    Handler that forwards messages to Dialogflow ES.

    Note: This is not an official Google product.

    See googleworkspace/chat-framework-nodejs for general instructions on building bots with the SDK.

    Connecting Dialogflow ES to messages handlers

    Use the dialogflowHandler method to create a message handler that forwards requests to Dialogflow ES. Creating the handler requires the Google project ID and a language code (automatic detection of language not yet implemented.)

    // Respond to "@bot help"
    import {dialogflowHandler} from "@google/chat-sdk-dialogflow";
    
    bot.message(/help/, async (ctx) => {
      await ctx.reply({
        text: 'Here are some things you can try...'
      });
    });
    
    // Forwards all other messages to dialogflow
    bot.message(
      dialogflowHandler({
        projectId: process.env.GOOGLE_PROJECT_ID,
        languageCode: 'en',
      })
    );

    Install

    npm i @google/chat-sdk-dialogflow

    DownloadsWeekly Downloads

    0

    Version

    0.2.4

    License

    Apache2.0

    Unpacked Size

    11.7 kB

    Total Files

    8

    Last publish

    Collaborators

    • google-wombot
    • ofrobots
    • mrdoob