How to Get Google Assistant for Windows PC

Google Assistant is available on nearly every Android phone recently made, but there’s currently no desktop version available. However, today I’ll show you a (somewhat tedious) method of getting Google Assistant running on your Windows machine.

As of this writing, there’s no fancy GUI for what we’re about to do, and the installation is going to rely primarily on command lines. But once you’ve got it up and running, you can speak into your computer’s microphone as you would to your Android device to control Google Assistant.

Requirements

First, you’ll need to install Python on your computer and then we need to add it to the path, follow me carefully. Download and launch the Python installer .exe, and have it do a custom install. On the second options screen, tick “Add Python to environment variables”.

Once Python is installed, open a command terminal and type “python” (without quotations). If all is well, the command prompt should display your current Python version.

Now we need to configure the Google Assistant API.

  1. Navigate to the Projects page in the Google Cloud Platform Console.
  2. Click on “Create Project” up top.
  3. Give the project a name like “Google Assistant” and click “Create.”
  4. The Console will create your new project – you should see a spinning progress icon in the top right. When it’s done, you’ll be brought to the project configuration page.
  5. Go to the Google Assistant API page and click “Enable” at the top.”
  6. To use the API, you’ll need to create credentials. So click the “Create credentials” button in the top right. A setup wizard will walk you through this process.
  7. Underneath “where will you be calling the API from?”, select “Other UI (e.g. Windows, CLI tool)“. For “what data will you be accessing?” select the “User data” circle. Now click “what credentials do I need?”
  8. Google will recommend that you create an OAuth 2.0 client ID. Give the client ID a unique name and click “Create client ID.”
  9. Under “Product name shown to users” enter “My Google Assistant” or something like that.
  10. Click “done”, but do not click the download here, we only need the client secret.
  11. Under the list of OAuth 2.0 client IDs, you’ll see the client ID you just made. On the far right, click on the download icon to download the client_secret_XXX.json file, where ‘XXX’ is your client ID. Save this file anywhere on your computer, ideally in a new folder called “google assistant.”
  12. Go to the Activity controls page for your Google account and make sure that “Web & App Activity”, “Location History”, “Device Information”, and “Voice & Audio Activity” are enabled. This is so Google Assistant can actually read your personalized information.

Now we need to configure a client that will access the Google Assistant API.

Open a command terminal and type the following command:

 

-m pip install google-assistant-sdk[samples]

This will begin installing the required dependencies for Python. When it’s done, enter this command next (change the path directory in the command).

py -m googlesamples.assistant.auth_helpers --client-secrets change\your\path\client_secret_XXX.apps.googleusercontent.com.json

In the command prompt, you will be shown a URL to visit to authorize the application. Go ahead and copypaste the URL into your browser, and use the same Google account you used to configure the Google Assistant API. You’ll be shown an access token for your client – copypaste the access token into the command prompt where asked.

Now we’ll test if the Google Assistant can properly access your microphone. Type into the command prompt:

python -m googlesamples.assistant.audio_helpers

If it successfully plays some audio for you, you can begin communicating with the Google Assistant. Type into the command prompt:

python -m googlesamples.assistant

Wait for it to say “press Enter to send new request”, then press Enter on your keyboard to begin talking into your mic. When you’re done talking, the command prompt will display a transcription of what you said, and also playback Google Assistant’s response.

Now, the above command prompt is a fairly ugly method of interacting with the Google Assistant API, but luckily there is an extension for Chrome browser called “AutoVoice” that simply requires you have the Google Assistant set up on your computer (which we just did!). However, we’ll need to do a little bit more command prompt magic to set it up properly.

Open the command prompt and copypaste the following command:

py -c "from distutils.sysconfig import get_python_lib; from urllib.request import urlretrieve; urlretrieve('https://joaoapps.com/AutoApps/Help/Info/com.joaomgcd.autovoice/googleassistant/__main__.py', get_python_lib() + '/googlesamples/assistant/__main__.py')"

Now navigate to the AutoVoice extension page with Google Chrome browser and install it. In the extension options, configure the wake-up command to something like “Hey Google” or “Okay Google” or whatever you want really.

Enable the “Always Listening” option and set the “Wake up Expression” to something other than what you set as the wake-up command. Remember – one expression is to wake up the extension, the other expression is to wake up Google Assistant.

Now type into your command prompt:

py -m googlesamples.assistant

Now you can simply say “Hey Google!” or whatever you set as your expression to wake up Google Assistant, and immediately begin giving it commands (“Hey Google, what’s the weather today?”)

ABOUT THE AUTHOR

Kevin Arrows


Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.

Comments

6
    NA
    NaveenDhanaraj Dec 5, 2017

    Hi Kevin,
    Thanks for Sharing.
    Is there any possiblity to navigate in browser using voice assistant..

    OW
    Onno Westerman Oct 27, 2018

    Well much simpler is to use Cortana in windows ( use English language not Dutch) I have google home module but that cannot open a browser in windows on my pc for it is not coupled to pc but to network.

    DE
    David Evers Jan 12, 2019

    py –m googlesamples.assistant.auth_helpers —client–secrets changeyourpathclient_secret_XXX.apps.googleusercontent.com.json

    what path an i changing this to?

    TR
    Tasneem Rangoonwala Jan 14, 2019

    Cannot find the path to the json file in the second command. please help.

      SW
      Shane Warren Author Sep 20, 2019

      You have to find the directory of the path and change it to the one on your computer.

    AH
    Adam Hirsch Jan 13, 2020

    the command prompt wouldnt recognize it

    Edit: nm. i just had to install the latest version of python