All Projects → jseijas → flow-bot

jseijas / flow-bot

Licence: MIT license
Framework to make bots based on Microsoft Bot Framework.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to flow-bot

Botpress
🤖 Dev tools to reliably understand text and automate conversations. Built-in NLU. Connect & deploy on any messaging channel (Slack, MS Teams, website, Telegram, etc).
Stars: ✭ 9,486 (+67657.14%)
Mutual labels:  bot-framework, microsoft-bot-framework, bot-builder
BotBuilder.Standard
An unofficial CoreCLR targeted .NET Standard ported version of BotBuilder.
Stars: ✭ 22 (+57.14%)
Mutual labels:  bot-framework, microsoft-bot-framework, bot-builder
Botframework Sdk
Bot Framework provides the most comprehensive experience for building conversation applications.
Stars: ✭ 6,673 (+47564.29%)
Mutual labels:  bot-framework, microsoft-bot-framework, bot-builder
Botframework Emulator
A desktop application that allows users to locally test and debug chat bots built with the Bot Framework SDK.
Stars: ✭ 1,532 (+10842.86%)
Mutual labels:  microsoft-bot-framework, bot-builder
bot-message-routing
Message routing component for chatbots built with Microsoft Bot Framework C# SDK.
Stars: ✭ 53 (+278.57%)
Mutual labels:  bot-framework, microsoft-bot-framework
msbotbuilder-go
Microsoft Bot Framework SDK for Go
Stars: ✭ 113 (+707.14%)
Mutual labels:  bot-framework, microsoft-bot-framework
MyBot
🧠 Create chatbots easily with Bot Framework! 🤖
Stars: ✭ 30 (+114.29%)
Mutual labels:  bot-framework, bot-builder
hands-on-bots-node
Repositório responsável pelas vídeo aulas inerentes a nova série do canal: Hands on
Stars: ✭ 32 (+128.57%)
Mutual labels:  bot-framework, microsoft-bot-framework
nodejs-bot-platform
Node.js bot and personal assistants platform. Boilerplate, start point, tools, best practices for building bots and personal assistants.
Stars: ✭ 56 (+300%)
Mutual labels:  bot-framework, bot-builder
CodeConversations
Code Conversations was a Demo is Scott Hanselman's keynote at Microsoft BUILD 2020. Code Conversations was designed with one goal in mind - to see if we could bring the power of .NET Interactive into Microsoft Teams, to create a way for people to have collaborative conversations about small bits of code.
Stars: ✭ 109 (+678.57%)
Mutual labels:  microsoft-bot-framework
Wisty.js
🧚‍♀️ Chatbot library turning conversations into actions, locally, in the browser.
Stars: ✭ 24 (+71.43%)
Mutual labels:  bot-framework
rasa-docker-arm
Rasa Docker image for ARMv7. Runs on a Raspberry Pi.
Stars: ✭ 19 (+35.71%)
Mutual labels:  bot-framework
SysBot.AnimalCrossing
Animal Crossing: New Horizons bot using SysBot.NET
Stars: ✭ 54 (+285.71%)
Mutual labels:  bot-framework
botbuilder-community-tools
Part of the Bot Builder Community Project. Repository for tools relating to bot development using the Microsoft Bot Builder SDK.
Stars: ✭ 35 (+150%)
Mutual labels:  bot-framework
bkit
build a messenger bot using HTML
Stars: ✭ 36 (+157.14%)
Mutual labels:  bot-framework
gort
Gort is a chatbot framework designed from the ground up for chatops.
Stars: ✭ 381 (+2621.43%)
Mutual labels:  bot-framework
Nutgram
The Telegram bot framework that doesn't drive you nuts.
Stars: ✭ 206 (+1371.43%)
Mutual labels:  bot-framework
nestjs-telegraf
🤖 Powerful Nest module for easy and fast creation Telegram bots
Stars: ✭ 300 (+2042.86%)
Mutual labels:  bot-framework
botlin
Bot framework built with Kotlin
Stars: ✭ 20 (+42.86%)
Mutual labels:  bot-framework
nextcord
A Python wrapper for the Discord API forked from discord.py
Stars: ✭ 956 (+6728.57%)
Mutual labels:  bot-framework

Flow Bot Manager

The Flow Bot Framework is based on the Microsoft Bot Framework, but including some cool features and a way of defining the bots only describing the cards to the user and the dialog flow.

You can find examples of use at: https://github.com/jseijas/flow-bot-examples/

  • Persistance: A Persistance layer is added with the flow-storage component. Default storages developed are: memory, json files, loopback model. You can implement your own storages only implementing the FlowStorage abstract class.
  • i18n: A translation module is added. Instead of using "tag constants" you can use directly a default language.
  • Template: A template engine is added with Mustache. The template engine can be used even in the i18n literal. The template engine replace named variables from a view object that is automatically filled.
  • JSON Cards: Instead of building your cards programatically, you can use directly a JSON file for representing them. You can add texts, images, hero cards, thumbnail cards, prompts, choices,...
  • Menu Card: A menu card is a choice prompt that automatically route to other dialog states.
  • Multilanguage Choices: The choice prompts can be Multilanguage, and automatically the text of the choice is translated to a tag for the developer.
  • Automatic load of Cards: Define a folder where the JSON files of the cards are located, and the framework will automatically load them for you.
  • Automatic load of Actions: Define your actions separatelly into a folder. They will be automatically loaded into the framework using the name of the file as name of the action, so you can invoke them automatically from your dialogs.
  • Automatic load of Dialogs: Define your dialogs in the ".flow" format, and will be loaded from the folder.
  • Prompt variables: You can define prompt variables where the result of the prompt will be stored. The prompt variables can be assigned to the current user (the user id will be used) or to the dialog with the name. Example: "user.age" or "dialog.value".

