HOWTO: Deploy your chatbot from Github

HOWTO: Deploy your chatbot from Github

This article describes how to deploy API.chat chatbot from Github repo in 3 easy steps with Github Actions. This article assumes that you already created or cloned samples repository.

Step 1. Prepare scenario file

Chatbot scenarios can be stored as XML files, therefore they can be version-controlled and edited with your favorite code editor.

Visual Studio is a nice option

You can even edit it directly on GitHub

Снимок0-2.PNG

So for start, save your scenario into the file and don't forget to add it to a repository with git add command.

Step 2. Use update_scenario endpoint.

For scenario management purposes, API.chat provides an API. This is the only API endpoint that takes a body in the form of application/xml - chatbot scenario format. To use it you need to provide a subscriptionKey, botName, and scenario like in the example below

carbon (38).png

Source code to copy

To get the subscription key you should navigate to your Profile page and copy a primary or secondary key from your current subscription

screen28-1.PNG

The same REST request can be used in GitHub actions as well providing you with the ability to set up continuous development.

Step 3. Setup GitHub actions for chatbot

GitHub Actions allows you to set up a workflow for CI/CD with simple to understand .yaml files. We already prepared a template for chatbot deployment in our sample-scenarios repository. To use it add your own copy of the workflow file to .github/workflows folder of your repository.

Workflow template

carbon (39).png

Source code to copy

This workflow will set up an ubuntu machine and will deploy a chatbot with a CURL command from a file. Don't forget to change env variables SUB_KEY, BOT_NAME, BOT_FILE of your account and repository to your own.

Build your chatbot 3x faster with API.chat

Contact us or sign up now.