Google Sheet

The Google Sheets Integration for Botpress enables your bot to access and update Google Sheets data in real-time, automating workflows like CRM updates, inventory management, and survey tracking directly within chat.

Setting up Google Cloud

Register Cloud Project

  • First, you need to access: https://console.developers.google.com/
  • Log in with your Google account
  • Next to the Google logo, click on the dropdown list
    In this image, the name is listed as Botpress Google Sheet because it is an integration that was already set up previously.
    In this image, the name is listed as Botpress Google Sheet because it is an integration that was already set up previously.
  • After clicking on the dropdown list in the image, a modal will open, and you should click on New Project
    Screenshot 2024-10-08 at 11.58.18 AM.png
  • You will need to enter your project information such as:
    • Project name
    • Organization
    • Location
      In this case, the name of my project is Tutorial Botpress Integration, but feel free to choose your own name.
      In this case, the name of my project is Tutorial Botpress Integration, but feel free to choose your own name.
  • Then click on the create button
  • To make sure you are in the correct project, check the project name next to the Google logo
    Screenshot 2024-10-08 at 1.04.26 PM.png

Create Project Credentials

  • The next step is to click on Menu → API & Services → Credentials
    Screenshot 2024-10-08 at 1.05.45 PM.png
  • Click on Create Credentials → API Key to create an API key
    Screenshot 2024-10-08 at 1.08.55 PM.png

Enable Google Sheet API

  • The next step is to click on library and in the screen that opens, search for Sheet and enable the Google Sheet API
    Screenshot 2024-10-08 at 1.28.57 PM.png
    Screenshot 2024-10-08 at 1.30.54 PM.png

Register Service Account

  • The next step is to create a Service Account
  • Still in the Menu → API & Services → Credentials Screenshot 2024-10-08 at 1.51.23 PM.png
  • Fill in the information. When the service account name is filled, the Service Account ID will be automatically generated Screenshot 2024-10-08 at 1.56.19 PM.png
  • The other fields are optional and do not need to be filled in, so after defining the Service Account Name, just click on Done

Create and Download Json Key

  • After the Service is created, you should go to the KEYS tab Screenshot 2024-10-08 at 1.59.17 PM.png
  • You will need to create a Key, for this click on Add Key → Create new key Screenshot 2024-10-08 at 2.00.15 PM.png
  • A modal will open where you will select JSON → Create
    Screenshot 2024-10-08 at 2.02.50 PM.png
  • A JSON file will be downloaded to your machine and we will use this information in our integration with the Botpress bot
  • Your JSON should look like this, in this case I omitted the values because it's sensitive information:
{
  "type": "",
  "project_id": "",
  "private_key_id": "",
  "private_key": "",
  "client_email": "",
  "client_id": "",
  "auth_uri": "",
  "token_uri": "",
  "auth_provider_x509_cert_url": "",
  "client_x509_cert_url": "",
  "universe_domain": ""
}
  • With the configurations in the Google Console done, now we need to share the Sheet that the bot will view. To do this, you should:
    • Open the JSON that was downloaded, you can use any text editor for this
    • Copy the client_email
    • Use this email as a way of sharing, as this will be the email that the bot will need and will use to connect to your spreadsheet

    Setting up Sheet

  • To share your spreadsheet in Google Sheet:
    • In the upper right corner you will see this image and click on it
      Screenshot 2024-10-08 at 2.15.00 PM.png
    • You should change the access and set it to allow anyone with the link
      Screenshot 2024-10-08 at 2.17.13 PM.png
    • And add the email generated by your JSON as if you were inviting the bot to have access to your spreadsheet
    • Now it's time to configure the integration in Botpress Studio
    • In your Studio, activate the integration with Google Sheet

    Setting up Botpress Studio

    • Complete the required information in your Botpress Studio:
      • SpreadSheetID: This will be the id of your Sheet and to find the ID you should go to your Sheet and copy only the ID that your spreadsheet uses as shown in the image below
        It’s important to remember to copy only the ID and not the entire URL.
        It’s important to remember to copy only the ID and not the entire URL.
      • Private Key: This will be the value generated in your JSON file where the parameter name will be private_key. Important note: you should copy everything that is in the line for this value except the quotation marks ""
      • Client Email: This will be the value generated in your JSON file where the parameter name will be client_email
      • Now in your Botpress Studio
      • Select the integration tab as shown in the image below
        Screenshot 2024-10-09 at 9.21.25 AM.png
      • Search for Sheet and install the integration Screenshot 2024-10-09 at 9.24.00 AM.png
      • Private Key: This will be the value generated in your JSON file where the parameter name will be private_key. Important note: you should copy everything that is in the line for this value except the quotation marks ""
      • Client Email: This will be the value generated in your JSON file where the parameter name will be client_email
      • After everything is done, just save the settings and your bot is integrated with Google Sheet