Integrations / Google Sheets

Google Sheets logo

Spreadsheets · Apps Script

Google Sheets + Sendjade

Add a "Send WhatsApp" menu to any sheet with Google Apps Script.

Works with the live API

What you can automate

  • Send reminders to everyone marked Unpaid
  • Notify customers when a row changes
  • Write delivery status back into the sheet

Before you start

  • A Sendjade account with a connected instance (status Authorized). See Getting started.
  • Your **idInstance** (shown on the instance page in the console) and **apiTokenInstance** (shown once when you created the instance; press Generate new token if you lost it). Use a spare number while testing.
  • A Google account and a sheet with phone, message and status columns.

Set it up

  1. Open Apps Script

    In your sheet choose Extensions, Apps Script and paste the script.

    Code.gs
    function onOpen() {
      SpreadsheetApp.getUi().createMenu('Sendjade').addItem('Send WhatsApp messages', 'sendRows').addToUi();
    }
    
    function sendRows() {
      const sheet = SpreadsheetApp.getActiveSheet();
      const rows = sheet.getDataRange().getValues();
      const props = PropertiesService.getScriptProperties();
      const url = 'https://api.sendjade.com/waInstance' + props.getProperty('SENDJADE_ID_INSTANCE') + '/sendMessage/' + props.getProperty('SENDJADE_TOKEN_INSTANCE');
      for (let i = 1; i < rows.length; i++) {
        const [phone, text, status] = rows[i];
        if (!phone || status === 'queued') continue;
        const res = UrlFetchApp.fetch(url, {
          method: 'post',
          contentType: 'application/json',
          headers: { 'Idempotency-Key': 'sheet-' + sheet.getName() + '-' + (i + 1) },
          payload: JSON.stringify({ chatId: String(phone).replace(/\D/g, ''), message: String(text) }),
          muteHttpExceptions: true,
        });
        sheet.getRange(i + 1, 3).setValue(res.getResponseCode() === 200 ? 'queued' : 'error ' + res.getResponseCode());
      }
    }
  2. Store the credentials safely

    In Project Settings, Script properties add SENDJADE_ID_INSTANCE and SENDJADE_TOKEN_INSTANCE. Do not paste them into the code.

  3. Authorise and run

    Reload the sheet, use the new Sendjade menu and accept the permission prompt the first time.

Test it

Add one row with your own number and run the menu item. Column C becomes "queued".

Troubleshooting

Phone numbers lose their leading +

The script strips everything except digits, so a missing + is fine. Just make sure the country code is present.

Exceeded maximum execution time

Apps Script stops after about 6 minutes. Send in batches and keep the status column up to date so reruns skip finished rows.

I get 401 unauthorized

The idInstance or token in the URL is wrong. Copy both again from the console. Generating a new token makes the old one stop working immediately.

I get 409 instance_not_connected

The instance is not Authorized yet. Open it in the console, press Connect and scan the QR code.

I get 400 invalid_chat_id

Use international format with digits only, e.g. 2348012345678 (or 2348012345678@c.us). Remove spaces, dashes and the leading zero of the local number.

I get 422 recipient_opted_out

That person replied STOP (or was added to the opt-out list). Sendjade refuses to message them. Remove the number from Opt-outs only if they asked to hear from you again.

I get 429 daily_limit_reached or rate_limited

The number reached its 24-hour sending cap (default 500) or you are calling too fast. The cap protects your number from restriction. Slow down, and raise the cap only if your volume is genuine.

Ask AI to help me integrate Google Sheets

Copy this prompt into ChatGPT, Claude or any assistant. It already knows Sendjade’s API, so the answer matches our endpoints.

The prompt is plain text that you copy yourself. Never paste real keys into an assistant; use placeholders.