Create a news alerting app

Get the code View the demo

Summary

Built for developers familiar with JavaScript and Node.js who are interested in making a web UI with artificial intelligence APIs, this pattern uses the Watson Node.js SDK to mine recent news articles to send alerts about a product or brand using the Watson Discovery Service. Follow along and learn how to create a news app in Node.js to deliver custom alerts via email for specific products or brands mentioned in the news. The app can also alert users on brand sentiment and related products, as well as stock price changes.

Description

In this code pattern, we will build a Node.js web application that uses the Watson Discovery Service to access Watson Discovery News. Watson Discovery News is a data collection offered with the Watson Discovery Service. It is a data set of primarily English-language news content that is updated continuously, with about 300,000 articles and blogs added daily.

The focus of this code pattern is to monitor a product’s marketplace life cycle using the Watson Discovery service to intelligently alert when a product’s stance in the marketplace has changed. Users can receive periodic email alerts about a product or brand and how it’s perceived in the news. Alert tracking can be set up for the following areas:

  • The product
  • The brand
  • Related products and brands
  • Positive or negative product sentiment
  • Stock prices

We show the steps required to build a front-end management interface to search Watson Discovery News and a back-end service to periodically send alerts out related to customizable queries.

Flow

flow

  1. The user interacts with the back-end server via the app UI. The front-end app UI uses React to render search results and can reuse all of the views used by the back end for server-side rendering. The front end is using watson-react-components and is responsive.
  2. User input is processed and routed to the back-end server, which is responsible for server-side rendering of the views to be displayed on the browser. The back-end server is written using the Express Node.js web application framework and uses express-react-views engine to render views written using the React JavaScript component library.
  3. The back-end server stores subscription information in a Cloudant® NoSQL database for product tracking.
  4. The back-end server sends user requests to the Watson Discovery Service. It acts as a proxy server, forwarding queries from the front end to the Watson Discovery Service API, while keeping sensitive API keys concealed from the user.
  5. The Watson Discovery Service queries the Watson Discovery News collection for articles related to the product.
  6. The back-end server sends periodic updates to email.

Instructions

Ready to put this code pattern to use? Find the detailed steps for this pattern in the README.