How to create a chatBot connected to Azure OpenAI service — Javascript

Ivana Tilca
2 min readFeb 27, 2023

--

Requirements

Create an empty ECHO BOT

1- Open up your terminal and create a folder, then run: yo botbuilder

2- Open the project in vscode and make sure you are running the following versions and run npm install:

botbuilder ~4.17.0. / dotenv ~8.2.0 / replace ~1.2.0 / restify ~8.5.1

3- Run the project (npm start) to test echo bot.

Edit the bot.js to consume Azure Open AI Service

The API we will use will help us have a conversation with our bot. If you want to read more check out MS documentation. The key to use this service is to tell the API how it should behave and then provide a few examples. That’s why we will use the example provided by Microsoft:

Lets go ahead and create the url and heaver we will use to consume our service.

Next lets create the interfaces we will need to interact with and edit the message function.

Run and test your bot in the emulator. Congrats!

Code availble here: ivatilca/chatBotAzureOpenAI (github.com)

--

--

Ivana Tilca
Ivana Tilca

Written by Ivana Tilca

Technology and Business Advisor | Cloud | Innovation | Speaker | Author #net #javascript #azure #xr #ai ⭐ @Microsoft Azure & AI MVP

Responses (1)