Category Archives: nodered

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

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

Easy Web Application Development for Beginners with Node-RED

Objective

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.

Requirements

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 http://bluemix.net 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,
    bluemix-catalog-nodejs
  5. Continue reading