If you haven’t already located these three values in your Twilio Console, go back to the Prerequisites section of this tutorial for further instructions on where to find them. Because we’ll be sending SMS notifications from your Twilio phone number for this tutorial, you’ll also need to supply your Twilio phone number. In order to interact with any Twilio API, you need to supply your Twilio Account SID and your Twilio Auth Token within your code. This means that the first column in the sheet ( CUSTOMER_PHONE_NUMBER) is associated with 0, the second column in the sheet ( CUSTOMER_NAME) is associated with 1, and so on. Notice that the variables representing the column names are defined according to the column number, using a zero-based index. In the Apps Script Editor, define the columns as variables by copying and pasting the following code: When the Apps Script Editor opens, delete the placeholder code ( function myFunction() ). To access the code editor for Google Sheets, first click on the Tools tab and then open the Script Editor as shown below: Now that we’ve created the columns in Google Sheets and seeded one row of sample data, we need a way to represent the columns in the code we’re going to write. Your spreadsheet will look like this now:ĭefine the Google Sheet columns as variables If Google Sheets gives you problems when you try to enter a phone number in this format, try one of the alternativevs suggested in this StackOverflow thread and ensure the cell formatting is “Plain text”. Make sure the phone number you enter in the spreadsheet is in the E.164 format. Next, add a complete row of sample data using your own name and regular (non-Twilio) phone number so you can test the script later. Status of message - our script will update this cell after it runs.Payment info - brief description of what is being paid for.Payment due date - must be formatted as yyyy-mm-dd, like.Customer phone number - use the “plain text” cell format.In row one, type in each of these seven column names in the following order: Your Account SID and Auth Token, found in your Twilio account dashboard as shown below:įirst, c reate a Google Sheet.A Twilio phone number that has been verified.You could easily make a few small changes to this use case to fit your own unique needs.įollow along with the code snippets below! Prerequisites We will be using Google’s JavaScript-based language called Apps Script from within the Google Sheets interface to programmatically send SMS reminders when a customer’s payment is past due or coming up. In this tutorial, we are going to use Twilio’s Programmable Messaging API and the Google Sheets API to send payment reminders to customers listed in a Google Sheet. Wouldn't it be cool if you had an easy way to contact these folks? Have you ever used a spreadsheet to keep track of a list of people? Maybe you keep a list of friends' birthdays, or a list of active customers for your side hustle.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |