Tuesday, June 26, 2018

Enable Botkit Middleware for Watson Assistant for serverless actions

Slack chatbot with Watson Assistant
Last week I blogged about using Botkit Middleware to create a Watson-powered database interface. I pointed to a tutorial demonstrating a Slack chatbot for a SQL database (Db2). I described that it is relatively simple to replace the Conversation connector with Botkit Middleware. Today, I want to point you to some code I wrote to enable the server-side (serverless) actions in Watson Assistant.


Watson Assistant dialog actions


In the mentioned tutorial I utilize Watson Assistant dialog actions, programmatic calls from within a dialog step, to interface with Db2. That way, the data that is necessary to compose the chatbot answer can directly be pulled from the SQL database. In order to execute these actions, implemented with IBM Cloud Functions, the API key needs to be passed in for authentication and authorization. In the tutorial, I had modified the so-called "pre-conversation" method to obtain that API key from the execution environment and provide it to the dialog processing in a private context variable.

Now, I am using a similar approach with Botkit Middleware. In utilizing the "before" method, again the API key is obtained and passed in to Watson Assistant as the same private context variable. Thus, the server-side code from the tutorial continues to work with the Botkit framework.

Check out the code and instructions in the GitHub repository "botkit-watson-serveraction" to get started with using Botkit middleware with serverless dialog actions.

If you have feedback, suggestions, or questions about this post, please reach out to me on Twitter (@data_henrik) or LinkedIn.

LinkWithin

Related Posts with Thumbnails