Adding voice to your bot
# 📖tutorials
f
Hi there This tutorial will show you how to implement voice to your Botpress chatbot. Install [node.js](https://nodejs.org/en/download) Run these in the terminal of your project: npm init -y npm install express openai cors dotenv Rename the env file to .env Add your API key in the .env file. Add your own bot instead of mine in the index.js file. Add "type": "module", between description and main in the package.json file. Start the server by typing node server.js in the terminal and then you can start using your index.html file. Links: [BCP 47 language codes](https://appmakers.dev/bcp-47-language-codes-list/) [ISO 639 language codes](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) [Text to speech](https://platform.openai.com/docs/guides/text-to-speech) [OpenAI API key](https://platform.openai.com/api-keys) [Web Speech API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API) [Express.js](https://expressjs.com) [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) [dotenv](https://www.npmjs.com/package/dotenv) [Node.js file system](https://nodejs.org/api/fs.html) [Handling the audio](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio) [Video tutorial](

https://youtu.be/Djo3rPo518I

)
a
How can I edit the .env file in botpress?
f
You can't directly do it from Botpress. Why would you like to do it?
a
Your initial instructions said "Add your API key in the .env file." Just want to know how.
Can I do it somewhere else?
f
Ahh okay. You have to manually open the file and change it
a
Where is the file?
f
Remember to rename it to .env instead of env
I would guess in your downloads folder but depends on where you downloaded it to
a
Where would I download it FROM, and where would I upload it back to?
f
You download everything here from Discord
Create a folder for all of the files
a
Do you Import the files back into botpress when done editing?
Or is this all served from your website?
f
All on your website
You can see how it all works in my Youtube tutorial

https://youtu.be/Djo3rPo518I

I am logging of for today but hopefully the video is sufficient to get this up and running but if it is missing something please let me know and I will be able to assist you first thing in the morning.🌤️
f
Hey there, I got my exams projects right now so I won't be able to offer much support here, but feel free to let me know if you find the problem
l
@fresh-fireman-491 Hello Decay, I wanted to use the bot with voice. I tested your bot, and it works well, but the problem arises when I replace the AI task of the bot response with Query Knowledge Bases. It doesn't work. Below is the workflow with the log. Can you please help me resolve this issue https://cdn.discordapp.com/attachments/1197616810728632422/1255431492369121421/image.png?ex=667d1b30&is=667bc9b0&hm=2f11651911510d04cfe0f43c54d924d7c721234495d289320b88669e639f5388& https://cdn.discordapp.com/attachments/1197616810728632422/1255431492650401843/image.png?ex=667d1b30&is=667bc9b0&hm=432d3a6f985335e827a644711860b88bd9f93367d1f800f30ced06626ac5b40c&
f
You can't use the knowledge base when there are no messages from the user 😦
l
@fresh-fireman-491 I asked a question using voice, and in the log, it displays the question as follows: [flow:Main] [node:Standard1] [card:Extract and display speech-to-text transcript in workflow.]: Transcript ici: Comment créer un.Top.Un PAF. However, it fails to respond: [agent-card] [KnowledgeAgent] [knowledge-query]: Skipping KB agent because the user did not send a message https://cdn.discordapp.com/attachments/1197616810728632422/1255439536515846315/image.png?ex=667d22ae&is=667bd12e&hm=9da90952536de9693a7dbad4f39c0e0805642338346cabbfe8f5236c20d9be13&
f
" Skipping KB agent because the user did not send a message"
l
Yes, but I already asked a question. There's a slight issue with the workflow because it's unable to retrieve the question I asked via voice.
f
It starts the conversation over.
So even though you have sent a message, you haven't sent a message in the new conversation
l
ok, how i can make change in the workflow in order to take into account the question that i asked by voice in the query Knowledge Bases ?
m
@fresh-fireman-491 , it is possible to adapt the answers according to specific KBs nor the AI task ? if Yes, did you have an example please ? thank you!
f
Hey there, I am backpacking right now so I won't be able to check, but please do update this channel if you figure it out!🛠️🦾
8 Views