SMS & Campaigns Overview

CRMBuilder has two overlapping systems for outbound messaging: Campaigns (bulk, scheduled, template-based) and SMS (individual messages logged in real time). Both share the same underlying phone infrastructure but write to different tables.

Tables

Table Purpose
campaigns Campaign definitions — name, status, schedule
campaigns_items One row per contact per campaign send
smslog Every individual SMS sent or received
sms_templates Reusable message templates with variable substitution

How they relate

When a campaign sends to a contact, it writes a row to campaigns_items and also writes the individual message to smslog. This means every campaign message is queryable both ways — as part of a campaign batch or as an individual SMS thread.

Campaign send
    ├── campaigns_items (batch record — status, scheduled_at, sent_at)
    └── smslog (individual message — from, to, text, direction)

Message direction

smslog.direction values:

Value Meaning
outbound Sent from the CRM to a contact
inbound Received from a contact

Inbound messages never create campaigns_items rows — they only write to smslog.