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 🙏

© 2025 – Pkg Stats / Ryan Hefner

convo-builder

v0.2.1

Published

Easily build conversations for Twilio, Facebook Messenger, and more.

Downloads

127

Readme

convo-builder

Easily build conversations for Twilio, Facebook Messenger, and more.

Installation

Via NPM:

npm install convo-builder

You can also check out convo-builder directly from Git:

git clone https://github.com/shanepelletier/convo-builder.git

After cloning the Git repository, you have to install the node dependencies. Navigate to the root of your cloned repository and use npm to install all necessary dependencies.

npm install

Example

var convo = require('convo-builder');

convo.configure({
  port: 8145,
  twilio: {
    ACCOUNT_SID: '<YOUR_ACCOUNT_SID>',
    AUTH_TOKEN: '<YOUR_AUTH_TOKEN>',
    phoneNumber: '<YOUR_TWILIO_PHONE_NUMBER>'
  }
});

var greeting = 'Hi! Here\'s a survey your coach wanted me to send you.';

var messages = [
  'Did you eat cake at least once this week?',
  'What one food would you most like to eat next week?',
  'On a scale from 1 to 5, how happy were you with this week\'s meal plan?'
];

var conclusion = 'Thanks for answering my questions! Enjoy the rest of your day.';

var options = {
  provider: 'twilio',
  providerOptions: {
    phoneNumber: '<THE PHONE NUMBER YOU WISH TO MESSAGE>'
  }
};
  
convo.say(greeting, options, function (err) {
  convo.converse(messages, options, function (err, response, message) {
    if (!err) {
    console.log('The user\'s response to the message "' + message + '" was: ' + response);
    } else {
      console.log('An error occurred:');
      console.log(err);
    }
  }, function () {
    convo.say(conclusion, options, function (err) {
      console.log('The conversation has finished.');
    });
  });
});

Methods

convo.configure(configOptions)

Takes an object that is used to configure convo-builder and the providers.

Available options:

{
  port: <Port number to listen for messages on>
  twilio: {
    ACCOUNT_SID: '<Twilio account SID>',
    AUTH_TOKEN: '<Twilio auth token>',
    phoneNumber: '<Twilio phone number>'
  },
  messenger: {
    VERIFY_TOKEN: '<Verify token for Facebook messenger>',
    PAGE_ACCESS_TOKEN: '<Page access token for Facebook messenger>'
  }
}
convo.say(message, options, callback)

Send the user a message using the provided options, takes an optional callback that runs after the message has been sent.

convo.converse(messages[], options, callback)

Sends the user an array of messages once at a time using the provided options, calls the provided callback with the user's response to each message in turn. Takes an optional callback that runs after all of the messages are sent.

Options for convo.say() and convo.converse()

{
  provider: '<Either messenger or twilio>',
  providerOptions: {
    phoneNumber: '<User phone number>' // For twilio
    recipientId: '<User facebook id>' // For Facebook messenger
  }
}