obsidian/wiki/tech-patterns/box-api-integration.md
2026-04-15 10:48:47 +01:00

73 lines
3 KiB
Markdown

---
title: "Box API Integration"
aliases: [box-api, box]
tags: [box, api, integration, ford, loreal, ferrero]
sources: [01 Projects/ford_qc, 01 Projects/ford-gechub-sftp, 01 Projects/loreal-global-kickoff, 01 Projects/ferrero-ac-creator]
created: 2026-04-15
updated: 2026-04-15
---
# Box API Integration
Box is used as the file storage and workflow layer for several client integrations. Oliver Agency uses Box for asset handoff with Ford, L'Oréal, and Ferrero.
## Key Takeaways
- Ford uses Box JWT auth (`ford_box_config.json`) — service account model
- L'Oréal and Ferrero use Box API for folder-based asset submission workflows
- Ford QC monitors specific Box folder IDs (hardcoded in profile JSON, not config)
- Box folder IDs are stable identifiers — use them, don't rely on folder names
## When to Use
Any client project where files are exchanged via Box. Box is the primary asset handoff platform for Ford, L'Oréal, Ferrero.
## Key Details
### Auth Methods
| Project | Auth Method | Config |
|---------|------------|--------|
| Ford QC | JWT (service account) | `ford_box_config.json` |
| Ford SFTP | Box API | env vars |
| L'Oréal | Box API | env vars |
| Ferrero | Box API | env vars |
### Ford Box Folder IDs
| Purpose | Folder ID |
|---------|-----------|
| Input hotfolder | 332861865120 |
| Reports output | 332864939558 |
| Archive (processed) | 332861653811 |
### Common Operations
```python
# Download file from Box
client = Client(auth=JWTAuth.from_settings_file('ford_box_config.json'))
file_content = client.file(file_id).content()
# Upload to Box
folder = client.folder(folder_id)
folder.upload_stream(file_stream, 'filename.zip')
# List folder contents
items = client.folder(folder_id).get_items()
```
### Make.com Webhook Integration
L'Oréal Global Kickoff sends Box submission metadata to Make.com via webhook on form submit.
## Projects Using This Pattern
- [[01 Projects/ford_qc/Ford QC System|Ford QC System]] — JWT auth, monitors 3 folder IDs, uploads HTML reports, archives processed files
- [[01 Projects/ford-gechub-sftp/Ford SFTP Transfer|Ford SFTP Transfer]] — Download from Box (3 envs), upload to GECHUB SFTP
- [[01 Projects/loreal-global-kickoff/Loreal Global Kickoff|L'Oréal Global Kickoff]] — Asset submission form + Make.com webhook
- [[01 Projects/ferrero-ac-creator/Ferrero AC Booking Tool|Ferrero AC Booking]] — "Send to OMG" saves CSV to Box folder
## Gotchas & Lessons
- JWT config file (`ford_box_config.json`) must not be committed — it's a service account credential
- Box folder IDs are numeric strings — store in config, not hardcoded in logic
- Ford has 3 environments (PROD/EDU/QA) each with separate Box folders and SFTP targets
- Hotfolder daemon should archive processed files to prevent reprocessing (Ford QC pattern)
- Box webhooks have retry logic — design idempotent handlers
## Related
- [[wiki/architecture/hotfolder-daemon|hotfolder-daemon]] — Ford QC Box monitoring pattern
- [[wiki/client-knowledge/ford|ford]] — Ford-specific context
- [[wiki/client-knowledge/loreal|loreal]] — L'Oréal-specific context