> ## Documentation Index
> Fetch the complete documentation index at: https://docs.younegotiate.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Campaign Communications

> ABC Collections schedules a campaign for consumers like Jane.

## Real-World Example

ABC Collections schedules a campaign for consumers like Jane. At the scheduled daily run, the portal finds the campaign, snapshots the group, sends eligible Email, SMS, or EcoLetter messages in queued jobs, and updates campaign tracker results.

## Visual Flow

```mermaid placement="top-right" actions={true} theme={"system"}
flowchart TD
    A["Creditor campaign is scheduled for today"] --> B["Daily campaign command runs at 17:30"]
    B --> C["Portal snapshots eligible consumers"]
    C --> D["Queued jobs send Email, SMS, or EcoLetter"]
    D --> E{"Consumer permissions allow channel?"}
    E -->|Yes| F["Message is sent and tracked"]
    E -->|No| G["Message is skipped safely"]
    classDef default fill:#F8FAFC,stroke:#64748B,stroke-width:1.5px,color:#0F172A;
    classDef actor fill:#E0F2FE,stroke:#0284C7,stroke-width:2px,color:#0C4A6E;
    classDef system fill:#F8FAFC,stroke:#64748B,stroke-width:1.5px,color:#0F172A;
    classDef decision fill:#FEF3C7,stroke:#D97706,stroke-width:2px,color:#78350F;
    classDef risk fill:#FEE2E2,stroke:#DC2626,stroke-width:2px,color:#7F1D1D;
    classDef outcome fill:#DCFCE7,stroke:#16A34A,stroke-width:2px,color:#14532D;
    class A actor;
    class B,C,D,F,G system;
    class E decision;
    class G risk;
    class F outcome;
    linkStyle default stroke:#94A3B8,stroke-width:2px;
```

## How It Should Work

* It should process due creditor campaigns through scheduled commands and queued jobs.
* It should respect consumer permissions, opt-out state, and channel rules before sending.
* It should update campaign tracker counts for sent, viewed, downloaded, and action activity.
* It should handle EcoLetter deductions and records when EcoLetters are sent.

## How It Should Not Work

* It should not send campaign messages to consumers outside the selected group snapshot.
* It should not ignore unsubscribe or communication preference rules.
* It should not block the creditor portal page while sending a large campaign.

## Developer Notes

* RunCampaignCommand is scheduled daily at 17:30.
* Consumers are processed in chunks and individual messages are sent by queued jobs.
* EcoMail Hub / EcoPortal has its own campaign command, but consumer-facing EcoLetters still appear in EcoMailbox when delivered to a consumer.

## Related App Areas

* `app/Console/Kernel.php`
* `app/Console/Commands/RunCampaignCommand.php`
* `app/Jobs/ProcessCampaignConsumersJob.php`
* `app/Jobs/SendCampaignEmailSmsOrELetterJob.php`
* `app/Jobs/SendSingleCampaignMessageJob.php`
* `app/Services/CampaignTrackerService.php`
