Most bot tutorials are for people who can code, so if you don’t have developers or staff with extra time on their hands your custom needs may not be met. Building a bot requires technical resources, such as servers to run the logic, storage to store data points and developers, well, to code. Until now. In this tutorial, we’ll show how you can build a survey bot right from a Google Sheet.
Instead of using a server to run your bot logic (which is actually easy, but it requires maintenance), use Google as your hosting environment on your behalf and use Google Sheets to keep track of the survey answers!
In Google Sheets, Click
Make a copy...
This should give you something like this:
Note: Feel free to change the name of the
Copyto anything you want, it will not affect the outcome.
parameterssheet, edit the following fields:
Color Hexformat only. For example
This is the difference between a keyboard with specific colors versus one generated with random colors:
questionssheet, edit your questions:
Our survey bot supports three (3) different types of questions:
range - Asks the user to enter a valid value from a custom range. It makes sense to provide a range when the user needs to score something.
keyboard - Show case different selection options via the Viber's keyboard.
text - Free text input.
Each row in the spreadsheet equals to a survey question and ordered by sequence. Hence the first row (after the header) will contain the first question, while the 7th row will contain the seventh question.
type column write
question column write your question. Best practice is to mention the actual valid range.
extras column write the acceptable values, separated by semicolons. For example
type column write
question column write your question.
extras column write the options, separated by semicolons. For example
Script editor... by clicking "
Tools" > "
Select the latest project version to deploy.
Note: You must select the
Anyone, even anonymousoption for the "Who has access to the app" dropdown or form responses will not be added to the spreadsheet!
Copy the web app URL to your clipboard / note pad. Then Click "OK".
Viber chat API console is a helper site set up for this integration, specifically to help you set up a WebHook. This way Viber will know to communicate with your Sheet.
Set a WebHook operation, paste your web app URL from the previous step and click the
Apply button to make the change.
Done. That's it. You just created your very own survey chat bot! Your survey answers will populate on the
Feel free to customize the code, add more question types, improve the flow or even accept pictures as valid input!
If you find any issues with this sample, please open an issue on GitHub.