All Projects → IBM-Cloud → slack-chatbot-database-watson

IBM-Cloud / slack-chatbot-database-watson

Licence: Apache-2.0 license
Code for the solution tutorial "Build a database-driven Slackbot" (chatbot) with a custom extension in IBM Watson Assistant

Programming Languages

python
139335 projects - #7 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to slack-chatbot-database-watson

github-traffic-stats
Manage and automatically collect Github traffic statistics for repositories
Stars: ✭ 30 (+30.43%)
Mutual labels:  db2, ibm-cloud, ibm-cloud-functions, ibm-cloud-solutions
watson-discovery-sdu-with-assistant
Build a Node.js chatbot that uses Watson services and webhooks to query an owner's manual
Stars: ✭ 20 (-13.04%)
Mutual labels:  ibm-cloud, ibm-cloud-functions
vpc-tutorials
Companion scripts to VPC tutorials
Stars: ✭ 14 (-39.13%)
Mutual labels:  ibm-cloud, ibm-cloud-solutions
multiple-deployment-options
Shows how one service can be deployed to multiple deployment options
Stars: ✭ 20 (-13.04%)
Mutual labels:  openwhisk, ibm-cloud-solutions
jpetstore-kubernetes
Modernize and Extend: JPetStore on IBM Cloud Kubernetes Service
Stars: ✭ 21 (-8.7%)
Mutual labels:  ibm-cloud, ibm-cloud-solutions
cloudco-insurance
A modern insurance company. The application showcases cognitive and cloud computing ideas in the context of insurance.
Stars: ✭ 43 (+86.96%)
Mutual labels:  ibm-cloud, ibm-cloud-solutions
openwhisk-workshops
IBM Cloud Functions (Apache OpenWhisk) workshops
Stars: ✭ 16 (-30.43%)
Mutual labels:  ibm-cloud, ibm-cloud-functions
ibm-cloud-functions-action-trigger-rule
Simple demo showing Apache OpenWhisk actions, triggers, and rules with IBM Cloud Functions.
Stars: ✭ 16 (-30.43%)
Mutual labels:  openwhisk, ibm-cloud-functions
ibm-cloud-functions-rest-api-trigger
IBM Cloud Functions building block - HTTP REST Trigger - This project provides a starting point for handling events from REST API calls with IBM Cloud Functions powered by Apache OpenWhisk.
Stars: ✭ 17 (-26.09%)
Mutual labels:  openwhisk, ibm-cloud-functions
logistics-wizard
The Logistics Wizard is an end-to-end, smart supply chain management solution that showcases how to execute hybrid cloud, microservices, and predictive data analytics in the real world.
Stars: ✭ 99 (+330.43%)
Mutual labels:  openwhisk, ibm-cloud-solutions
openwhisk-slackapp
A serverless Slack app built with Slack Events API and IBM Cloud Functions
Stars: ✭ 24 (+4.35%)
Mutual labels:  ibm-cloud, ibm-cloud-solutions
assistant-with-discovery-openwhisk
DEPRECATED: this repo is no longer actively maintained
Stars: ✭ 21 (-8.7%)
Mutual labels:  openwhisk, watson-conversation
ibm-cloud-functions-serverless-ocr-openchecks
Serverless bank check deposit processing with object storage and optical character recognition using Apache OpenWhisk powered by IBM Cloud Functions. See the Tech Talk replay for a demo.
Stars: ✭ 40 (+73.91%)
Mutual labels:  openwhisk, ibm-cloud-functions
Linq2db
Linq to database provider.
Stars: ✭ 2,211 (+9513.04%)
Mutual labels:  db2
opentracing-istio-troubleshooting
Tackle the challenge of observability in a Kubernetes application that consists of multiple microservices running in the Open Liberty application server.
Stars: ✭ 16 (-30.43%)
Mutual labels:  ibm-cloud
Hibernate Reactive
A reactive API for Hibernate ORM, supporting non-blocking database drivers and a reactive style of interaction with the database.
Stars: ✭ 167 (+626.09%)
Mutual labels:  db2
Fhir
The IBM® FHIR® Server and related projects
Stars: ✭ 117 (+408.7%)
Mutual labels:  db2
openwhisk-client-swift
[DEPRECATED] - openwhisk-client-swift is a Swift client SDK for OpenWhisk with support for iOS, WatchOS2, and Darwin CLI apps
Stars: ✭ 20 (-13.04%)
Mutual labels:  openwhisk
watson-discovery-food-reviews
Combine Watson Knowledge Studio and Watson Discovery to discover customer sentiment from product reviews
Stars: ✭ 36 (+56.52%)
Mutual labels:  ibm-cloud
Csv2db
The CSV to database command line loader
Stars: ✭ 102 (+343.48%)
Mutual labels:  db2

Note:
Code and instructions relating to the previous version of the tutorial Build a database-driven Slackbot are located in the branch cloud-functions.

Build a database-driven Slackbot with IBM Watson Assistant

This repository contains the code for IBM Cloud solution tutorial Build a database-driven Slackbot. It uses IBM Watson Assistant to create a chatbot and link it to Slack for a "Slackbot". By integrating a custom extension into the assistant, the chatbot can reach out to a Db2 on Cloud database. The custom extension is a Python app which provides a REST API for database objects. The chatbot can retrieve and insert data by calling these API functions. The Python app is deployed to IBM Code Engine.

Architecture

Run and test locally

The app was tested with Python 3.10. You can either run the app directly or first build, then run it as container. Direct:

  1. Install the required modules as specified in requirements.txt.
  2. Edit .env to configure the database connection and a secret token / API key.
  3. Run python3 app.py

Use the podman or docker tool to build and run the container.

  1. docker build -t slackbot:2 .
  2. Edit .env to configure the database connection and a secret token / API key.
  3. docker run -p 8080:8080 --env-file .env slackbot:2

The file .env.sample shows a sample configuration:

  • DB2_URI: Has the SQLAlchemy URL to the Db2 database
  • API_TOKEN: Is the secret for the API key authentication.
  • TABLE_ARGS: Is an optional setting to specify a different table schema. The EVENTS table is created in the default schema for the connection. This can be overwritten.

If you stored the Db2 credentials in a file slackbotkey.json, then use jq to create the URL using this command:

cat slackbotkey.json | jq '.[].credentials.connection.db2 | (.authentication.username + ":" + .authentication.password + "@" + .hosts[0].hostname + ":" + (.hosts[0].port | tostring) + "/" + .database + "?Security=SSL")'

The output follows this schema db2+ibm_db://user:[email protected]:port/bludb?Security=SSL;.

Create or recreate the database objects by calling the following API. Adapt the host, port, and API key as necessary.

curl -X 'POST'  'http://127.0.0.1:5000/database/recreate?confirmation=True' -H 'accept: application/json' -H 'API_TOKEN: MY_SECRET'

OpenAPI Specification

The Python app is based on the APIFlask API framework which itself is based on Flask. The OpenAPI specification for the application can be (re-)generated using:

flask spec --output slackbot-openapi-spec.json

You can also access the running app at the /docs (Swagger UI) and /redoc (Redoc) endpoints for interactive API documentation. See the APIFlask documentation on Swagger UI and Redoc for details.

Swagger UI

License

See License.txt for license information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].