No-code tutorial: How to get sentiment score for news articles with Watson NLU and Parabola
Tags: nocode, tutorial, ibmwatson, api
Published: 2020-11-16 18:17:51

---
title: No-code tutorial: How to get sentiment score for news articles with Watson NLU and Parabola
published: true
date: 2020-11-13 23:57:54 UTC
tags: nocode, tutorial, Watson, api
canonical_url: https://maxkatz.org/2020/11/13/no-code-tutorial-how-to-get-sentiment-score-for-news-articles-with-watson-nlu-and-parabola/
---

Last week I published a video on how to [How to analyze news articles and get a sentiment score with Watson NLU without writing any code](https://dev.to/maxkatz/how-to-analyze-news-articles-and-get-a-sentiment-score-with-watson-nlu-without-writing-any-code-hgb). The video was a high-level overview of the no-code application. In this blog post I’m going to show you how to build this flow step-by-step.

[![](https://katzmax.files.wordpress.com/2020/11/watsonnlu_featured2.png?w=1024)](https://katzmax.files.wordpress.com/2020/11/watsonnlu_featured2.png)<figcaption>Parabola flow you are going to build</figcaption>

## Tools used

The tutorial is going to use the following tools:

- [Parabola](http://parabola.io): no-code platform
- [News API](https://newsapi.org/): API for searching news
- [Watson Natural Language Understanding](https://cloud.ibm.com/registration?cm_mmc=Inpersondirected-_-Audience+Developer_Developer+Conversation-_-WW_WW-_-Nov2020-max_katz-no_code_tutorial__how_to_get_sentiment_score_for_news_articles_with_watson_nlu_and_parabola-global-devadvgrp-sanfrancisco&cm_mmca1=000039JL&cm_mmca2=10010797) (NLU): API for analyzing news sentiment
- Google Sheets: to save the results

All tools have a free plan that you will be able to sign up and use. I’m assuming you already have a Google account and access to Google Sheets.

## Getting News API account

In this section you are going to sign up for a free [News API](https://newsapi.org/)account. News API provides API to get the latest news.

1. Go to [https://newsapi.org/](https://newsapi.org/) and create a free account. Once the account is created you will be able to see your API key here: [https://newsapi.org/account](https://newsapi.org/account)
2. You will be using **Top Headlines API** which you can find here: [https://newsapi.org/docs/endpoints/top-headlines](https://newsapi.org/docs/endpoints/top-headlines). 

```
https://newsapi.org/v2/top-headlines?country=us&apiKey=your_api_key
```

Feel free to change the country or set any other parameters.

This [page](https://newsapi.org/docs/endpoints/top-headlines) also shows you the results from calling this service (you can also test the API in a tool such as Postman or via a command line).

The next step is to create a Waston NLU service on IBM Cloud.

## Creating a Watson NLU service on IBM Cloud

In this section you are going to create a Watson NLU service which is available on the IBM Cloud. IBM Cloud offers a completely free (forever) account. It’s called a Lite account.

1. [Register for a free IBM Cloud account](https://cloud.ibm.com/registration?cm_mmc=Inpersondirected-_-Audience+Developer_Developer+Conversation-_-WW_WW-_-Nov2020-max_katz-no_code_tutorial__how_to_get_sentiment_score_for_news_articles_with_watson_nlu_and_parabola-global-devadvgrp-sanfrancisco&cm_mmca1=000039JL&cm_mmca2=10010797) (or click Log in on the same page to use an existing account)
2. You should be on the **Dashboard** page. Just in case you are not there, click [https://cloud.ibm.com/](https://cloud.ibm.com/)
3. Click **Create Resource** button
4. In the search field enter _NLU_ and select **Natural Language Understanding** from the list
5. Open the **Select a region** list and choose a region that’s closest to you. I’m in California so for me it will be Dallas
6. Next click **Create** button to create the service
7. Once the service is created, switch to **Manage** tab. On this tab you will see the service API key and its URL. You will use this information a little bit later

[![Watson NLU service on IBM Cloud](https://katzmax.files.wordpress.com/2020/11/watsonnlu-parabola-manage-2.png?w=1024)](https://katzmax.files.wordpress.com/2020/11/watsonnlu-parabola-manage-2.png)<figcaption>Watson NLU service on IBM Cloud</figcaption>

The next step is to start building the flow in Parabola.

## Using Parabola to build the flow (application)

First a quick introduction to Parabola.

### What is Parabola

Parabola is a no-code platform. It enables you to build flows (small application and automations) without writing any code. A flow consists of steps. Each step in a flow takes data as input, processes data and outputs data. Then this output is used as input for the next step and so on. Here is how Parabola describes its platform on the web site:

> Parabola is a drag-and-drop productivity tool that runs in your browser. We have a library of customizable, prebuilt components designed for ecommerce operations and marketing teams to pull in data, combine and transform it in bulk, and automatically take action.
> 
> <cite><a href="http://parabola.io" rel="nofollow">http://parabola.io</a></cite>

I look at it as a visual [serverless](https://www.ibm.com/cloud/learn/serverless) platform. Every step reminds me of a small serverless function that does something specific. The steps are connected together to build a flow or a small program.

### Registering for a Parabola account

The first step is to create a Parabola account. Go to [https://parabola.io/app/signup](https://parabola.io/app/signup) and create a free account.

Once the account is created, click **Add a new flow** button.

You are going to build a flow that looks like this:

[![Parabola flow you are going to build](https://katzmax.files.wordpress.com/2020/11/watsonnlu_featured2.png?w=1024)](https://katzmax.files.wordpress.com/2020/11/watsonnlu_featured2.png)<figcaption>Parabola flow you are going to build</figcaption>

The flow steps are:

1. **API Import**: invoke an API to get news (flow input)
2. **API Enrichment**: get sentiment score for each news article
3. **Select columns** and **Rename columns**: format the data
4. **Send to Google Sheets**: send results to Google Sheets document (flow output)

### Pull from an API step

The right side in the flow editor holds all the components (steps) you can use. You can find a step by searching for it. Start typing _api_:

[![](https://katzmax.files.wordpress.com/2020/11/watsonnlu-parabola-search.png?w=300)](https://katzmax.files.wordpress.com/2020/11/watsonnlu-parabola-search.png)<figcaption>Finding a step (component) in Parabola</figcaption>

Select **Pull from an API** and drag it on to the flow.

[![](https://katzmax.files.wordpress.com/2020/11/watsonnlu-parabola-pullfromapi-step.png?w=300)](https://katzmax.files.wordpress.com/2020/11/watsonnlu-parabola-pullfromapi-step.png)<figcaption>Adding a step to the flow</figcaption>

Double-click on the step to open its properties. Set the following properties:

- **Request type**: _GET_
- **API Endpoint URL**: _[https://newsapi.org/v2/top-headlines?country=us&category=general&pageSize=10](https://newsapi.org/v2/top-headlines?country=us&category=general&pageSize=10)_
- Add a custom header _x-api-key_ and set its value to your Newsorg API key
- **Top Level Key**: _articles_ 
  - This step unpacks your JSON arrays into nice into a nice table

Once you entered all the values, click **Show Updated Results** to invoke the API. Your actual results will be different but structure-wise will look like this:

[![](https://katzmax.files.wordpress.com/2020/11/watsonnlu-api-results.png?w=1024)](https://katzmax.files.wordpress.com/2020/11/watsonnlu-api-results.png)<figcaption>Pull from API step results</figcaption>

If you look at other columns in the table you will see a **url** column. This is the data (column) you are going to pass to Watson NLU to determine an article sentiment score in the next step.

### Enrich with API step

**Enrich with API** step takes every row and enriches it with an external API call. In this tutorial you need to pass the **url** column to Watson NLU service. Watson NLU service will then analyze the URL and return its sentiment score.

[![](https://katzmax.files.wordpress.com/2020/11/watsonnlu-service-manage.png?w=1024)](https://katzmax.files.wordpress.com/2020/11/watsonnlu-service-manage.png)<figcaption>Watson NLU service credentials on IBM Cloud</figcaption>

1. Find **Enrich with API** step and add it to the flow
2. Then make a connection from **Pull from API** to **Enrich with API**
3. Double click on **Enrich with API** to open its settings
4. For **API endpoint URL**, copy the **URL** value from Watson NLU service **Manage** tab and then also append _v1/analyze?version=2019-07-12&url={url}&features=sentiment_ to the end. The final value should look like this:

```
https://api.us-south.natural-language-understanding.watson.cloud.ibm.com/instances/ce7cf874-xxxx-xxxx-xxxx-xxxxxxxxxxxx/v1/analyze?version=2019-07-12&url={url}&features=sentiment
```

1. **Authentication**: _Username and Password_
2. **Username**: _apikey_ (as text value)
3. **Password**: copy the API Key from Watson NLU **Manage** tab
4. Click **Show Updated Results** button to test this step

[![](https://katzmax.files.wordpress.com/2020/11/watsonnlu-apienrich-step.png?w=1024)](https://katzmax.files.wordpress.com/2020/11/watsonnlu-apienrich-step.png)<figcaption>Enrich with API step</figcaption>

If you look in the **Input** tab you will see the input passed to this step. **Results** tab shows results after Watson NLU API is invoked. I scrolled the results table to see the columns added from invoking the Watson service. The data we want is in **api.sentiment.document.score** and **api.sentiment.document.label** columns.

In the next step you are going to format the data so we don’t export all data (columns) to Google Sheets.

### Select columns step

After the last step the table has 15 columns. But you don’t need all the columns. You are only interested in four of the columns. This step will allow you to continue working only with specified columns.

1. Add **Select columns step** to the flow and create a connection
2. Using **Columns to Keep** option select **title**, **url**, **api.sentiment.document.score** and **api.sentiment.document.label** columns

[![](https://katzmax.files.wordpress.com/2020/11/watsonnlu-select-columns.png?w=1024)](https://katzmax.files.wordpress.com/2020/11/watsonnlu-select-columns.png)<figcaption>Select columns step</figcaption>

In the next step you are going to rename columns.

### Rename columns step

You will rename two columns in this step.

1. Add **Rename columns** step on to the flow
2. Rename **api.sentiment.document.score** to _sentiment score_
3. Rename **api.sentiment.document.label** to _sentiment score label_

This step made column names consistent and more user-friendly.

[![](https://katzmax.files.wordpress.com/2020/11/watsonnlu-rename-columns.png?w=1024)](https://katzmax.files.wordpress.com/2020/11/watsonnlu-rename-columns.png)<figcaption>Columns rename step</figcaption>

Now that you have all the data and it’s formatted, the last step is to send it to Google Sheets.

### Send to Google Sheets step

In the last step you are going to send data in four columns to Google Sheets.

1. Add **Send to Google Sheets** step to the flow. 
2. Double-click to on the step to open its settings. You will need to allow Parabola to connect to your Google account
3. **File**: choose to which Google Sheets file to export to
4. **Sheet**: choose which sheet to use from Google Sheets file
5. **Export rule**: _Overwrite Sheet_ (This will overwrite each run. You can also append each run)

[![](https://katzmax.files.wordpress.com/2020/11/watsonnlu-googlesheets.png?w=1024)](https://katzmax.files.wordpress.com/2020/11/watsonnlu-googlesheets.png)<figcaption>Send to Google Sheets step</figcaption>

You are ready to run the flow.

### Running the flow

Let’s save all the changes and run the flow.

1. Before running the flow you need to save and update the live version. Click **Update Live Version** button
2. From the **Live** tab, click **Run Flow Now** button

Your page should look like this:

[![](https://katzmax.files.wordpress.com/2020/11/watsonnlu-live-page2.png?w=1024)](https://katzmax.files.wordpress.com/2020/11/watsonnlu-live-page2.png)<figcaption>Running the flow page</figcaption>

As the flow runs you will see each step highlighted during its execution.

In the **Scheduling Rules** section you can schedule the flow to run periodically. For example, once every hour or once a day.

If you look in Google Sheets, you should see the following (your actual news will be different):

[![](https://katzmax.files.wordpress.com/2020/11/watsonnlu-googlesheets-export.png?w=1024)](https://katzmax.files.wordpress.com/2020/11/watsonnlu-googlesheets-export.png)<figcaption>Exporting to Google Sheets step</figcaption>

The four columns in Google Sheets are the same columns (and names) from the Parabola flow. In the last column (sentiment score label) I added conditional format rules:

[![](https://katzmax.files.wordpress.com/2020/11/watsonnlu-googlesheets-conditions.png?w=264)](https://katzmax.files.wordpress.com/2020/11/watsonnlu-googlesheets-conditions.png)<figcaption>Google Sheets conditional formatting</figcaption>

## Summary

This tutorial showed you how to use Watson NLU service without writing any code. This no-code application gets the latest news articles, passes them to Watson NLU to get a sentiment score and the results are saved into a Google Sheets file. I mentioned this above, this application (or automation) can also be scheduled to run periodically. I hope you find this tutorial valuable. I’d love to hear your feedback in comments. If you have any other ideas for no-code applications – please let me know in comments.