This is a simple AI bot made with nodejs, web speech api and dialogflow
This is how web app works:
- Using the Web Speech API’s SpeechRecognition interface to listen your voice from a microphone.
- Send your message to dialogflow agent (the natural language processing platform) as a text string.
- Once the AI from the agent returns the reply text back, use the SpeechSynthesis interface to give it a synthetic voice.
The full tutorial can be found 👉 Here
#install dependencies
npm install
#install nodemon
npm install -g nodemon
- To setup DialogFlow, you’ll need to create a DialogFlow Account.
- After creating an account, you would need to create an “agent”. The Getting Started guide illustrates all the relevant details
- Rather than opting for the complete customization method and creating entities and intents, you can just click Small Talk in the left menu.
- You can then toggle the switch for the service to be enabled.
- To use the API with our Nodejs application, you’ll need to go to the ‘General Settings’ page (click on the cog icon beside your agent’s name in the menu) and retrieve your Project Id.
- Enable the Dialogflow API
- Set up authentication with a service account so you can access the API from your local workstation.
- Click on create service account key page.
- Download your josn file credentials and put in your root directory.
- Replace the keyfilename of your json file name in app.js
Add config.env file inside the config folder and add the following:
PORT=5000
NODE_ENV=development
PROJECT_ID=your dialogflow project id
#Run in dev mode
npm run dev
#Run in prod mode
npm start
- version: 1.0.0
- License: MIT
- author: Sajid Ansari