Skip to content

Code to build a Slackbot to create and search Db2 or PostgreSQL database entries for events and conferences. The Slackbot is backed by the IBM Watson Assistant service. An older version uses Botkit to integrate Slack and Watson Assistant/Conversation.

License

Notifications You must be signed in to change notification settings

TheVanDoom/slack-chatbot-database-watson

 
 

Repository files navigation

Note:
An older code version along with the related instructions is kept in the branch v1_upto_2019_04.

Build a database-driven Slackbot with IBM Watson™ Assistant

Code to build a Slackbot to create and search Db2 database entries for events and conferences. The Slackbot is backed by the IBM Watson Assistant service. As an alternative, an IBM Cloud Databases for PostgreSQL database can be used instead of Db2. The related files have an additional .pg. in their name.

The tutorial with detailed step-by-step instructions is available at https://cloud.ibm.com/docs/tutorials?topic=solution-tutorials-slack-chatbot-database-watson#slack-chatbot-database-watson. The tutorial is part of the IBM Cloud tutorials

Files in this repository

The files in this repository have the following purpose:

  • changeActionSecret.sh: shell script to update (change) the secret for invoking the web actions used by the chatbot. You still need to manually update the related dialog node.
  • cleanup.sh: shell script to drop Db2 table and delete Db2-related Cloud Functions actions
  • conversation-workspace.json: Workspace file used with IBM Watson Assistant service
  • db2-setup.js: code for Cloud Functions action which creates a Db2 table, fills it with sample data or cleans it up
  • eventFetch.js: code for Cloud Functions action which searches event data by identifier
  • eventFetchDate.js: code for Cloud Functions action which searches event data by dates
  • eventInsert.js: code for Cloud Functions action to insert a new record into a Db2 database
  • setup.sh: shell script to set up Cloud Functions actions, bind credentials, create a Db2 table and fill sample data
  • tables.sql: table schema

Files for IBM Cloud Databases for PostgreSQL

The following files are adapted versions to be used for PostgreSQL instead of Db2:

  • cleanup.pg.sh: shell script to drop PostgreSQL table and delete related Cloud Functions actions
  • postgreSQL-setup.js: code for Cloud Functions action which creates a PostgreSQL table, fills it with sample data or cleans it up
  • eventFetch.pg.js: code for Cloud Functions action which searches event data by identifier
  • eventFetchDate.pg.js: code for Cloud Functions action which searches event data by dates
  • eventInsert.pg.js: code for Cloud Functions action to insert a new record into a PostgreSQL database
  • setup.pg.sh: shell script to set up Cloud Functions actions, bind credentials, create a PostgreSQL table and fill sample data

Changes for IBM Cloud Hyper Protect DBaaS

IBM Cloud offers Hyper Protect DBaaS as highly secured data storage service. One of the options is PostgreSQL as database system. If you want to use the PostgreSQL code from the previous section, then you only need to adapt the functions in the way how credentials are passed. Replace dbSetup with the other function names.

function main({mode, __bx_creds: {'hypersecuredbaas': {url}}}) {
  	return dbSetup(dbURI=url, mode);
}

Related Content

Chatbot-related blog posts:

About

Code to build a Slackbot to create and search Db2 or PostgreSQL database entries for events and conferences. The Slackbot is backed by the IBM Watson Assistant service. An older version uses Botkit to integrate Slack and Watson Assistant/Conversation.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 64.4%
  • Shell 35.6%