Integrating Slack Commands with API Connect and OpenWhisk

This is part 1 to build an event management application called EventQuarry, integrated into Slack, using API management, event-based APIs in OpenWhisk, Google Sheets API, IBM Watson to create a Conversation bot.

  1. Create API Connect API v1.0.0
  2. Publish the API
  3. Create an OpenWhisk action
  4. Connect API Connect to OpenWhisk


This tutorial uses the OpenWhisk service and the API Connect service on, the IBM Cloud. Create an account on IBM Bluemix to run this tutorial.

1. Create API Connect API v1.0.0

  • Go to the Bluemix Catalog, find the API Connect service,
  • Create the API Connect service and open the API Connect service, this will take you by default to the ‘Drafts’ view in the ‘Designer’ perspective,
  • In the ‘Drafts’ view there are a ‘Designer’ and an ‘Explore’ perspective,
  • In addition to the ‘Drafts’ view, there is a ‘Sandbox’ view in the ‘Catalog’, which is where you see the ‘Products’. Currently, there are no Products yet, we only created a Draft,
  • Open the API Connect Drafts
  • Add a New API titled ‘<username>-slackapp’
  • Title: ‘<username>-slackapp’
  • Name: ‘<username>-slackapp’
  • Base Path: /slackapp
  • Version: 1.0.0

  • Click the ‘Create API’ button,
  • In the ‘Design’ tab, click the ‘Paths’,
  • (more…)

    Easy Web Application Development for Beginners with Node-RED (2)


    In this tutorial I will create a Node-RED server application that will process a request from a client web form. The server will save the request data in a NoSQL database.


    You must have:

    • Access to a Bluemix account.

    1. Create a Node-RED Starter Application

    Start to create a Node-RED Starter server application. A client application sends a form request to the Node-RED server, the server processes the form data and sends a response back to the client.

    Node-RED is a so-called visual workflow editor, which lets you create an application workflow by dragging and dropping visual nodes onto an editor.

    Creating a Nodejs App with Watson AlchemyAPI and CloudantDB




    1. Setup
    2. Setup Details
    3. Add Watson AlchemyAPI
    4. Add Cloudant DB


    1. Login to Bluemix, in a separate tab login to Github,
    2. In Bluemix open Catalog->Boilerplates and create a ‘Node.js Cloudant DB Web Starter’ Boilerplate, named ‘<username>-nodejs-app1’, click CREATE
    3. Go to ‘Overview’, scroll down to ‘Continuous delivery’ and click ‘Enable’
    4. In the ‘Toolchain Settings’, change the name of the Toolchain to ‘<username>-nodejs-app1’, and click Create,
    5. If the Github THINK or CODE icon displays a configuration error, from the block’s dropdown icon in the topright, click the ‘Configure’ link to correct the configuration of your Github account,
    6. Go to your Github account and make sure that the repository for the new Bluemix app is created successfully,
    7. Copy the Git URL, on localhost open a commandline terminal, change to your development directory and clone the new repository,
      cd ~/dev/src/bluemix
      git clone
      cd remkohdev-nodejs-app1
    8. Open the project directory in your favorite editor,
    9. Open the ‘package.json’ file and change the ‘name’ property to ‘<username>-nodejs-app1’,
    10. From the commandline, in your project directory,
      git status
      git add .
      commit -m "change package.json name property"


    Getting Started: Creating a Java-Liberty App with Watson on Bluemix

    An extended version of this tutorial, adding a Cloudant NoSQL Database and D3js data visualization, is available here.


    • Bluemix account
    • Github account


    1. Create the StarterApp
    2. Add the Toolchain or Continuous Integration (CI)
    3. REST API Primer
    4. Authentication in REST API
    5. Getting the Bluemix Configuration
    6. Add the AlchemyData News API Client
    7. Add a Web Form
    8. Implement the AlchemyData News API Request
    9. Create Authorization Header for Basic Auth

    1. Create the StarterApp


    Creating a Java-Liberty App with Watson AlchemyAPI, CloudantDB and D3js


    • Git
    • Github account
    • Java
    • Eclipse for J2EE
    • WebSphere Liberty with JavaEE7
    • WebSphere Liberty plugin for Eclipse
    • Add * to the WepSphere Liberty Profile (wlp) server’s Java Key Store (JKS)
    • Optional: WAS AdminCenter 1.0
    • Optional: Maven


    1. Create the StarterApp
    2. Add the Toolchain or Continuous Integration (CI)
    3. Setup Localhost
    4. Add JSPs and Servlet for News Search
    5. Add REST API that calls the AlchemyData News API
    6. Save the AlchemyData News Search Results in CloudantDB
    7. Add a D3js Sentiment Score Graph
    8. Configure the CloudantDB for Querying
    9. Show History of Search Results

    1. Create the StarterApp

    1. Sign in to,
    2. Go to Catalog,
    3. Under ‘Boilerplates’, click the ‘Java Cloudant Web Starter’,
    4. For ‘App name’ and ‘Host name’ enter ‘<username>-liberty-watson’,
    5. Click the ‘Create’ button,
    6. In ‘Application Details’ click the ‘Overview’ link,
    7. Review the application configuration,
    8. Click ‘Connections’ and click ‘Connect New’ to create the following services:
    9. If no AlchemyAPI service already exists, create a new AlchemyAPI service by clicking the ‘Connect New’ button,
    10. from the Catalog, filter by ‘Watson’, select the AlchemyAPI service, click the ‘Create’ button, and click ‘Restage’
    11. Note: by default you can only create 1 instance of the AlchemyAPI service under your organization in a single space, creating a second instance or connecting an existing service in another space will cause an error. If an instance already exists, click the ‘Connect Existing’ instead, select the existing AlchemyAPI service and click the ‘Connect’ button, click ‘Restage’,

    2. Add the Toolchain or Continuous Integration (CI)


    Creating Sentiment Line Chart for the News with Watson, Python, and D3js

    You must have Python installed. Check to see if you have Python installed from the commandline:
    python --version

    Table of Contents:

    1. Create a Starterapp
    2. Git Clone and Setup
    3. Create Additional Folders and Files
    4. Commit and Push Changes to Repository, Build and Deploy
    5. Create an AlchemyAPI service
    6. Create a Cloudant NoSQL service
    7. Add the Basic Workflow for Request-Response
    8. Get News using AlchemyAPI
    9. Create Helper Functions
    10. Save Responses in Cloudant
    11. Parse Response for D3js
    12. Draw the Line Chart in D3js

    You can import AlchemyAPI requests into Postman with this Postman collection.

    The source code for the application can be viewed or cloned from Github.

    1. Create a Starterapp

    1. Go to Catalog > Boilerplates
    2. Click the ‘Python Flask’ starterapp
    3. For name enter <username>-newssentiment
    4. Go to Overview
    5. Under ‘Continuous Integration’ click ‘Add GIT Repo and Pipeline’ to add a DevOps platform, select ‘Populate the repo with the starterapp packageand enable Build & Deploy pipeline’ > Click Continue > Click ‘CLOSE’.
    6. Click ‘EDIT CODE’.
    7. The very first time you login to the ‘DevOps’ environment you will need to pick a username for the ‘DevOps’ environment.
    8. In the left menu of icons, click the top folder icon, and click ‘Git URL’ to copy the Git repository url.
    9. If you prefer to edit in the online editor in Bluemix, click ‘EDIT CODE’ button and then click the second pencil icon in the left menu of icons.
    10. I will continue to work on localhost instead.


    Easy Web Application Development for Beginners with Node-RED


    The objective of this tutorial is to create two applications: a Node.js application that functions as a web client, and a Node-RED application that functions as the server. You will create an input form in the client that lets a user send a registration request to a server. The server will save the registration in a database and send a spoken response back to the client using IBM Watson’s Text to Speech service.


    You must have access to a Bluemix account.

    1. Create a Client Application with SDK for Node.js

    First, I will create a Node.js web application, which will function as our client and we will create web pages to ask for user input. Technically, this client application is also running on a server, so it is perhaps confusing to call it a client, but in our scenario and architecture, this client application functions as the user interface that initiates the request to a processing server.

    1. Go to and click to ‘LOG IN’ button to log into your Bluemix account,
    2. If this is the first time you log in, Bluemix will ask to create an organization and a space. You can create multiple spaces, for instance a different space for each
    3. Click the ‘CATALOG‘ menu on the top right of the page,
    4. To create a Node.js based application with the ‘SDK for Node.js’, find the ‘SDK for Node.js’ in the ‘Runtimes’ section and click the icon,
    5. (more…)

    QAVideos (3) – Extending the Data Model and Using Open API Initiative (OAI) in Node.js

    (updated: 20170319) WIP
    This is part 3 in a series to build a sample application called QAVideos using API Connect. QAVideos is a Question and Answer application that uses videos instead of text. Think of QAVideos as StackOverflow meets Youtube. QAVideos will use LoopBack, API Connect, Open API Initiative (OAI formerly, OpenWhisk, Object Storage.

    • In part 1 ‘QAVideos (Part 1), Adding User Management to Node.js’, I added User Management to a Node.js app using API Connect.
    • In part 2 ‘QAVideos (Part 2), Adding a Custom Model and ORM in Node.js‘, I added a custom data model, i.e. a Video model, and used ORM to persist the model to a PostgreSQL database.
    • In part 3 ‘QAVideos (Part 3), Extend Model and Using Open API Initiative (OAI) in Node.js‘, I extend the built-in User model with a Member, add a Question and Answer based on the Video model, and add a Sticker, while using the Open API Specification to define and manage the application and APIs.
    • In next parts, the idea is to add other possibly features: deploy the OAI definition file to Bluemix via API Connect, add Object Storage for Video support, create an Ionic/Apache Cordova based mobile client, add an automated build, deployment and test script, add a Content Delivery Network (CDN) to the backend, add event-driven OpenWhisk APIs, containerize the application, add chat, and possibly more.


    • Node, npm, and API Connect must be installed,
    • Check if the ‘apic’ tool is installed, by running ‘apic -v’ from the commandline. If not installed, follow the installation instructions, here.
    • Get the source code from part 2 of this tutorial.
    • Test if QAVideos (part 2) is running correctly by typing ‘apic start’ in the root directory, open a browser and go to ‘’ in your browser.

    Table of Content

    1. The OAI Definition File
    2. Create the Extended Data Model

    Open API Initiative (OAI, based on Swagger)

    The OAI is based on, an API Framework. The OAI is an open API definition standard. Frameworks like API Connect use the OAI definition file to generate the server, client, data model and documentation.


    Using MQTT to publish data and send commands for IoT

    MQTT is a publish-subscribe messaging pattern with a light-weight footprint, ideal for IoT devices. This tutorial will create a basic workflow via an MQTT Broker from device client to application server and back. To avoid any hardware dependencies in this tutorial I will simulate the device client and implement it as a Node.js server. The application server will also be a Node.js server.

    1. Requirements
    2. Setup an MQTT Broker
    3. Register a Device on the MQTT Broker
    4. Create an API Key on the MQTT Broker
    5. Create the IoT Device Client
    6. Create the IoT Application Server
    7. Publish Data from Client to Application via Broker
    8. Send Commands from Application to Client via Broker


    Setup an MQTT Broker

    The publish-subscribe messaging pattern of MQTT requires a message broker. One easy way to create one is to create an MQTT broker from a boilerplate application ‘Internet of Things Platform Starter‘ in Bluemix.

    QAVideos (2) – Add Custom Model and ORM to Node.js

    (updated: 20170318)
    This is part 2 in a series to build QAVideos. QAVideos is a Question and Answer application that uses videos instead of text. Think of QAVideos as StackOverflow meets Youtube. QAVideos will use LoopBack, API Connect, Open API Initiative (OAI formerly, OpenWhisk, Object Storage.

    In part 1 ‘QAVideos (Part 1), Adding User Management to Node.js with API Connect‘, I showed how to add User Management to a Node.js app using API Connect.
    In this part 2, I will add a custom data model, i.e. a Video model and use ORM to persist data to a PostGreSQL database.
    Part 3 (to be updated) is found here, which adds model extensions and uses Open API Initiative (formerly Swagger) support.

    Source code for QAVideos is released per part via


    • Install Node.js and npm,
    • Install API Connect.
    • Check if the ‘apic’ tool is installed, by running ‘apic -v’ from the commandline. If not installed, follow the installation instructions, here.
    • Get the source code for part 1 of this tutorial and follow the installation instructions for QAVideos Release v1.0.0. First clone the repository, then make sure you fetch all the remote tags to your local repository, and then checkout the v1.0.0 tag.
      git clone
      git fetch --all --tags --prune
      git checkout tags/v1.0.0

    Table of Contents

    1. Create Data Model
    2. Define Relation
    3. Adding ACL
    4. Add Video Functionality
    5. Add Data Source

    1. Create Data Model

    First, test if QAVideos (part 1) is running correctly. Open a commandline, change your directory to the root directory of your QAVideos application, type ‘apic start’, and browse to ‘‘ in your browser.

    Now, I want to add a custom model ‘Video’ so that users can manage their list of videos. To do this, I create a model for the Video with the ‘apic’ tool, and define the relationship between Video and User (a User can own many videos), and specify the access level of Users to Video objects using an Access Control List (ACL).

    %d bloggers like this: