Coder Social home page Coder Social logo

eva-library / channel-frontalweb Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 8.9 MB

In this document the steps necessary for the deployment of a web front are exposed, which connected to an eva bot, allows the publication and display of a bot.

JavaScript 0.89% TypeScript 68.05% HTML 13.54% SCSS 17.52%
angular channels eva webcomponent angular7 amazon aws

channel-frontalweb's Introduction

N|Solid

eva Frontend - Angular Elements

This document explains the necessary steps for the web frontend deployment connected to a eva bot. The frontend is developed in the Angular 7 framework with Angular Elements(web components) wich allows to include new HTML elements into a site, independent from framework.

1. Requeriments

  • Angular 7
  • Package install static-server
  • Amazon AWS account

2. Frontend web configuration

  • Open your IDE (as Visual Studio Code) to view the source code:

N|Solid

  • Open the project frontend-eva and open the terminal and execute the followings commands:
    $ npm install
    $ ng serve
    $ ng start
    $ ng build

3. AWS account configuration

This section will indicate the steps to configure the AWS account in order to create the Parameter Store and to create and connect your Access keys.

3.1 AWS account configuration

Security credentials allow you to authorize and associate your front end with an AWS account. To perform this configuration you must perform the following steps.

  • In the top right menu, go to the option My Security Credentials:

N|Solid

  • Then, select the option Access keys (access key ID and secret access key) and click in the button Create New Access Key:

N|Solid

  • Click in the button Download Key File (download the file for using after):

N|Solid

3.2 Parameter Store

For establish a connection between the web frontend and the bot must to create and configurate a parameter store inside AWS:

  • First, enter to the AWS administration console and insert the credential acess:

N|Solid

  • Then, it will show the following screen:

N|Solid

  • Find the option Systems Manager:

N|Solid

  • Then, select from the side menu the option Parameter store.

N|Solid

  • In this option, create a new parameter:

N|Solid

Here is an example of how to configure the parameters.

Input Value
Name The length of a parameter name, including the full ARN path, must be between 1 and 1011 characters.
Description(optional) Short description of the parameter to create.
Tier Standard - Advanced
Type The type of parameter to create (String - StringList - SecureString
Data type Data type of the parameter to configure.
Tags keywords
Value Code below
{"BOT_NAME":{
      "domain":[
         "URL_DOMAIN"
      ],
      "avatar":"URL_IMAGE_AVATAR",
      "avatar2":"URL_IMAGE_AVATAR",
      "before_you_go":"¡Gracias!",
      "bot_name":"BOT_NAME",
      "button_background":"#ff8300",
      "button_color":"#ffffff",
      "chat_input_hint":"Escribe tu consulta",
      "client_name":"CLIENT_NAME",
      "code":"BOT_NAME",
      "favicon":"URL_FAVICO",
      "feedback_greeting":"Gracias por responder la encuesta.",
      "feedback_message_01":"Para nosotros es muy importante conocer tu opinión sobre el servicio que te hemos brindado.",
      "feedback_message_02":"¿Qué tal ha sido tu experiencia con nuestro servicio?",
      "feedback_message_03":"¿Tienes un comentario u opinión? Escríbela a continuación",
      "feedback_send_button":"Enviar",
      "feedback_url":"satisfactions",
      "headers":{
         "API-KEY":"API_KEY,
         "Accept":"application/json",
         "BROWSER":"Chrome",
         "BROWSER-VERSION":"10",
         "BUSINESS-KEY":"123",
         "CHANNEL":"CHANNEL",
         "Content-Type":"application/json",
         "LOCALE":"LOCALE",
         "OS":"windows",
         "OS-VERSION":"10",
         "PROJECT":"PROJEC_NAME",
         "USER-REF":"USER_REF"
      },
      "logo":"",
      "offline":"Desconectado",
      "online":"En línea",
      "primary_color":"#EBF6FF",
      "secondary_color":"#F4F4F4",
      "show_customer_form":false,
      "text_button_color":"#ffffff",
      "text_header_color":"#ffffff",
      "text_primary_color":"",
      "typing":"Escribiendo...",
      "url":"URL_CONVERSATION",
      "welcome_message":"WELCOME_MESSAGE",
      "write_your_opinion":"Escribe tu opinión"
   }
}

N|Solid

  • Once all the fields have been configured, click in the button Create parameter and it will show the parameter created:

N|Solid

4. Generate Angular Elements

To pass to this item we must have resolved:

  • Parameters Store
  • Security credentials

4.1 Web Frontend Configuration

  • Open the local-config.service.ts file located in the path src/app/chat/services:

N|Solid

  • Add the two parameters generated in the option Access Key of AWS account:

     AWS.config.region = 'sa-east-1';
     let cred1 = 'Input_AccessKeyId';
     let cred2 = 'Input_AWSSecretKey';

    The parameter AWS.config.region appears in the option Last Used Region of the generated Access Key ID.

  • Then, go to the variable awsParamStore.getParameter and add the path of the parameter created. For example:

N|Solid

awsParamStore.getParameter( '/app/evachat/apikeydata', { region: 'sa-east-1' } )

4.2 Angular Elements Generation

  • Execute the following command for build the web component:

    $ npm run build:elements

    N|Solid

    This will generate a folder under the root folder called elements:

    N|Solid This folder contains the files eva-frontend.js and styles.css: N|Solid

  • For finish, copy the folder assets from the compiled project (dist) into the folder "elements" of the web component: N|Solid N|Solid

  • For testing the web component, go to the path of the folder elements and execute the following command:

    $ static-server

    Note: In case that static-server isn't configured, must to install it as described in https://www.npmjs.com/package/static-server

    N|Solid

5. Publish Angular Elements

We create the index.html file with the following structure.

<html lang="es"><head> 
   <meta charset="utf-8">
   <title>Angular Elements</title>
   <base href="/">
   <meta name="viewport" content="width=device-width, initial-scale=1">
   <link rel="stylesheet" href="styles.css"> <!-- Library css-->
</head>
<body> 
   <eva-frontend></eva-frontend> <!-- Tag Chatbot --> 
   <script type="text/javascript" src="eva-frontend.js"></script> <!-- Library js-->
</body>
</html>

channel-frontalweb's People

Contributors

enzonorambuenaq avatar

Stargazers

 avatar

Watchers

 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.