Send / schedule a template broadcast from an Excel/CSV
gambot_send_campaign_from_excelSend WhatsApp templates to contacts from an Excel/CSV by mapping columns to template variables and the phone column. Supports immediate or scheduled sends with opt-out compliance.
Instructions
Broadcast a WhatsApp TEMPLATE to everyone in an Excel/CSV the user gave you — the easiest way to do a mail-merge blast. YOU (the agent) read the sheet and pass: rows (one object per row, keyed by the column header), phoneColumn (which column holds the phone), and the variable mapping — either variableColumns (ordered: 1st column → {{1}}, 2nd → {{2}}, …) or variableMapping ({ var1:'ColName', var2:'ColName2' }). TIP: call gambot_get_template_variables first to see how many variables the template expects, then map columns to them. Sends immediately by default; to SCHEDULE add scheduling fields (scheduleType:'once' + runAt + timezone, or scheduleType:'repeated' + interval/intervalNumber/endCondition) — scheduled sends are saved as a campaign. Every original column is also stored per-recipient (rowData) so later automations can use any value by name. Compliance is built in: the org's ACTIVE opt-out flow (reply הסר/stop/unsubscribe) auto-excludes recipients from future broadcasts; the response echoes it under optOut (enabled=true) and your consent under consent.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | Yes | The sheet rows as objects keyed by column header, e.g. [{ "Name":"Dana", "Phone":"972501234567", "Order":"A-11" }]. | |
| runAt | No | First/only run datetime, e.g. 2026-07-01T09:00:00 (interpreted in `timezone`). | |
| message | No | Free-text message (used only when templateId is not provided). | |
| interval | No | ||
| timezone | No | IANA timezone, e.g. Asia/Jerusalem, America/New_York. | |
| templateId | No | Template id to broadcast (messageType=Template). Omit and set `message` for free text. | |
| phoneColumn | Yes | The column header that holds the phone number, e.g. 'Phone'. | |
| campaignName | No | If set (or any scheduling field is set) the campaign is SAVED; otherwise it's an immediate ad-hoc send. | |
| endCondition | No | { type:'none'|'until'|'count', value:'...' } | |
| fromNumberId | No | Sender Meta phone_number_id (multi-number orgs). | |
| scheduleType | No | ||
| defaultCountry | No | ISO-3166 alpha-2 (e.g. 'US','IL') to internationalize local/national phone numbers in the sheet. Optional if the organization has a saved country (set at onboarding); otherwise numbers must be full E.164 or the send is rejected. | |
| intervalNumber | No | Every N intervals (recurring). | |
| variableColumns | No | Ordered column headers mapped to template variables: [ col→{{1}}, col→{{2}}, … ]. | |
| variableMapping | No | Alternative to variableColumns: { var1:'ColName', var2:'ColName2' } (keys 'var1' or '1'). | |
| consentConfirmed | No | Assert you have consent to mail this list. Defaults to true. Recipients can always opt out (see `optOut` in the response). | |
| contactFieldColumns | No | Optional { contactFieldName: 'ColName' } — saved onto the contact (e.g. { email:'Email' }). |