Author Archives: remkohdev

Messenger2Watson(1): Connect Facebook to a Watson Chatbot

In Slack2Watson(1) and (2) I created a chatbot and integrated it into Slack Slash Commands. Now, let’s integrate the same chatbot into Facebook Messenger. To accomplish this I need to create a Facebook Application, add the Messenger Platform to my Facebook Application, create a Webhook, have admin access to a Facebook Page to generate a Page Access Token so I can send and receive messages send to the Facebook Page, and create the Node-RED flows to integrate the Facebook Messenger with the IBM Watson Conversation.

Steps:

  1. Create a Flow to Verify the Request for Webhook Edits in Node-RED,
  2. Create an Endpoint for the Redirect URL of the Webhook in Node-RED,
  3. Create a Facebook Application for the Messenger Platform,
  4. Enable Webhooks Integration with Node-RED,

Create a Flow to Verify the Request for Webhook Edits in Node-RED

To prepare the setup and configuration of the Facebook Application, the Messenger platform and Webhooks to enable a chatbot in Facebook Messenger, I will first create the Node-RED flows to implement the required server workflow.

The first flow is to verify the endpoint for the setup of the Facebook Application, using the ‘hub.challenge’ token.

  • Go to your Node-RED application on Bluemix at http://<username>-nodered-slackapp.mybluemix.net/,
  • Click the ‘Go to your Node-RED flow editor’ button,
  • If you’re not logged in yet, log in now,
  • Add a new flow tab and rename the flow ‘Facebook Messenger’,
  • To verify your endpoint during setup of your Webhook, or when you update an existing topic subscription of your Webhook, Facebook sends a GET request. The request will include:
    hub.mode=subscribe
    hub.challenge — a random string
    hub.verify_toke
  • Continue reading

Slack2Watson(2): Connect Slack to a Watson Chatbot with Node-RED

Using:

  • Slash Commands in Slack,
  • Watson Conversation service to create a ChatBot,
  • Node-RED to configure the Application Flow,

Using a chatbot, I want to automate the following scenario:

  1. user: Hello
  2. chatbot: Hello. Where are you?
  3. user: hi, i am at the Rubin Museum.
  4. chatbot: I love the Rubin Museum. Shall I give you some recomendations of my personal favorites?
  5. user: oh yes, I would love some recommendations.
  6. chatbot: do you like sculpture, paintings or ornaments?
  7. user: i prefer paintings!
  8. chatbot: ok, here are my favorite paintings at the Rubin Museum: a, b, c

Steps:

  1. Create the Watson Conversation for the Rubin Museum Scenario,
  2. Test the Conversation for the Rubin Museum Scenario,
  3. Setup Slash Commands in Slack,
  4. Create the Node-RED Flow to Watson Conversation,
  5. Add Token Validation of the Slack Request to Node-RED Flow,

Create the Watson Conversation for the Rubin Museum Scenario

  • Go to IBM Bluemix and login to your account,
  • To create the Watson Conversation, click the ‘Create Service’ button, which will take you to the Catalog, or
  • Go to the Catalog, Under ‘Services’ filter by ‘Watson’, or in the catalog browse to the Watson section,
  • Click the ‘Conversation’ service,
  • Agree or change the ‘Service name’ and the ‘Credentials name’, and click the ‘Create’ button,
  • Under the ‘Credentials’ tab, you will find the username, password, and workspace ID that you need later to configure access to the conversation service,
  • Click the green ‘Launch tool’ button,
  • First create a workspace, click ‘Create’, name the workspace ‘Watson2Slack-Workspace’, and click ‘Create’,
  • You are now in your Conversation workspace, and you should see 3 tabs: Intents, Entities, and Dialog,

    Continue reading

Erik Larson, The Devil in the White City (2004)

Erik Larson, The Devil in the White City (2004) 390p.

I have read ‘The Devil in the White City’ as a trilogy, together with ‘Nature’s Metropolis‘ and ‘The Jungle’, and the overlap and synergies between the three works is so insightful to understand the roots of modern America, which sprouted in the Gilded Age of Chicago. Americans in general have perhaps a short memory and a shallow desire to understand their history or present, as they are so energetically working to build their future, but as they strive thus forward, they fail to see the straight trail they leave behind. The history of Chicago is interestingly also transcending the contemporary spleen of American culture. ‘Nature’s Metropolis’ more than any other work perhaps, gives a more comprehensive insight into the shared destiny of the northern East Coast and the Great West and South. The history of Chicago is the stitching between the common descent, by opening the gap between the White City and the Black City, between the amazing wonders and creative forces of the American Dream on one hand and the devastating destruction and humiliation of the American Psyche on the other, by describing a meticulous history of the ‘World’s Columbian Exposition‘ of 1893 and a portrait of America’s first serial killer H.H. Holmes.

Looking forward to the feature movie with Leonardo diCaprio by Martin Scorsese.

