Integrations / MS Excel

MS Excel logo

Spreadsheets · VBA macro

MS Excel + Sendjade

Send a WhatsApp message to every row of a spreadsheet with one macro.

Works with the live API

What you can automate

  • Send payment reminders to every customer in a debtors list
  • Mail-merge style notifications from a worksheet
  • Mark rows as sent or failed automatically

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.
  • Desktop Excel for Windows with macros enabled (.xlsm).

Set it up

  1. Lay out the sheet

    Column A = phone in international format, column B = message, column C = status (written by the macro).

  2. Add the macro

    Press Alt+F11, Insert, Module, and paste the code. Keep the idInstance and token in Windows environment variables named SENDJADE_ID_INSTANCE and SENDJADE_TOKEN_INSTANCE rather than in the file.

    VBA
    Sub SendWhatsApp()
      Dim ws As Worksheet: Set ws = ActiveSheet
      Dim url As String
      url = "https://api.sendjade.com/waInstance" & Environ("SENDJADE_ID_INSTANCE") & "/sendMessage/" & Environ("SENDJADE_TOKEN_INSTANCE")
      Dim r As Long: r = 2
      Do While ws.Cells(r, 1).Value <> ""
        Dim msg As String
        msg = Replace(Replace(Replace(ws.Cells(r, 2).Value, "\", "\\"), """", "\"""), vbLf, "\n")
        Dim body As String
        body = "{""chatId"":""" & ws.Cells(r, 1).Value & """,""message"":""" & msg & """}"
        With CreateObject("MSXML2.XMLHTTP.6.0")
          .Open "POST", url, False
          .setRequestHeader "Content-Type", "application/json"
          .setRequestHeader "Idempotency-Key", "xl-" & ws.Name & "-" & r
          .send body
          ws.Cells(r, 3).Value = IIf(.Status = 200, "queued", "error " & .Status)
        End With
        r = r + 1
      Loop
    End Sub
  3. Run it

    Press Alt+F8, choose SendWhatsApp and Run. Start with two rows that go to your own numbers. Re-running is safe: the idempotency key stops a row being sent twice.

Test it

Put your own number in row 2. Column C should say "queued" and the message should arrive on your phone.

Troubleshooting

Excel blocks the macro

Save as .xlsm and enable macros for this file (File, Options, Trust Center).

Messages with quotes or line breaks fail

The macro escapes quotes, backslashes and line breaks. If you still see errors, check the status code written in column C.

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 MS Excel

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.