Skip to content

PezCoder/ai-chatbot

Repository files navigation

ai-chatbot

Bot that listens & talk back, powered by dialogflow

How it works ?

  1. Recognise the input voice using SpeechRecognition api
  2. Send the recognised text to the express server using socket.io
  3. Server uses API.AI's node sdk wrapper apiai-nodejs-client to find relevant response for the input provided.
  4. Server sends the response back using socket emit.
  5. Client captures the response & Use SpeechSynthesis api to convert the text to voice.

Resulting in a conversation. 🗣

Look

Inspiration & helpful links

  1. Smashing magazine article
  2. Heroku nodejs deployment instructions

Try with a local server

Rename the .env-test to .env and fill the env vars:

APIAI_TOKEN=your_token
APIAI_SESSION_ID=some_unique_session_id

The first one is an API.ai API key (Please get one by sign up with dialogflow), and the second one is a session ID, which is an arbitrary string.