How to integrate Google Sheets?
In this article, you will learn how to integrate Google spreadsheets (Google Sheets) to organize communication with your users.
Estimated reading: 06 minutes
Connect your Google Sheets account and have your databases accessible from your bot. This way, you will have the information you need to communicate always updated in a simple and fast way. See the step-by-step integration:
Step 1 : Go to Menu>Channels and Integrations>Integrations and select Google Sheets. Click on Connect.
Step 2 : Click on Grant permissions to bot. Then, select a Google account to continue.
Select the services to which Botmaker will have permission to access and click Continue.
Note: If you had granted permission to some services previously, you can review them separately as shown below. Granting access to "see and download all your Google files" and " see, edit, create and delete all your Google Sheets spreadsheets" are mandatory steps for the integration to work properly.
You will then see the Google Sheets integration enabled with your Botmaker account.
Click close. You will see that Google Sheets is now displayed in the section of applications already integrated into the Botmaker platform.
Create a record
When using the "Create record" action, the bot adds the desired information to a (selected) Google Sheets spreadsheet. To use this action, follow the step by step below:
Step 1 : Create an intent for Google Sheets in the bot or add in the intent you want the action " Create a Google Sheets record". This should be the first action to add. Then, when the customer contacts you, the system will immediately check the Google Sheets action and, successively, the customer's information.
Step 2 : Within this action, select one of the spreadsheets you have saved in your Google Drive.
Step 3 : The action recognizes the titles of the different columns automatically, so simply fill in the variable you want to take the data from. As these variables take values, they will be loaded into Google Sheets in the specified column.
Incorporating data from Google Sheets
Incorporating data from Google Sheets is very easy. In the intent you want, add the action "Import data from Google Sheets" and complete all the steps. Follow the step-by-step below:
Step 1: Select the Google Sheets spreadsheet you want to integrate with Botmaker.
Step 2 : Select the variable ${platformContactID} which is the variable that stores the user's phone number. This will be the variable corresponding to the data that the system will check in the spreadsheet.
Step 3: Indicates to which intent the client will be referred if the system does not find his data in the spreadsheet. In this case, you can create a new intent with a specific flow that you want those customers whose data is not in the spreadsheet to follow.
Step 4: Insert the name of the Google Sheets column (as shown in the example) where the users' phone number or the data you asked to search for in the system as specified in step 2.
Step 5: Add the column in the spreadsheet that contains the agent's name. This way, every time the system finds this information in the spreadsheet, it will create a variable/label (which is assigned to the right of the user's chat) with this column name from step 5 (Operator/Agent).
Note: Additionally, after setting up the spreadsheet action, in the bot flow (it does not need to be below, it can be in a new flow because the customer will have already been verified in the start menu), you can add/condition the actions. For example, you can add an action of ˜ Assign conversation to specific agent' with the condition ${agent} has data>agent for the assignment ${agent}, i.e. when contacting, the system will check the user's phone number in the spreadsheet, identifying it will link it to the agent (operator) in the spreadsheet and assign the conversation automatically to this agent.
You are all set! You can now retrieve the data from your spreadsheets to optimize communication with your customers.
Remember to visit our Help Center for more information.
Written by: Botmaker Team
Updated: 11/12/2021