Updated Tutorial: Build a Database-Driven Slackbot

2 min read

The IBM Cloud platform and its services evolve—and so do our tutorials. Now you can benefit from new IBM Watson Assistant features.

The tutorial on how to build a database-driven Slackbot utilizes IBM Watson Assistant for the chatbot, IBM Cloud Functions to access the database, and IBM Db2 on Cloud as backend database. All three have introduced new features the tutorial and its users can benefit from. Therefore, we updated the tutorial and the related code which is available on GitHub. The Slackbot is now easier to set up and the environment is more secure. 

Read on for details.

Build a Slackbot to interact with a database.

Build a Slackbot to interact with a database.

Improvements to Watson Assistant

Earlier this year, IBM Watson Assistant introduced webhooks to easily make programmatic calls to external applications. Previously, as a beta feature, IBM Cloud Functions actions could be called from dialog nodes, and not all cloud regions were supported. Moreover, you had to manually edit the JSON representation of a dialog node and add the configuration to invoke an action and manage parameters and results.

With the new webhook feature, developers can configure the URL and general parameters in a form under the Options menu. Dialog node-specific parameters and the resulting variable are integrated into the dialog editor. There are even form fields to reset context variables. Previously, all of this required edits to the JSON representation and extra dialog nodes for clean-up.

Easily configure a webhook URL and header data.

Easily configure a webhook URL and header data.

More security for Cloud Functions and Db2 on Cloud

As mentioned earlier, the tutorial on how to build a database-driven Slackbot makes use of IBM Cloud Functions to implement serverless actions. These actions are used to insert and query data into a Db2 on Cloud database. 

Similar to most other services and compute resources, Cloud Functions moved to IBM Cloud IAM (Identity and Access Management) and its resource management concepts. It provides common user authentication and fine-grained access control across IBM Cloud. The updated tutorial makes use of the IAM namespaces in Cloud Functions. Thus, you can better control the resources for actions and access to them.

IBM Cloud offers both the Key Protect and the Hyper Protect Crypto Services to create and manage encryption keys. Many services have been enhanced to support user-controlled data encryption keys. One of these services is Db2 on Cloud. 

Administrators can now migrate a database from using a service-generated encryption key to utilizing root keys managed in Key Protect. As a reader of our Slackbot tutorial, you now have the option of either using the Lite plan for Db2 on Cloud or go with an Enterprise plan and opt for additional security.

Conclusions

The new features in IBM Watson Assistant make it easier to set up and configure the dialog as well as the programmatic calls to external applications. For the tutorial, it resulted in a simpler dialog layout and flow and easier instructions. Changes to IBM Cloud Functions and Db2 on Cloud allow better control over resources and privileges, and it is even possible to use your own encryption keys to protect the database.

Check out the tutorial on how to build a database-driven Slackbot and its related code on GitHub.

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

Be the first to hear about news, product updates, and innovation from IBM Cloud