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.
You can even edit it directly on GitHub
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
To get the subscription key you should navigate to your Profile page and copy a primary or secondary key from your current subscription
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.
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.