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

botfuel-module-adapter-iadvize

v3.0.2

Published

iAdvize adapter module for Botfuel Dialog

Downloads

7

Readme

botfuel-module-adapter-iadvize

Iadvize Adapter for Botfuel

Installation

In your botfuel project, run :

npm install --save botfuel-module-adapter-iadvize

How to use the adapter

Create a new config file in the root directory of your project (eg: iadvize-config.js)

module.exports = {
  adapter: {
    name: 'iadvize',
  },
  modules: ['botfuel-module-adapter-iadvize'],
};

Supported messages types

  • Text messages
  • Quickreplies
  • Transfer (included in this module)
  • Close (included in this module)

Transfer action

To transfer to a distribution rule, include a TransferAction in the messages returned by your view:

const { View, BotTextMessage } = require('botfuel-dialog');
const { TransferAction } = require('botfuel-module-adapter-iadvize');

class TransferView extends View {
  render() {
    return [
      new BotTextMessage('I’m going to transfer you, please wait :)'),
      new TransferAction({
        botfuelRoutingRules: ['RULE_NAME_1', 'RULE_NAME_2', ...],
        // Transfer attempt failure message
        failureMessage: 'Sorry, nobody is available right now.',
        // Transfer attempt timeout, default 30 seconds
        awaitDuration: 20,
      }),
    ];
  }
}

Close event

With this Adapter the close event is automatically triggered at the end of bot responses and the conversation is closed if no more messages are sent during the time before the close event is triggered by iAdvize.

Configuration

You can configure 3 options in the config file of your for this event:

  • closeWarningDelay is the delay before the warning message will be sent
  • closeWarningMessage is the message that warn the user about the closing of the conversation
  • closeDelay is the delay after the warning message and before the close event is sent to iAdvize

The closeWarningDelay and the closeDelay are durations in seconds, they have to be numbers, their default values are both 30 seconds

The closeWarningMessage can be either a string or a function that take the closeDelay in parameter so you can easily customize the message displayed.

The configuration of this event is made under the adapter key in the configuration file of the bot:

module.exports = {
  adapter: {
    name: 'iadvize',
    closeWarningDelay: 30,
    closeWarningMessage: (delay) => `The conversation will be closed in ${delay} seconds`,
    closeDelay: 120,
  },
  modules: ['botfuel-module-adapter-iadvize'],
};

In this example, the user will receive the message "The conversation will be closed in 120 seconds" after 30 seconds of inactivity, and the conversation will be closed 120 seconds after the warning message if there is still no news messages from the user or the bot.

CloseAction

The CloseAction work the same way as the close event described below, it takes the same parameters as in the bot configuration but in that case you will configure and trigger the close event through a view.

To use it, include a CloseAction in the messages returned by your view:

const { View, BotTextMessage } = require('botfuel-dialog');
const { CloseAction } = require('botfuel-module-adapter-iadvize');

class TransferView extends View {
  render() {
    return [
      new BotTextMessage('I’m going to close this conversation.'),
      new CloseAction({
        closeWarningDelay: 10,
        closeWarningMessage: (delay) => `The conversation will be closed in ${delay} seconds`,
        closeDelay: 10,
      }),
    ];
  }
}

In this example, the user will receive the message "The conversation will be closed in 10 seconds" after 10 seconds of inactivity, and the conversation will be closed 10 seconds after the warning message if there is still no news messages from the user or the bot.

Default values

  • closeWarningDelay: 30 seconds
  • closeWarningMessage: "The conversation will be closed in a few seconds"
  • closeDelay: 30 seconds

Add a delay before your quick replies message

To add a delay before displaying the quick replies message you can add a delay option to the message

const { View, BotTextMessage, QuickRepliesMessage } = require('botfuel-dialog');

class DelayedQuickRepliesView extends View {
  render() {
    return [
      new BotTextMessage('I’m going to send quick replies with a delay of 500ms.'),
      new QuickrepliesMessage(['hello', 'world'], {
        delay: 0.5,
      }),
    ];
  }
}