Code Monkey home page Code Monkey logo

symfuny-chat-bot's Introduction

Symfuny Chat Bot

Getting Started

There are three requirements to use instal the Symfuny Chat Bot, you must have node.js, mongo and redis installed. To run this bot locally, you can install these with default options.

There are two node.js processes that need to be run. The first is the bot itself, the second is the configuration application that runs as a Symphony Extension app.

To run these, first clone this repository. At a shell prompt switch to the applications directory. Enter these commands:

npm install
node server

This will setup and run the application. You only need to do the first command once.

At another shell prompt switch to the bot directory, and enter these commands:

npm install
node bot

This will run the bot.

For the last step, run the Symphony Extention app in developer mode using the provided Bundle file. For example,

https://podname.symphony.com/?bundle=https://localhost:8080/bot/assets/json/bundle.json

About

This application was written using the Sapphire framework. This framework was specifically designed for writing single page applications, with a minimum of fuss. See the documentation for more information.

Sapphire TL;DR

The full documentation of the Sapphire framework is linked to above. Here are a few key concepts to understand the code.

Server Side and Client Side

A Sapphire application exists on both the server side as well as the client side. The server side builds the application that will be sent to the user's browser. This is done by specifying all the different parts of an application, for example the HTML, JavaScript and CSS files.

The Sapphire framework takes this description of your application and generates the HTML that is sent to your browser.

Also done on the server:

  • "features" are encapsulated descriptions of parts of an application. For example, the header of an application could be implemented as a feature. In a feature, all the markup, javascript, css and other pieces of an application are all located within the feature subdirectory. Features have the advantage of being reusable.
  • minification of css and html based on configuration or a query string parameter. Using a query string to turn minification on and off makes it easier to diagnose problems in a production environment.
  • gzipping of server responses
  • built in CSRF protection.

The client side of an application is all the code that runs in the browser. The Sapphire framework has a number of features for building browser based applications.

For example:

  • Pages are pieces of user interface that can be swapped out for different application states. For instance, in an application with tabs, each tab would be implemented in a different page.

  • Dialogs are pieces of user interface that present a modal state that must be completed before the application can continue.

  • Models are classes that communicate with the server using an AJAX interface.

  • Hot loading of pages and dialogs

  • Templates are reusable HTML elements that are managed by the framework. For example, in a list of news items, a single item would be represented as a template that would be cloned and added to the DOM for each unique news article.

Directory Structure

At the top level of a Sapphire installation is a directory named apps. All applications served by Sapphire will be here, with one directory per application. The name of the directory will be the url to reach it. For example, if running the server on localhost:8080, to access the application under apps/ticker use the url http://localhost:8080/ticker.

Inside each application directory is a js file with the same name. So for the ticker app there would be a file named apps/ticker/ticker.js. This file exports a single function named getApplication. This function takes http request and response parameters and returns a Q promise will be resolved with an Application object. See the Sapphire documentation for more details.

In Sapphire all the files that can be downloaded to a browser are in a directory named /assets. This directory is usually further broken down into asset types, for example, css, js and images.

However, the top level assets directory is not the only place where application assets might be. Features, pages and dialogs exist in their own subdirectories of the application and have their own assets folders.

All features are in a directory named features, each subdirectory of this is a single feature. Similarly pages are in pages and dialogs are in dialogs.

Contributing

  1. Fork it (https://github.com/symphonyoss/symfuny-chat-bot/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Read our contribution guidelines and Community Code of Conduct
  4. Commit your changes (git commit -am 'Add some fooBar')
  5. Push to the branch (git push origin feature/fooBar)
  6. Create a new Pull Request

License

The code in this repository is distributed under the Apache License, Version 2.0.

Copyright 2017-2019 Symphony LLC

symfuny-chat-bot's People

Contributors

ondoher avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.