TECHNOLOGY, INTERNET TRENDS, GAMING

How to send WhatsApp message from Google Sheets

How to send WhatsApp message from Google Sheets

By IsraeliPanda

With Google Sheets (an online calculation sheet application from Google) you can undoubtedly team up progressively with collaborators, clients, or others. The design and straightforwardness of keeping the information in lines and segments bring many advantages.

WhatsApp is a well-known application for cell phones that offers a substitution for a customary message informing framework. It permits you to send messages to someone else who is likewise utilizing WhatsApp. You can send straightforward instant messages and you can likewise send connections containing pictures, and brief snippets of video accounts.

Here, you will figure out how to make a Node.js application that can be utilized to send WhatsApp messages to numerous beneficiaries. It utilizes a Google Sheets calculation sheet as the information hotspot for contacts and Twilio’s API for WhatsApp to send the messages.

Whenever you’re signed in to your Google account, make a new “Google Sheets” clear bookkeeping sheet by tapping the “+ New” button in the upper left. You can name your accounting sheet anything you desire since we will get to the accounting sheet by its ID, not by its name, but rather we should rename it as “Arrangements”. The new bookkeeping sheet accompanies one default worksheet with the name “Sheet1” (this name matters, we will utilize it later to allude to this particular worksheet).

We’ll involve the principal line as sections’ header and name the initial 4 segments as “appointment_date”, “appointment_time”, “client_name” and “phone_number”.

Fill in the initial 3 lines with information for arrangement date and time, client name and client’s WhatsApp telephone number (for the purpose of testing one or every one of the numbers can be your number).

The calculation sheet is presently prepared to use as our information source. Then, we’ll begin composing the Node.js code for our application. You can utilize your number one content tool or Visual Studio Code.

Perusing Google Sheets information from Node.js

Our application won’t as yet work, we will not have the option to interface with the bookkeeping sheet, however, hold on for me, we’ll fix this issue as we go on through the instructional exercise.

Make another organizer named a-message-shipper for our application (you can do this with your #1-word processor or by running mkdir a-message-source in a terminal window)

Make another record index.js inside a message-shipper (you can do this with your #1-word processor or by running touch index.js in a terminal window. On the off chance that you’re on Windows and contact isn’t accessible you can run reverberation > index.js in the terminal)

The above code begins by including the “googleapis” module which is a Node.js client library for utilizing Google APIs. It has support for approval and validation and you can peruse more about it here.

Then, make an example of a client for Google APIs (for our situation for admittance to Google Spreadsheets) and afterwards, we call the approved technique to get entrance. On the off chance that you’re considering what the privatekey.json does, this is made sense in the following area.

Time to run our code. Open a terminal window and change the registry to a-message-source. Run npm init – – yes to make a default package.json document (introduce our Node.js application). Then run npm introduce google apps – – save to introduce Google’s client library.

This mistake happens on the grounds that we’re feeling the loss of the privatekey.json document. This document is something we really want to get from the Google Cloud Platform console.

Getting to the calculation sheet through a Google administration account

A help account is an extraordinary sort of Google account expected to address a non-human client that requires to validate and be approval to get to the information in Google APIs.

 Enter an “Administration account name”, by the same token “A Message Sender” or the name of your own task.

The new code we added here will attempt to peruse values from our Google accounting sheet utilizing the getting technique for the spreadsheets. values assortment and you can peruse more about this on Google’s documentation site.

Note that there are a few things that we shouldn’t impart to our code and the accounting sheet ID is one of them, so we’ll place it in another document: secrets.json, situated in the base of our application (keep this record safe and don’t disclose it). Here is the code design for secrets.json:

Something else to note is the reach reference for the information, characterized from A2 to D reach: ‘Sheet1!A2:D’. “Sheet1” is the name of our worksheet, A2 is the starting cell at section A-line 2, and D is the end cell, however, isn’t trailed by a number for the column so we’ll get every one of the columns.

The getting strategy returns a guarantee and when we have the reaction, the columns we’re requesting (response.data.values), we simply log them to the control centre yet later we’ll pass them to a “send message” work.

Run the application again utilizing the hub index.js order. We get “Validation fruitful.” yet followed by a blunder “Mistake: The guest doesn’t have authorization” and this is on the grounds that we have not shared at this point our bookkeeping sheet with the help account, as displayed in the beneath screen capture.