If you're in in the git repository, you can check out the documentation here!
The aim of this project is to build a news mining application using Node-RED (Node.js) to create a web application, along with using IBM Cloud for the deployment and IBM Watson's Discovery Service for adding the API for fetching news and gaining the sentiment of that news article. Also, Slack has been integrated with this service for quick access to the news.
- Report 📈
- Flow 🔄
- Website 💻
- Video Presentation 📹 -- Transcript
- Internship and Platform Review Video 📹 -- Transcript
There are three ways to host and use this project, as given below:
- Create an IBM Cloud account.
- Go to the catalog and add these services - Discovery and Node RED*. Another service would be added automatically for continuous integration.
- Create a cloudant and assign it 256MB space (which is the maximum amount provided for a Lite account.
- Go to your Resource List and find the Node RED service. Click on it and reduce the assigned space to 128MB.
- Visit the App URL and set up the app with Node RED and it's nodes. Install the Dashboard nodes in the manage palette and manage the UI and order of nodes in the dashboard section.
- You can join nodes and make them recognise each other with function nodes, since you can add JSON to convert the values of the nodes.
- Install the Discovery Node too, since it's the node that corresponds to the Watson Discovery News Service.
- Commplete the Node-RED flow and deploy the nodes.
- Access the UI by taking the app's URL and typing /ui beside it.
eg:
https://getthenews.eu-gb.mybluemix.com/red
can be used to access the nodes used in the application, whilehttps://getthenews.eu-gb.mybluemix.com/ui
can be used to access the application's User Interface. - You're done! Congratulations on deploying your web application to the cloud!
- A simple
git clone https://github.com/ibm/watson-discovery-news
on the git bash terminal would clone the project to your computer. - Following that command with the one below, you can start the application in your browser and view the application in your local browser.
cd watson-discovery-news
npm install
npm update
npm start
- If you have already deployed it using the cloudant service in IBM as given above, there is no need for this, unless you want to integrate it with Slack, for which you can follow the steps below.
- Follow the steps above to locally deploy IBM's watson-discovery-news repo on your computer, till
cd watson-discovery-news
. - Then, copy the environment file using
cp env.sample .env
if you are a Linux/MacOs user orcopy env.sample .env
if you are a Windows user. - Create your Watson Discovery Service as done in Procedure #1 above.
Then, locate the service credentials listed on the home page of your Discovery service and click on the
Download
icon. - Open up the downloaded file in any text editor and copy all the credentials.
- Open up the
.env
file in the folder with the cloned repo, open it and paste all the credentials. - You can delete all the extra credentials other than
SLACK_BOT_TOKEN=
. - Now, all that is left to do is configuring Slack. Integration is only possible in an existing Slack team, so navigate to
https://<my.slack.com>/apps/manage/custom-integrations
, where<my.slack.com>
is the workspace you want to add the bot to. - From this page (Custom Integrations), selec the Bots option.
- Select the Add Configuration button to add a new bot.
- Enter a unique username for the bot and click on Add Bot Integration.
- Once the bot is created, the API token is generated! Copy this API token and paste it in the .env file, where
SLACK_BOT_TOKEN=
is given. - Save the
.env
file, and continue on the terminal by typing these commands:
npm install
npm start
- Now, go to your Slack workspace, look for your bot and have a conversation with it!
@user> hi
@get_the_news> Hello.
@user> news please
@get_the_news> Hi there! What news are you interested in?
@user>covid19
@get_the_news> You want me to search news about covid19?
@user>yes please!
@get_the_news> *returns three relevant news articles with cover images and source urls successfully*