In this Code Pattern, we will build a satellite tracker using Node-RED and IBM Watson. A flow will be created for connecting a Watson Assistant Chatbot with a node-red-contrib-satellites node, as well as a web UI and worldmap node.
When the reader has completed this Code Pattern, they will understand how to:
- Build a complex flow and web UI using simple Node-RED tools.
- Implement a chatbot with Watson Assistant and embed it on a web page with Node-RED.
- Get satellite information for the International Space Station (ISS) and use it in a web app.
- User interacts with Web UI to query the chat bot "Where is the ISS?".
- Web UI communicates with Node-RED running on IBM Cloud.
- Node-RED app running on the cloud processes info and performs HTTP requests.
- The Node-RED app communicates with Watson Assistant to extract intents and entities.
- Satellites orbiting the earth send position info which is streamed to Node-RED module.
- Watson Assistant: Create a chatbot with a program that conducts a conversation via auditory or textual methods.
- Node-RED: Node-RED is a programming tool for wiring together hardware devices, APIs and online services in new and interesting ways.
- Artificial Intelligence: Artificial intelligence can be applied to disparate solution spaces to deliver disruptive technologies.
- Node.js: An open-source JavaScript run-time environment for executing server-side JavaScript code.
Clone the casis-satellite-tracker
locally. In a terminal, run:
$ git clone https://github.com/IBM/casis-satellite-tracker
Create the Watson Assistant service by providing a name of your choice and clicking Create
.
Once created, you'll see either the credentials for username and password or an IAM apikey, either of which you should copy down to be used later. (Click Show
to expose them).
Once you have created your instance of Watson Assistant, click Launch Tool
, then click the Workspaces
tab. Import the workspace by clicking the upload icon:
Click Choose a file
and navigate to data/workspaces/SatTrackWorkspace.json
in this repo. Click Import
.
Get the Workspace ID by clicking the 3 vertical dots on the Workspaces
tab. Save this for later.
The credentials for IBM Cloud Watson Assistant service can be found
by selecting the Service Credentials
option for the service. You
saved these in step #2.
The WORKSPACE_ID
for the Watson Assistant workspace was saved in
step #3.
From the the IBM Cloud Catalog navigate to Platform
-> Boilerplates
and choose Node-RED Starter. Choose a name and click Create
.
Once the App has deployed, click on Visit App URL
Follow the instructions to Secure your Node-RED editor
and Browse available IBM Cloud nodes
. Click Finish
and then click Go to your Node-RED flow editor
.
You will need an API key from LocationIQ for the reverse geocoding function in this app.
- Visit the LocationIQ website and scroll down to
Excited?! Get a developer token!
. Input your name and email and follow the instructions to get an API token. Save this for later, when you configure thecredentials
node.
You will need to install the following additional nodes:
Click the menu icon in the upper right and then Manage palette
.
Click the Install tab
and enter the name of the node you wish to install into the search bar, then click install
.
Follow these instructions to Build the Node-RED flow manually.
We will walk through the steps to build the Node-RED flow, but you can import the completed Flow. Copy the flow to your machine's clipboard by navigating to data/Node/
.
A flow can be moved to a Mac OS clipboard with:
$ pbcopy < ISS_flow.json
On Windows use:
$ cat ISS_flow.json | clip
On Linux use:
$ cat ISS_flow.json | xclip
Once the ISS_flow.json
is on your clipboard, Click the upper-right menu icon and choose Import
-> Clipboard
. Paste the contents of your clipboard and click Import
.
- Artificial Intelligence Code Patterns: Enjoyed this Code Pattern? Check out our other AI Code Patterns.
- AI and Data Code Pattern Playlist: Bookmark our playlist with all of our Code Pattern videos
- With Watson: Want to take your Watson app to the next level? Looking to utilize Watson Brand assets? Join the With Watson program to leverage exclusive brand, marketing, and tech resources to amplify and accelerate your Watson embedded commercial solution.