GoAdmio

send

Send up to 15 queued WhatsApp messages (campaign/client ID 2) through rotating linked devices via mudslide, rate-limited per device

On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also


Overview

/go/send drains a WhatsApp send queue stored in MariaDB and dispatches each message through one of several WhatsApp-linked "device" sessions, using mudslide (run through npx). It rotates across devices, enforces a per-device send quota and a 5-minute cooldown between sends from the same device, and retires a device after repeated delivery failures.

It's meant to be run on a short, repeating schedule (for example, every minute from cron); each run processes at most 15 messages.

[!WARNING] This script references $MySQLRootPassword in every database query, but never defines it — there is no assignment to that variable anywhere in the script, and it doesn't source anything (such as /go/function) that would set it either. Compare this to backup and restore, which both derive it explicitly near the top of the script. Unless this variable is somehow exported into the environment before /go/send runs, every mariadb call here authenticates with an empty password, which will either fail outright or hang waiting for interactive input — meaning the queue is never actually read or sent. Check this before relying on the command; see Known issues.

The call is appended to /var/log/go/send.log.


Quick start

/go/send

If Node.js (and npx) isn't installed yet, the first run only installs it and exits; run the command again afterward to actually process the queue.


Syntax

/go/send

The command takes no arguments.


Options

None. Everything comes from GoAdmio's configuration and the CRM database:

Input Where it comes from
Queue and device database name /etc/wa, or crm if that file doesn't exist
Linked device sessions Subfolders of /whatsapp/
Per-device send quota, cooldown timer, failure count The Member table (keyed by phone number) and a failed counter file in each device's folder
Queued messages The Whatsapp table, filtered to CID=2 (see Known issues)

Output

Please wait 37 seconds

or, per message attempted:

----------------------------------------
Sender: 15551234567 (3/50)
Sending "Reminder" To 15559876543 (From /whatsapp/15551234567)...
Invalid mobile number 0123
Mobile 15551234567 not have an account

Examples

# Run it directly
/go/send
# Typical setup: run every minute from cron
* * * * * /go/send >> /var/log/go/send-cron.log 2>&1
# Check a device's quota and last-send time
sudo mariadb -N -e "select Mobile, Send, Max, TimeStamp from crm.Member where Mobile='15551234567'"

Troubleshooting

Symptom Likely cause Fix
Nothing is ever sent, with no clear error MySQLRootPassword is undefined (see the warning above), so every database query fails or hangs. Confirm whether this variable is actually exported from somewhere outside the script. If not, the script needs a line deriving it, the same way backup and restore do.
Please wait <n> seconds A message was successfully sent in the last 50 seconds. Wait, or see Known issues about the lock file's lifetime.
The command installs Node.js and exits without sending anything npx wasn't found, so the command ran nodejs and stopped. Run /go/send again after Node.js finishes installing.
Invalid mobile number <value> The recipient's number, after stripping non-digits, starts with 0 or is shorter than 10 digits. The message is deleted from the queue outright, not retried. Check the number format before queuing it.
Mobile <number> not have an account The folder under /whatsapp/ has no matching row in the Member table yet. A row is created automatically (see Details), but it starts with no quota, so no send happens through it this run.
A device stops sending permanently and its /whatsapp/<number> folder has vanished It reached more than 10 recorded delivery failures, and the folder (including its mudslide session) was deleted outright. Relink that WhatsApp number — the linked session is gone, not just paused. There is no automatic alert when this happens; see Known issues.
Messages for a different campaign/client never go out The queue query only selects rows where CID=2. This command doesn't process other CID values at all.
A new device's folder exists but never sends A freshly auto-created Member row has no quota (Max) set. Set a Max value for that mobile number in the Member table through whatever process normally provisions these devices.

Details

Per run

  1. Refuses to run if a message was sent in the last 50 seconds (see Known issues for how reliable this actually is).
  2. Installs Node.js and exits if npx isn't available.
  3. Reads up to 15 queued messages with CID=2 from <db>.Whatsapp, oldest first.
  4. For each message, rotates to the next folder under /whatsapp/ (shuffled once at the start of the run, then cycled through in order) and treats that folder's name as the sending device's mobile number.

Per message

  1. Strips everything but digits from the recipient number. Deletes the message outright if the result starts with 0 or has fewer than 10 digits.
  2. Looks up the device's Send (count), Max (quota), and TimeStamp (last send) from the Member table. If the device has no row yet (Max is 0), creates one — but see the data issue under Known issues.
  3. Only attempts a send if the device's Send is under its Max and at least 300 seconds have passed since its last send.
  4. Calls npx mudslide send <number> "<message>" -c <device-folder>, retrying once if the first attempt returns nothing.
  5. On success: deletes the message from the queue, increments the device's Send and lifetime Whatsapp counters, resets its failure counter, and pauses 3 seconds.
  6. On failure (empty result, an "error" in the result, or a result not containing "Done"): increments a failed counter file in the device's folder. Once that counter passes 10, deletes the entire device folder.

Known issues


See also

Command Description
nodejs Install the latest Node.js version on a GoAdmio server
mudslide Placeholder for WhatsApp helpers
backup Back up one or all accounts to local disk or remote storage, manually or on a schedule
restore Restore accounts, databases, SSL certificates, or folders from local or remote GoAdmio backups