Slack2Watson (1): Connect API Connect to Serverless OpenWhisk

‘Slack2Watson (1): Connect API Connect to Serverless OpenWhisk’ is part 1 of an application called Slack2Watson, which integrates a ChatBot into Slack and allows you to retrieve information about events via Slash Commands in Slack. In part 1, I will set up the ‘API Connect’ service and link the APIs in ‘API Connect’ to the OpenWhisk functions.

Integration is managed using API management in ‘API Connect,’ serverless or event-based APIs in OpenWhisk, and IBM Watson to create the Conversation bot. Some data is retrieved via Google Sheets API.

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

Requirements

This tutorial uses the OpenWhisk service and the API Connect service on http://bluemix.net, 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,
  • In the left menu select the ‘APIs’ category, and click the ‘API Connect’ service,
  • Click the ‘CREATE’ button to create the ‘API Connect’ service,
  • Click the ‘Sandbox’ icon to go to the Sandbox view with a list of products, which currently says ‘There are no products available in the selected catalog.’,
  • Go to the ‘Navigate to’ icon next to the ‘Home’ icon, and click ‘Drafts’, which will take you by default to the ‘Drafts’ view in the ‘Designer’ perspective,
  • In the ‘Drafts’ view, you see a ‘Products’ tab and an ‘APIs’ tab, click the ‘APIs’ tab,
  • Click the ‘ADD’ button and add a ‘New API’ titled ‘<username>-slack2watson’
  • Title: ‘<username>-slack2watson’
  • Name: ‘<username>-slack2watson’
  • Base Path: /slack2watson
  • Version: 1.0.0

Continue reading

Yu Hua, To Live (1993)

Yu Hua, To Live (1993), 250p.

Yu Hua “once heard an American folk song entitled ‘Old Black Joe,’ a song about an elderly black slave who experienced a life’s worth of hardships, including the passing of his entire family, yet he still looked upon the world with eyes of kindness, offering not the slightest complaint.” Hearing the folk song ‘Old Black Joe’ became the inspiration for ‘To Live’, in which an elderly Chinese man, Fugui, has passed a life of hardship including losing his entire family. Central to the story is also a wisdom by the grandfather of Fugui: the chicken becomes a goose, the goose becomes a lamb, the lamb grows up to become a sheep, the sheep becomes an ox. After the ox, there is communism.

It is really hard to read the book and determine if it is about the indestructible hope of man or if it is about the inevitable suffering of man. One certainty exists, life is beckoning death. “As the black night descended from the heavens, I knew that in the blink of an eye I would witness the death of the sunset. I saw the exposed and firm chest of the vast earth; its pose was one of calling, of beckoning. And just as a mother beckons her children, so the earth beckoned the coming of night.” One of the saddest books ever written, and yet anyone will find a moment of happiness. “In the end, it turned out all for the best.”

To Live (1994) by Zhang Yimou.

A Critique on Judeo-Christian Populism and Islam

Too often, I hear the claim by populists that Islam is a Trojan Horse in Western society, that the Islam is an enemy to Western values. The theory of a fundamental clash of cultures between Judeo-Christianity and Islam is the very pillar of Islamophobic popularism today. This co-called Strauss–Howe generational theory comes from amateur historians and populist authors William Strauss and Neil Howe from the US, who both see a war between Islam and the West as the ‘fourth turning.’ I studied history and am an amateur historian myself, but I believe in facts rather than ‘alternative facts’, in truths rather than convictions.

The true foundation of Modernist Western ethics and current social values however is not religion but happiness. As a humanist, I believe that the pursuit of happiness is what drives man. Man advances through learning. Happiness, Epicurus says, is the absence of physical and mental suffering. Happiness is ensured in Freedom and Democracy, which are the legal form of this pursuit. This pursuit of happiness requires, according to Lucretius, the seeking of truth. It is science, not religion, that is the foundation of the pursuit of happiness, and therefor the true foundation of Western modernist culture.

With the rise of populism claiming to be the true defenders of our Western values, it seems that we Western humanists of the 21st century do not know whom to fight. The left is easily cornered by the right to be defenders of Islam, and out of instinct too easily accepts this role. But humanists should understand that the anti-Islamic populists are not worse but equal enemies as is Islam. The left has become complacent and overconfident in its fight against religion.

When I grew up however, it was not Judaism or Christianity that shaped my thinking and my values, but a series of Western thinkers whose works radically opposed Judeo-Christian culture. Western modernist culture instead of being Judeo-Christian or welcome to Islam, is instead radically anti-religious. Continue reading

Of Queen and Peasant

For majesty a throne
She stands in grace alone
Her smile equally dosed
Decisively composed

The peasant has his land
He stands to serve her end
His honor is to bow
and serve he is endowed

The moon is to the sun
Not his own that is done
But in the bigger light
He shines a little bright

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

Objective

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.

Requirements

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.
Continue reading