# chrisscastaneda/pvg-ak-mailer-bot architecture

> Architecture diagram of the GitHub repository chrisscastaneda/pvg-ak-mailer-bot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chrisscastaneda/pvg-ak-mailer-bot
- Repository: https://github.com/chrisscastaneda/pvg-ak-mailer-bot

## Overview

This repository is an ActionKit mailer bot with a bundled Mailchimp PHP client. The main workflow accepts a subject and ProgressiveVotersGuide URLs, fetches each page, inlines its CSS, and stages customized email content in ActionKit. The Mailchimp client also exposes broader account, list, campaign, reporting, and content-management APIs, though the bot’s sampled workflow visibly uses it for CSS inlining. Some bot processing is omitted from the excerpt, so only documented or directly shown links are drawn.

Main entry points: [`Mailchimp.php`](https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp.php) (API transport client), [`ak-pvg-mailer.php`](https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/ak-pvg-mailer.php) (Mailer workflow), [`Mailchimp/Campaigns.php`](https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Campaigns.php) (Campaign management), [`Mailchimp/Lists.php`](https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Lists.php) (Audience and lists)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bot["Mailer bot"]
  node_mailer["Mailer workflow<br/>[ak-pvg-mailer.php]"]
end

subgraph group_client["Mailchimp client"]
  node_api_client["API transport client<br/>[Mailchimp.php]"]
end

subgraph group_resources["Mailchimp resources"]
  node_campaigns["Campaign management<br/>[Campaigns.php]"]
  node_lists["Audience and lists<br/>[Lists.php]"]
  node_reports["Campaign reports<br/>[Reports.php]"]
  node_conversations["Conversations<br/>[Conversations.php]"]
  node_ecomm["E-commerce tracking<br/>[Ecomm.php]"]
  node_folders["Template folders<br/>[Folders.php]"]
  node_gallery["File gallery<br/>[Gallery.php]"]
  node_goals["Goals<br/>[Goal.php]"]
  node_mobile["Mobile features<br/>[Mobile.php]"]
  node_neapolitan["Neapolitan<br/>[Neapolitan.php]"]
  node_templates["Email templates<br/>[Templates.php]"]
  node_users["Account users<br/>[Users.php]"]
  node_vip["VIP members<br/>[Vip.php]"]
end

subgraph group_support["Client support"]
  node_helper["Account and HTML helpers<br/>[Helper.php]"]
  node_exceptions["API exceptions<br/>[Exceptions.php]"]
end

node_operator(("Mailer operator"))
node_pvg["PVG content pages"]
node_actionkit["ActionKit mailing API"]
node_mailchimp_service["Mailchimp API"]

node_operator -->|"submits URLs"| node_mailer
node_mailer -->|"fetches HTML"| node_pvg
node_mailer -->|"inlines CSS"| node_helper
node_mailer -->|"stages mailings"| node_actionkit
node_mailer -->|"initializes client"| node_api_client
node_api_client -->|"sends API calls"| node_mailchimp_service
node_campaigns -->|"calls API"| node_api_client
node_lists -->|"calls API"| node_api_client
node_reports -->|"calls API"| node_api_client
node_conversations -->|"uses client"| node_api_client
node_ecomm -->|"uses client"| node_api_client
node_folders -->|"uses client"| node_api_client
node_gallery -->|"uses client"| node_api_client
node_goals -->|"uses client"| node_api_client
node_mobile -->|"uses client"| node_api_client
node_neapolitan -->|"uses client"| node_api_client
node_templates -->|"uses client"| node_api_client
node_users -->|"uses client"| node_api_client
node_vip -->|"uses client"| node_api_client
node_api_client -->|"throws errors"| node_exceptions

