Build a Doctor Appointment Bot With Azure Bot Service, Language Understanding, and Twilio SMS | by Sunny Sun | Mar, 2022

A step-by-step tutorial to construct a reserving system

Person on cellphone.

Azure configuration

az login
az group create --name rg-bot --location [AZURE_LOCATION]
az supplier present --namespace Microsoft.CognitiveServices -o desk
az supplier register --namespace Microsoft.CognitiveServices --wait

Create the LUIS app

Import the mannequin

Create the bot utilizing a Bot Framework template

dotnet new -i Microsoft.Bot.Framework.CSharp.EchoBot
dotnet new -i Microsoft.Bot.Framework.CSharp.CoreBot
dotnet new -i Microsoft.Bot.Framework.CSharp.EmptyBot
dotnet new corebot -n AppointmentBot
$CorrectProjectName = "AppointmentBot"
Push-Location "./$CorrectProjectName"
Transfer-Merchandise ./CoreBot/* ./
Take away-Merchandise ./CoreBot
Transfer-Merchandise ./CoreBot.csproj "./$CorrectProjectName.csproj"
Get-ChildItem * -Recurse -File | ForEach-Object Set-Content material $_
Pop-Location
[projectRoot]CognitiveModelsFlightBooking.cs[projectRoot]CognitiveModelsFlightBooking.json[projectRoot]CognitiveModelsFlightBookingEx.cs[projectRoot]DialogsBookingDialog.cs[projectRoot]DialogsMainDialog.cs[projectRoot]BookingDetails.cs[projectRoot]FlightBookingRecognizer.cs
rm CognitiveModels/FlightBooking.cs
rm CognitiveModels/FlightBooking.json
rm CognitiveModels/FlightBookingEx.cs
rm Dialogs/BookingDialog.cs
rm Dialogs/MainDialog.cs
rm BookingDetails.cs
rm FlightBookingRecognizer.cs
After cleanup

Join the bot to the LUIS app


"MicrosoftAppType": "",
"MicrosoftAppId": "",
"MicrosoftAppPassword": "",
"MicrosoftAppTenantId": "",
"LuisAppId": "[YOUR_LUIS_APP_ID]",
"LuisApiKey": "<SET_USING_USER_SECRETS>",
"LuisApiEndpointUrl": "[LUIS_ENDPOINT_URL]"
dotnet user-secrets init
dotnet user-secrets set "LuisApiKey" "[YOUR_LUIS_API_KEY]"

Management the dialog circulate utilizing dialogs

Most important Dialog

Twilio adapter and controller

dotnet add bundle Microsoft.Bot.Builder.Adapters.Twilio --version 4.15.0
dotnet run
az appservice plan create -g rg-bot -n asp-bot --location [AZURE_LOCATION] --sku F1
az bot prepare-deploy — lang Csharp — code-dir “.” — proj-file-path “AppointmentBot.csproj”
az identification create --resource-group "rg-bot" --name "identity-appointment-bot"
az deployment group create `
--resource-group "rg-bot" `
--template-file "./DeploymentTemplates/template-with-preexisting-rg.json" `
--parameters "@ParameterFiles/RegisterAppParams.json"
az webapp present -g rg-bot -n appointment-bot-[UNIQUE_SUFFIX] --query 'hostNames[0]'
az webapp up -g rg-bot -n appointment-bot-[UNIQUE_SUFFIX]
az webapp config appsettings set -g rg-bot -n appointment-bot-[UNIQUE_SUFFIX] --settings `
LuisApiKey=[YOUR_LUIS_API_KEY] `
TwilioNumber=[YOUR_TWILIO_PHONE_NUMBER] `
TwilioAccountSid=[YOUR_TWILIO_ACCOUNT_SID] `
TwilioAuthToken=[YOUR_TWILIO_AUTH_TOKEN] `
TwilioValidationUrl=[YOUR_BOT_TWILIO_ENDPOINT]
az webapp restart -g rg-bot -n appointment-bot-[UNIQUE_SUFFIX]

More Posts