Turn ChatGPT into a Voice-Enabled Chatbot in 60 Lines of Code

Sebastian Scholl
3 min readFeb 18, 2023
Turn ChatGPT into a Voice-Enabled Chatbot in 60 Lines of Code

I recently found an article about someone who built a Zapier integration between Alexa and ChatGPT. Although it was a cool project, I realized it wasn’t necessary to use a third-party platform or Home Speaker to interact with ChatGPT using voice. All the required functionality is natively available in Chrome.

Back in 2017, I worked on a product that used a voice-controlled interface, and I became very familiar with web speech recognition and speech synthesis APIs. Using these, alongside some tricks to work with ChatGPT’s interface, I was able to start talking to the AI and give it a voice!

In this article, I’ll walk you through how to turn ChatGPT into a voice-enabled chatbot using 60 lines of code. Meanwhile, anyone can copy and paste the script.

Steps to Complete

To build this chatbot–literally–we’ll complete the following three steps:

Step 1: Open the ChatGPT website in your Chrome browser.

Step 2: Open the developer console by pressing Ctrl+Shift+I or right-clicking anywhere on the page and selecting “Inspect”. Open the “Console” tab.

Step 3: Paste in the Javascript code and start chatting! You can just have a natural conversation without keywords.

--

--