Communication: hbf-reports
1-hop view of how this service communicates with its siblings. For the full system view, see service-communication.md.
Calls Out To
| Service | Protocol | Purpose | Key calls / queues |
|---|---|---|---|
| hbf-core | HTTP (hbf-core-api) | 10+ analytics API methods (summary, live chat, automated answers, interviews, decision trees, user feedback, missed questions, CSAT), org info, tenant data, bot deployments | Analytics fetch for report generation |
| MySQL | TypeORM | Scheduled report persistence | ScheduledReport, ScheduledReportExport entities |
| SMTP | nodemailer | Sends scheduled reports to recipients | Email delivery with PDF attachments |
Called By
| Service | Protocol | How |
|---|---|---|
| hbf-console (or any HTTP client) | REST API | Report schedule management |
Report Triggers
- Weekly cron:
0 0 0 * * 1(Monday 00:00 UTC) sends weekly reports - Monthly cron:
0 5 0 1 * *(1st of month 00:05 UTC) sends monthly reports - Manual trigger:
GET /organization/:orgId/report/schedule/trigger/:id
Contracts
Inbound
| Method | Path | Purpose |
|---|---|---|
| GET | /organization/:orgId/report/schedule/ | List schedules |
| POST | /organization/:orgId/report/schedule/ | Create schedule |
| PUT | /organization/:orgId/report/schedule/:id | Update schedule |
| DELETE | /organization/:orgId/report/schedule/:id | Delete schedule |
| GET | /organization/:orgId/report/schedule/trigger/:id | Manual trigger |
| GET | /organization/:orgId/report/export/ | On-demand export (streams PDF) |
Outbound
| Target | Auth | Env Vars |
|---|---|---|
| hbf-core | Bearer token (CORE_TOKEN) | CORE_URL, CORE_TOKEN |
| MySQL | Credentials | DB_HOST, DB_PORT, DB_USERNAME, DB_PASSWORD, DB_NAME |
| SMTP | SMTP credentials | EMAIL_* |
Additional env vars: CONSOLE_URL (used in email links)