News API Integration Template

About this Configuration Guide

This guide covers setting up the News API (application programming interface) integration template. Using this guide, you'll explore how the News API integration template works. You'll learn how to install the template to your environment and how to build an application from it. Plus, you'll see how to customize the application to fit your needs.

Here’s a high-level overview of the elements:

Title Element Type Description

News API (Top Headlines)

Module

The form that end-users use to search for news stories. They can filter by country, sources, category, language, and keywords. This information is used to create a table with relevant search results.

News API

Module

The API module that populates news stories based on the end-user's search criteria. It acts as the connecting point between News API's database and the Top Headlines form.

News API

Service

A news aggregator that finds articles and breaking news headlines across the web. Its database contains current and historic news articles published by over 80,000 worldwide sources.

All images used in this guide are for illustrative purposes only. Images are subject to change without notice. All images are correct at the time of publication.

Overview

Typically, when you look for news articles on a specific subject, you use your browser's search engine. Depending on your search, various other results display that might not pertain to your searched topic. When you use a news aggregator, it focuses specifically on news and blog sources. You can add the News API your application so end-users can quickly find relevant news articles and blogs.

Features

With this template, you can:

  • Search for news articles and blogs.

  • Filter by country, sources, category, language, and keywords.

  • See all relevant results and article links in an organized table.

Requirements

To use this template, you must:

  • Have administrator-level access to an Unqork environment.

  • Retrieve an API key from newsapi.org.

What You'll Learn

In this article, you'll learn:

Adding the Template

Before you can build an application from this template, you must install the template to your environment. Then, you can visit your Library and build an application from your new template.

Adding the Template to Your Environment

To add the template to your environment:

1. At the top right of the Unqork Designer Platform, click Library.
2. Click Templates.
3. Click Marketplace.

You can also access the Marketplace at any time by visiting https://marketplace.unqork.io.

4. In the Search the Listings Directory field, enter News API.
5. Click the News API tile.
6. Click Install to Environment.
7. Click Install Template.

If you aren't logged in, you'll see a field for Environment URL and a Login button. Enter your environment's URL where you want to install the template. For example: [environmentname.unqork.io]. Click the Login button. Then, return to step 4 and click Install to Environment again. Follow the remaining steps as listed.

Now, you can use your newly installed template to create an application.

Creating an Application from the Template

After you add the template to your environment from Marketplace, you can use it to create an application. This template creates a module-type application.

1. At the top right of the Unqork Designer Platform, click Library.
2. Click Templates.
3. Find the News API template tile.
4. Click Create App from Template.
5. From the Workspace drop-down, select the destination workspace. This is where your application lives once created.
6. Enter your unique App Name. The App Path autofills as you type your App Name.
7. If you want a different App Path, enter it in the App Path field.
8. From the Style drop-down, select a preview style. A style specifies your application’s appearance in Express View. If left blank, your application uses your environment's default style.

You'll notice the App Type and App Entrypoint are grayed out. The template automatically takes care of these for you.

9. Click Create App.

The application opens in the workspace you specified. You land on the Modules tab of your application.

Your new application looks something like this:

When you create an application from the template, your module names automatically include the template ID and a time stamp. This is to prevent any duplicate module paths. You can change module names and module paths at any time. Any service or workflow you create with your template also has a template ID and time stamp.

And here's an example of a News API service in Services Administration:

How the Template Works

The News API Integration template is a Module Integration template. You can use this template to set up an integration between Unqork and the external News API service. The News API service populates business data into your application. First, you need to set up an account with News API and retrieve your API keys

How the News API Service Works

News API is a service that uses an API call to pull news articles and blogs from its database. In Express View, this data is presented in a single table.

How the News API (Top Headlines) Module Works

The News API (Top Headlines) module is the key feature of this template. It's also the front-end module for this template. In Express View, your end-user enters a country or source and clicks Refresh Results. All relevant articles and blog sources automatically display. This module also includes other filters to help end-users narrow down the results by category, language, or specific keywords. With each search, the Top Headlines table provides details about the articles and links to view the full document.

Here's how the module looks in the Module Builder:

And here's how it looks in Express View:

How the News API Module Works

The News API module does the back-end work for the template. After the end-user clicks Refresh Results in the front-end module, this API module fires. It sends the full search criteria to News API, so it can pull relevant articles and blogs. Then, the News API service sends a response back to the News API module. The best-matching articles and their details populate in the corresponding tables.

Here's how the module looks in the Module Builder:

Configuring the Template

Once you create an application from this template, you need to update some configurations. To use the template, you need to add the News API service in Services Administration. You need your API key from your News API account to make the service work.

Retrieving a News API Key

First, retrieve a News API Key from the News API website.

To retrieve a News API Key:

1. Navigate to the News API website: newsapi.org.
2. Click Get API Key.
3. In the First Name field, enter your name.
4. In the Email Address field, enter your email address.
5. In the Choose a Password field, enter a password of your choice.
6. Under You are..., select if you are an individual or business requesting the News API Key.
7. Select I'm Not a Robot.
8. Select I Agree to the Terms.

9. Click Submit.

Your News API Key displays for you to copy and save for later.

Configuring the News API Service in Services Administration

To access Services Administration:

1. At the top right of the Unqork Designer Platform, click Settings.
2. From the Settings drop-down, select Administration.
3. Under Integration, select Services Administration.

Now, add your credentials:

1. Scroll to the bottom of your Active Services list and click News API.

What if your environment has more than one News API service? Look for the service with the same template ID and time stamp as the template's modules.

2. Scroll back to the top of the page.
3. In the Header Value field, enter your API key from the News API website.

4. Click Save Changes.

Testing the Template

When you open the News API (Top Headlines) module in Express View, select either a country or news source from the drop-downs. Then, click Refresh Results. The Top Headlines table displays articles relevant to your search criteria. You can use the other filters to narrow it down further.

Removing the News API Integration Template

There are 3 steps to removing the template, and these can happen in any order:

  • Uninstall the template from your environment.
  • Delete the application you created from the template.
  • Remove the News API service from your environment.

Remove the Template from Your Environment

You might need to clean your environment and remove unused templates. The Unqork Library makes this easy. To uninstall a template from your environment:

1. At the top right of the Unqork Designer Platform, click Library.
2. Find the template to uninstall.
3. Click the ellipsis (...) in the template tile header.
4. Click Uninstall Template.
5. Click Yes, Uninstall in the confirmation modal.

You can visit the Marketplace and reinstall the template at any time.

What if you have an existing application built from this template and then uninstall the template from your environment? Your existing application remains unaffected. Also, it no longer has any ties to the template. So, let's say you reinstall a newer version of the template in the future. You can rest assured that the installation doesn't impact your existing application.

Delete Your News API Application

If you no longer need the application you created from your template, you can delete it. To delete your application:

1. Navigate to the Apps tab from an open workspace.
2. Find the application to delete.
3. Click the ellipsis (...) in the app tile header.
4. Click Delete.
5. Retype the provided text.
6. Click Yes, Delete.

Remove the News API Service from Your Environment

To remove your News API service from your environment:

1. At the top right of the Unqork Designer Platform, click the Settings drop-down.
2. Click Administration.
3. Under Integration, select Services Administration.
4. From the Active Services list, select the service to delete.
5. Click the Delete link. You’ll find this above the Active Services list.
6. At the Delete message, click OK.
7. At the Success message, click OK.

Resources