Use IBM Cloud Functions and Watson Assistant service to create a serverless chatbot. There is no need to setup a Virtual Server (or Virtual Machine) or a Cloud Foundry to deploy and use your own chatbot. If you don't know how to build a chatbot, read my blog.
- IBM Cloud Functions: FaaS (Function-as-a-Service) platform that executes functions in response to events. It is based on Apache Openwhisk project.
- Watson Assistant: Watson Assistant lets you build conversational interfaces into any application, device, or channel.
- MongoDB: MongoDB is a JSON document store with a rich query and aggregation framework.
To deploy, you need to install IBM Cloud CLI and IBM Cloud Functions CLI in your local machine. After this step, you need to login in your IBM Cloud account on IBM Cloud CLI (if you haven't already done, run ibmcloud login
), follow all steps below.
git clone https://github.com/victorshinya/serverless-chatbot.git
cd serverless-chatbot
Replace on assistant.js
:
- [ Line 14 ]
{iam_apikey}
by your Watson Assistant's IAM_APIKEY - [ Line 22, 29 ]
{assistant_id}
by your Watson Assistant's ASSISTANT_ID
Replace on mongodb.js
:
- [ Line 17 ]
{mongodb_uri}
by your MongoDB URI - [ Line 23 ]
{mongodb_db}
by your MongoDB Database name - [ Line 24 ]
{mongodb_collection}
by your MongoDB Collection name
Run the following command to deploy both assistant.js
and mongodb.js
functions and create a sequence with all actions on IBM Cloud Functions. Required an account on IBM Cloud.
As you are using IBM Cloud Functions, you don't need to install any package or setup a
package.json
. The platform already has the package installed.
ibmcloud fn deploy --manifest manifest.yml
Copyright 2020 Victor Shinya
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.