- The Article on Medium: Create your own AI voice assistant bot with Node.js using Google Bard
- A short video on YouTube on how it works.
- Demo Telegram channel: sqca_bot
A Telegram bot that answers your questions with a voice message.
A Simple Question => A Complex Answer
-
Create a new AWS IAM user, give it access to Polly.
-
Create a new Telegram bot with @BotFather.
-
Create a new Telegram channel and add the bot as an admin.
-
Create a new MongoDB Atlas cluster and set up IP whitelist.
-
Have a Google Bard account. In a browser open inspect element.
__Secure-1PSID,__Secure-1PSIDTScookie values fromApplication->Cookies->https://accounts.google.com -
Clone the repo and install dependencies:
git clone git@github.com:boolfalse/simple-question-complex-answer.git && cd simple-question-complex-answer/ npm install- Install python dependencies (you may use
pip3instead ofpipfor your case):
pip install SpeechRecognition pip install bardapi pip install --upgrade GoogleBard- Create a
.envfile in the root directory of the project and add the following:
# @BotFather token here TELEGRAM_BOT_TOKEN="" # Usually it's "python3" or kind of "/usr/local/bin/python3.10" PYTHON_EXEC_PATH="python3" # Copy values and add it here respectively GOOGLE_BARD_SECURE_1PSID="" GOOGLE_BARD_SECURE_1PSIDTS="" # AWS IAM user keys AWS_ACCESS_KEY="" AWS_SECRET_KEY="" # MongoDB Atlas connection string MONGODB_URI="mongodb+srv://<USER>:<PASSWORD>@cluster0.mzcsh.mongodb.net/<DB_NAME>?retryWrites=true&w=majority"- Run the app:
- Development:
npm run dev
- Production:
npm run start
- Command samples on production:
# start forever start -c "npm run start" ./ # list forever list # stop forever stop <pid>
- Add used resources to the "Resources" section
- Refactor codebase (middlewares)
- Logging/error-handling (file writing, Slack/Telegram notification)
- Modify DB for multiple sessions
- Add "/new" command with session management
- Add command to leave chat
- Add invitation functionality
- Add usage limit to non-invited users
- Queue messages to avoid any 3rd party APIs limitations
- Use messaging system (e.g. Kafka, RabbitMQ)
