Creating and Deploying the Twitter Sentiment Analysis Front-end

Overview

This document explains how to work with the HTML-JavaScript front-end of the Twitter Sentiment Analysis web application. 

Downloading the Front-end File

You can download the HTML file from GitHub or click here. You need a text editor to edit the HTML file.

Modifying the Front-end File

After verifying that the API is working as expected, you can modify the URL in the downloaded HTML file. If you open the HTML file without modification, you are using the default Ultra URL provided by SnapLogic.

To change the default URL, modify the HTML file at line 43.


Alternatively, you can remove the Ultra URL and Token settings from the code block above and add your own URL and token in the code at line 113 and 114.

Open the HTML file using a browser and validate that the web application is working as expected.

Deploy your Web Application

Since the application is an HTML file, you can host the application using your own web server or a static web hosting service. In this instance, you choose to host the application on GitHub Pages. For information on how you can host your web application on S3, see Hosting a Static Website on Amazon S3.

Deploying your Web Application using GitHub Pages

For details on how you can deploy your web application using GitHub, see Creating Web Applications Using SnapLogic API

Understanding the HTML Code

Here's the complete HTML code used to create the front-end of the Twitter Sentiment Analysis web application:

 Click to view/expand

This file has the following components:

  • Header containing the jQuery, Bootstrap, and Popper libraries to be imported and the title of the application.

     Click to view/expand
  • Body containing the UI components such as textboxes and buttons.

     Click here to view the code snippet
    • Script containing:
      • Function to make the Ultra Task call.

         Click here to view the code snippet
      • The behavior when the Submit button is clicked.
        This includes displaying an in-process message ("Waiting for result from SnapLogic.") and messages for successful and failed executions.

         Click here to view the code snippet