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"


    Introduction to Cascading Style Sheets (CSS)

    Open an online editor with direct preview, e.g.


    1. What is CSS?
    2. Where to go next?
    3. Begin with an HTML page
    4. CSS syntax and CSS selectors
    5. External, internal, inline
    6. CSS color
    7. Default HTML tags, TRBL in margins, font styles
    8. The box model
    9. Table style
    10. Navigation lists
    11. Div and centering divs
    12. Floating divs
    1. What is CSS? Says who? The W3C maintains the CSS specification and browsers individually choose to comply to the standard and support each CSS feature.
    2. is a good place to start learning CSS.
    3. Begin with a default HTML page,

    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


    Add Serverless Programming and Data Integration on Bluemix

    Add Serverless or Event-Based Programming using OpenWhisk:

    1. Go to the OpenWhisk service at
    2. Click the ‘Develop’ button, which takes you to the Openwhisk editor,
    3. Create a new Action and implement the JavaScript function,
    4. At the bottom right, click the ‘View REST Endpoint’, and in the ‘cURL Example’, click the ‘Show Full Command’ to reveal the Base64 encoded authentication token for the OpenWhisk service,
    5. You can get the username:password credentials by installing the OpenWhisk ‘wsk’ command line and run:
      wsk property get --auth
      Or to Base64 encode it, run:
      wsk property get --auth | awk '{printf("%s", $3)}' | base64
    6. The way to call the OpenWhisk endpoint is using ‘Basic Auth’:<organization_id>_<space>/actions/<action>?blocking=true
    7. Then, for example:

      • Next create a new action and link the two actions together by Extending the first action and link it to the second action.
      • Next create an action to save the result to the Cloudant Database using the ‘Create Document’ action,
      • Next trigger the Slack notification

    Using Twitter data via DashDB:

    1. Create a DashDB service
    2. Create a Insights for Twitter service
    3. Open the DashDB dashboard > Load > Load Twitter Data > select the Twitter Service we created > Next
    4. In the Search for Twitter data: “#SEC posted:2016-11-01,2016-11-15”
    5. Click Get Tweet Count > Next
    6. Select ‘Load the data into new tables with this prefix:’ and enter prefix ‘SEC_Twitter’ > Next > Next > Finish


    Using public SEC data via DashDB:
    Download the SEC file for 2016Q3:

    1. Unzip the ‘’ archive,
    2. Load the 4 *.txt files: num, pre, sub, tag,
    3. Load > Load from Desktop > drop the file into the upload window,
    4. Change the separator character to ‘tab’,
    5. Don’t check the ‘Does the file have columns that contain dates or times? Yes No’, this may break the dataload sometimes, as the data is not always 100% cleaned correctly,
    6. Rename the tables so they have the prefix ‘SEC_2016Q3_’.

    Other datasets:

    • Pitney Bowes Geodata:
      1. Add the Pitney Bowes service to your Bluemix application
      2. Get AccessToken using OAuth2:
        curl -X POST -H "Authorization: Basic a2t2eetceteratVA==" -H "Content-Type: application/x-www-form-urlencoded" -d 'grant_type=client_credentials' ""
      3. Then call the PB service:
        curl -X GET -H "Authorization: Bearer vc84ZaccesstokenoK2" ""
    • WeatherCompany Data:
      1. Add the WeatherCompany Data service to your Bluemix application,
      2. Get the username and password from the credentials,
      3. Daily Forecasts:
        curl -X GET "https://<username>:<password>"
      4. Current Conditions:
        curl -X GET "https://<username>:<password>"
      5. Almanac (Historic Data):
        curl -X GET "https://<username>:<password>"

    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)


    Learning JavaScript 103 (wad-js-03)

    This is session 3 in Learning to Code, JavaScript 101 for Beginners to be held on October 24, 2016. Register here.

    For Learning JavaScript 101 (wad-js-01), see here.
    For Learning JavaScript 102 (wad-js-02), see here.

    You should have basic knowledge of HTML, a text editor like ‘sublime text’ installed, and a web browser.

    • Recap 101, 102
    • Lets code…
    • Go to and checkout step 1.
      git checkout js103-step1
    • Homework for session 4:
      • write the HTML coded articles of step 3 all in JavaScript.
      • Using JavaScript, add a Search, Login and Signup form and form validation and handling to the aside-tag.

    Learning JavaScript 102 (wad-js-02)

    This is lesson 2 in Learning to Code, JavaScript 101 for Beginners. For Learning JavaScript 101 (wad-js-01), see here.

    You should have basic knowledge of HTML, a text editor like ‘sublime text’ installed, and a web browser.

    Register here.

    1. Recap 101
    2. Data Types
      • Primitive types
        1. Number
        2. String
        3. Boolean
        4. Undefined
        5. Null
        6. Symbol (new in ES6)
      • (more…)

    %d bloggers like this: