Skip to content

stevkan/nest-botbuilder-webchat

Repository files navigation

Nest Logo Nest Logo

Nestjs on NPM Botbuilder on NPM BotFramework-WebChat on NPM Pug on NPM

Description

This project asks the question of how a bot, a token server, and web chat can be built using one framework. Nest, as that framework, provides a single solution to these three requests.

A bot server is created for running a BotFramework designed bot. The bot is then exposed, as a service, via an API.

A token server is created for generating and refreshing Direct Line tokens. The token server is then exposed, as a service, via a set of APIs. Tokens are requested and consumed by Web Chat for communicating with the bot.

BotFramework-WebChat is used on the client side providing a user interface for interacting with the bot.

Pug is used for as view's rendering engine.

Installation

$ npm install

Configuring the app

# .env file
MicrosoftAppId=<YOUR_BOTS_APP_ID>
MicrosoftAppPassword=<YOUR_BOTS_APP_PASSWORD>
DIRECT_LINE_SECRET=<DIRECT_LINE_CHANNEL_SECRET>

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Navigate to Web Chat

http://localhost:8080/webchat

Test

Comming soon

Notes

  • The 02.echo-bot sample is used for the bot in this project. Additional samples and features are available at BotBuilder-Samples.
  • The 01.getting-started Web Chat sample is used in this project. Additional samples and features are available at BotFramework-WebChat.
  • client.service.ts is presently unused but is preserved for future use. At the time of development, the intent was to use @nestjs/serve-static to serve the web page hosting the Web Chat component. However, the "serve-static" package is not functioning correctly, so an alternative method is used in main.ts.
    • Because the file is served via main.ts, via the <NestExpressApplication> interface, a rendering engine is required. Pug was chosen to fulfill the requirement.

License

This project is MIT licensed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published