feedbackflow

1.0.1 • Public • Published

Overview

Send and receive feedback through your bot using FeedbackFlow.io.

This library currently support Slack bots built using Botkit. It will expand in the future to include support for other bots built in botkit and also other bot frameworks.

Getting Started

1. Install npm module for feedbackflow.

npm install --save feedbackflow

2. Initialize feedback flow with your token from FeedbackFlow.io.

After you've initialized your botkit controller, initialize FeedbackFlow with your API token from FeedbackFlow.io.

const feedbackflow = require("feedbackflow");

// Configure your slack bot using botkit.
const controller = botkit.configureSlackApp(/* ... */);

const feedback = feedbackflow({
  token: "<your api token from feedbackflow.io>",
  controller: controller
});

3. Setup webhook to deliver your replies directly to your users.

This is the webhook that FeedbackFlow.io calls when you respond to user feedback.

const feedbackflow = require("feedbackflow");

const controller = botkit.configureSlackApp(/* ... */);

//
// Initialize feedback with token
// you received at FeedbackFlow.io
//
const feedback = feedbackflow({
  token: "<token from feedbackflow.io>",
  controller: controller
});

controller.setupWebserver(5000, (err, server) => {
  //
  // Setup receive hooks for FeedbackFlow
  //
  feedback.setupReceiveWebhook(server);

  // ... normal handlers for botkit.
  controller.createWebhookEndpoints(server);
});

4. Collect user feedback using built-in conversation.

To collect feedback from your bot users you can use our built-in conversation.

import feedbackflow from "feedbackflow";

const controller = botkit.configureSlackApp(/* ... */);
const feedback = feedbackflow({
  token: "<token from feedbackflow.io>",
  controller
});

//
// Setup a conversation handler for when someone sends your bot
// a message saying "send feedback".  This will run a conversation
// that collects your users feedback and sends it to FeedbackFlow.io
//
controller.hears("send feedback", "direct_message", feedback.conversations.sendFeedback);

(optional) Custom Feedback conversations.

If you'd rather control the conversation used to gather feedback from your users you can call FeedbackFlow.io directly.

const feedbackflow from "feedbackflow";

const controller = botkit.configureSlackApp(/* ... */);
const feedback = feedbackflow({
  token: "<token from feedbackflow.io>",
  controller
});

controller.hears("send feedback", "direct_message", (bot, message) => {
  bot.startConversation(message, (err, convo) => {
    convo.addQuestion("What feedback would you like to send?", (resp, con) => con.next(), {
      key: "feedback"
    });

    convo.on("end", con => {
      if (con.status === "completed") {
        const feedbackText = convo.extractResponse("feedback");

        //
        // Once you've collected feedback in your conversation
        // you can send it directly to FeedbackFlow.
        //
        feedback.send(con, feedbackText);
      }
    });
  });
});

Readme

Keywords

none

Package Sidebar

Install

npm i feedbackflow

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

21.5 kB

Total Files

4

Last publish

Collaborators

  • thejls