Getting Started
Text Responses
In addition to dynamically generated galleries, you can read from a sheet to generate text responses.
You can search for text in a Google Sheet and deliver text responses to your users. Unlike a gallery-formatted Google Sheet, a text-formatted Google Sheet has one requirement. The first column should include an ID with each row having an incremental number.
Example #1
In this example we can take any user input to search a keywords column of a Google Sheet and generate a text response. You can include text, emoji, and even Custom User Fields in Google Sheet cells.
Let's say, for example, a user says to your chatbot "When do you close?" (You're a physical location business). That message could hit a Default Reply and Botsheets can take that user input and find a matching response in a text-formatted Google Sheet template. Here is what a sample Default Reply would look like (Included in the Botsheets Starter Kit):
In the first step we can set a user field "input" with a value automatically stored by Manychat in the system field "Last Text Input". We can then do a text search of the sheet using the value stored in "input". The next step is to add a Text Search Action.
Select the worksheet where you'll search for text and select the column you want to search. For the search method, you'll want to look for a match so select equals as your search method. Next you'll select the field where you stored the user's message. In this case it's "input". Now select the column name (the header used in the Google Sheet) where you'll look for a response to give to the user. You'll enter in a custom value. Next, select the first result found as you're only going to want to display one text response for the user.
If a match is found, then we can display the answer saved in the "Answer" Custom User Field. If no match is found, then you can fallback and do a simple gallery search and return possible responses as gallery cards, and if no match is found in your gallery worksheet, only then connect the user with a human.
This is a logical strategy for handling incoming messages, giving your bot multiple opportunities to engage and respond to the user.
Example #2
In this example, a bot will check if a promo code exists in the Google Sheet. If it exists, an offer, and a discount value corresponding to the discount code will be saved to a custom user field.
You would want to include a step in your flow that requests user input for users to input a promo code and save their input to a user field.
In this example, the code will be saved to a Custom User Field called "BS_user_promo_code".
In the Botsheets Text Action, you specify the worksheet to search the code and specify the column to search. You'll want to search for an exact match, so use equals for the search method. You'll use the value stored in the "BS_user_promo_code" field. You'll specify the name of the column header to search from and you want to display the first match found.
If the promo code is found in column B of the sheet then we might just want to get a value from that "Offer" column, but if wanted to get the actual savings amount, then we'll look for a value in the "Discount" column and we can save that to a number-type Custom User Field because the values in the "Discount" column are all numbers. We then want to save that value to a User Field by mapping the response.
If the promo code is found then you can confirm the promo code is valid, otherwise respond that the promo code is invalid. If the code is valid, then because you'll store a numeric value in the same row (Mapping column data to a custom user field) to calculate a discount, you can see how you might calculate the savings with the value you capture and store.
An example flow is included in our Botsheets Starter Kits for Messenger and Instagram and you can preview your flow to test it out.