Dialog Flow format

Example of use:

/ -> greetings.card, greetings.text, logsomething(), /help, /menu, greetings.goodbye
/help
/menu*
/prompts -> prompts.text, prompts.number, prompts.choice
/picture
/cards
/list
/carousel
/receipt
/actions

You can define a dialog simply putting the name, the symbol "->" and then the waterfall to be executed. The waterfall can have three type of actions:

  • Cards: put the name of the card.
  • Dialogs: put the name of the dialog. You can recognize them because the '/' at the beginning of the name. This will invoke the session.beginDialog passing the name of the dialog.
  • Actions: put the name of the action. You can recognize them becase the '()' at the end of the name. The actions will be invoked automatically binded to the bot, so you can use bot methods using the "this".

When a dialog has not waterfall defined, then is assumed that the waterfall is to call a card with the same name as the menu. This way, '/help' is equal to '/help -> help'

Card JSON format

Each card JSON file can contain an array of cards. The format of the cards is like this:

  {
    "name": "greetings",
    "type": "text",
    "text": "Hello world {{ message.user.name }}"
  }

A more complete example can be a menu:

  {
    "name": "menu",
    "type": "prompt",
    "prompt": "choice",
    "isMenu": "true",
    "variable": "dialog.pepe",
    "text": "What demo would you like to run?",
    "options": [
      { "tag": "prompts", "text": "Prompts" },
      { "tag": "picture", "text": "Picture" },
      { "tag": "cards", "text": "Cards" },
      { "tag": "list", "text": "List" },
      { "tag": "carousel", "text": "Carousel" },
      { "tag": "receipt", "text": "Receipt" },
      { "tag": "actions", "text": "Actions" },
      { "tag": "endDialog", "text": "Quit" }
    ]
  }

At the options we can see the difference between the text that is shown to the user and the tag that the developer can use internally. Also, the "isMenu" property converts this choice card into a menu card, so the tags are also the name of other dialogs. The options choosen by the user is stored in the variable defined, in this case in a dialog variable.

Use of the Flow Bot Framework.

The Flow Bot Framework is available via NPM.

npm install --save flow-bot

You can use express, loopback, hapi, restify... to expose your bot API as a service. In this example we use restify:

npm install --save restify

And then you can create a bot folder with your bot behaviour (cards, actions, dialogs, and translations), and put the following code in the index.js to create the bot:

const BotManager = require('flow-bot').default;
const restify = require('restify');

var server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 3978, function () {
   console.log('%s listening to %s', server.name, server.url); 
});
var opts = {
  defaultLocale: 'en',
  botPath: './bot'
};
server.botManager = new BotManager(opts);
server.post('/api/messages', server.botManager.connector.listen());

Creating a bot with the yeoman generator

First, install Yeoman and generator-flowbot using npm (we assume you have pre-installed node.js).

npm install -g yo
npm install -g generator-flowbot

Then generate your new project:

yo flowbot

Then you'll be able to create cards. A card is an interaction with the user:

yo flowbot:card

You can also create actions. An action is a javascript function that can be executed in a dialog pipeline:

yo flowbot:action

You can also create plugins. A plugin is a class that is instantiated as a singleton, and can be used by all the actions of the bot:

yo flowbot:plugin

Plugins

A plugin is defined as a class that is automaticaly instantiated as singleton, and that can be use anywhere in the code. You've one example of use in the example of natural language processing, where there is a plugin for the Alarm Service, so alarms can be created or removed form any point of the application, and also as being instantiated as singleton, it host a timer that triggers the alarms.

https://github.com/jseijas/flow-bot-examples/tree/master/bots/basics-naturalLanguage

Test your bot

You can use the Microsoft Bot Channel Emulator to test your bot

Define your Microsoft APP_ID and APP_PASSWORD

You can set them from the environment variables BOT_APP_ID and BOT_APP_PASSWORD or pass them in the opts of the BotManager when you create the instance:

var opts = {
  botAppId: '<YOUR APP ID>',
  botAppPassword: '<YOUR APP PASSWORD>',
  defaultLocale: 'en',
  localesPath: './bot/locales',
  cardPath: './bot/cards',
  actionPath: './bot/actions',
  dialogPath: './bot/dialogs'
};

Accessing the Microsoft Framework bot instance and connector

You can simply access the UniversalBot instance as the property "bot" and the connector as the property "connector", of the BotManager instance.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].