This guide will show you how to send WhatsApp messages using Google Sheets using the new WhatsApp API and Google Apps Script. The same strategy would be used when delivering WhatsApp messages from Google Forms in response to fresh form submissions.
Step 1: Make a WhatsApp application.
To create a new app for sending WhatsApp messages, go to developers.facebook.com and click the Create App button. Choose the Business app type.
Give your app a descriptive name (do not include any Facebook trademarks such as WhatsApp or Facebook in the app name) and then click the Create App button to get started.
Once the app has been created, on the following screen, select the WhatsApp button to add WhatsApp sending features to your app.
On the following screen, you must connect your WhatsApp app to your Facebook business account. You will also be able to create a new business account if you do not already have one.
Step 2: Enter The Phone No Of The Beneficiary
Facebook will offer you with a test WhatsApp phone number that will serve as your app’s default sending address. During the development phase, you will be able to add up to 5 phone numbers for recipients without paying anything.
Your WhatsApp application will provide you a provisional access token that will be active for the next 23 hours. Make a note of this token because we’ll need it later.
Then, select up to 5 distinct WhatsApp phone numbers from the Recipient Phone Number selection menu. On the added numbers, you will receive a verification code, and you will only be able to send WhatsApp messages to numbers that have been validated with the code.
Step 3: Create a WhatsApp Message Template in
Generate a new WhatsApp message pattern by going to the template making manager.In this example, we’ll select Account Update as the category and give your message template a unique name. For languages, we’ll go with English, which has the code language en. Make a note of the code language if you use another language, as it is essential for sending messages.
Create a Personalized Message
The message contains variable parameters, which will be substituted with the real values from the Google Sheet. It is very similar to the markers you may have used in Mail Merge and Document Studio, with the exception that these are positional markers rather than named markers.
Here’s our message template, with variables 1 and 2 representing the customer name and item name, respectively.
Step 4: Send WhatsApp Messages
Now that we’ve finished configuring everything on the Facebook / WhatsApp side, let’s get to work on the Google Sheet that will really deliver these tailored WhatsApp messages in an automated fashion. Copy the WhatsApp Sheet into your own Google account by clicking here.
Next, enter the phone numbers (including the country code) into the Google Sheet’s Phone number column. You should only add numbers that you have already verified with your test WhatsApp account.
Then, from the Extension menu, select Apps Script to view the underlying script. Replace the values copied in the previous stages for WHATSAPP ACCESS TOKEN and WHATSAPP TEMPLATE NAME.
When you click the Run button inside the Apps Script editor, the WhatsApp message should be sent to the phone numbers you specified.
And what you see below is the actual WhatsApp message provided by the WhatsApp API, with the variable markers in the template replaced with actual Google Sheets values.
How the WhatsApp API interacts with Google Apps Script
The Google Apps Script connects to Google Sheets and obtains information about clients, including phone numbers, who will receive messages over WhatsApp.
Is It Possible To Send Whatsapp Messages From Google Sheets?
Begin the add-on by going to Google Sheet > Extensions -> WhatsApp Messages->Start. ➤ Check that the first row of your spreadsheet contains column names. Such as ‘Fullname,’ ‘Address,’ ‘Phone,’ ‘Email,’ and so on. To combine, you must have at least one row of data under each of your column names.
How Can I Link A Whatsapp API To Google Forms Or Google Sheets?
Back to Add-ons> WhatsApp Message Sender> WhatsApp Schedule. On the “Google” sheet, choose the WhatsApp numbers. You can create an account by introducing the “endPoint” and “apiKey” of WATI. Choose a message from the list of templates; you can customise them, but they must be approved by WhatsApp.
How Do I Send A Message To The WhatsAppAPI?
Download and install the WhatsApp Business API Client — Set up your API client. You can update your WhatsApp application settings after your client is coming active. Begin by registering your phone number with an API call to /account and sending a test message with an API call to /messages.