click node_mailer "https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/ak-pvg-mailer.php"
click node_api_client "https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp.php"
click node_campaigns "https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Campaigns.php"
click node_lists "https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Lists.php"
click node_reports "https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Reports.php"
click node_conversations "https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Conversations.php"
click node_ecomm "https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Ecomm.php"
click node_folders "https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Folders.php"
click node_gallery "https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Gallery.php"
click node_goals "https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Goal.php"
click node_mobile "https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Mobile.php"
click node_neapolitan "https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Neapolitan.php"
click node_templates "https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Templates.php"
click node_users "https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Users.php"
click node_vip "https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Vip.php"
click node_helper "https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Helper.php"
click node_exceptions "https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Exceptions.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_mailer toneBlue
class node_api_client toneAmber
class node_campaigns,node_lists,node_reports,node_conversations,node_ecomm,node_folders,node_gallery,node_goals,node_mobile,node_neapolitan,node_templates,node_users,node_vip,node_actionkit,node_mailchimp_service toneMint
class node_helper,node_exceptions toneRose
class node_operator,node_pvg toneIndigo
```

## Components

### Mailer bot

- [Mailer workflow](https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/ak-pvg-mailer.php): `ak-pvg-mailer.php`

### Mailchimp client

- [API transport client](https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp.php): `Mailchimp.php`

### Mailchimp resources

- [Campaign management](https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Campaigns.php): `Mailchimp/Campaigns.php`
- [Audience and lists](https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Lists.php): `Mailchimp/Lists.php`
- [Campaign reports](https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Reports.php): `Mailchimp/Reports.php`
- [Conversations](https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Conversations.php): `Mailchimp/Conversations.php`
- [E-commerce tracking](https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Ecomm.php): `Mailchimp/Ecomm.php`
- [Template folders](https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Folders.php): `Mailchimp/Folders.php`
- [File gallery](https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Gallery.php): `Mailchimp/Gallery.php`
- [Goals](https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Goal.php): `Mailchimp/Goal.php`
- [Mobile features](https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Mobile.php): `Mailchimp/Mobile.php`
- [Neapolitan](https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Neapolitan.php): `Mailchimp/Neapolitan.php`
- [Email templates](https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Templates.php): `Mailchimp/Templates.php`
- [Account users](https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Users.php): `Mailchimp/Users.php`
- [VIP members](https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Vip.php): `Mailchimp/Vip.php`

### Client support

- [Account and HTML helpers](https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Helper.php): `Mailchimp/Helper.php`
- [API exceptions](https://github.com/chrisscastaneda/pvg-ak-mailer-bot/blob/master/Mailchimp/Exceptions.php): `Mailchimp/Exceptions.php`

### Other components

- **Mailer operator**
- **PVG content pages**
- **ActionKit mailing API**
- **Mailchimp API**

## Connections

- Mailer operator → Mailer workflow: submits URLs (evidence: `ak-pvg-mailer.php`)
- Mailer workflow → PVG content pages: fetches HTML (evidence: `ak-pvg-mailer.php`)
- Mailer workflow → Account and HTML helpers: inlines CSS (evidence: `ak-pvg-mailer.php`)
- Mailer workflow → ActionKit mailing API: stages mailings (evidence: `README.md`)
- Mailer workflow → API transport client: initializes client (evidence: `ak-pvg-mailer.php`)
- API transport client → Mailchimp API: sends API calls (evidence: `Mailchimp.php`)
- Campaign management → API transport client: calls API (evidence: `Mailchimp/Campaigns.php`)
- Audience and lists → API transport client: calls API (evidence: `Mailchimp/Lists.php`)
- Campaign reports → API transport client: calls API (evidence: `Mailchimp/Reports.php`)
- Conversations → API transport client: uses client (evidence: `Mailchimp/Conversations.php`)
- E-commerce tracking → API transport client: uses client (evidence: `Mailchimp/Ecomm.php`)
- Template folders → API transport client: uses client (evidence: `Mailchimp/Folders.php`)
- File gallery → API transport client: uses client (evidence: `Mailchimp/Gallery.php`)
- Goals → API transport client: uses client (evidence: `Mailchimp/Goal.php`)
- Mobile features → API transport client: uses client (evidence: `Mailchimp/Mobile.php`)
- Neapolitan → API transport client: uses client (evidence: `Mailchimp/Neapolitan.php`)
- Email templates → API transport client: uses client (evidence: `Mailchimp/Templates.php`)
- Account users → API transport client: uses client (evidence: `Mailchimp/Users.php`)
- VIP members → API transport client: uses client (evidence: `Mailchimp/Vip.php`)
- API transport client → API exceptions: throws errors (evidence: `Mailchimp.php`)
