Cookie Monster Consumer Portal API
Cookie Monster is the unified consumer portal for RBS ecosystem B2B applications.
Base URL: https://cookies.redbroomsoftware.com
Overview
Cookie Monster provides:
- Consumer Portals: White-labeled customer-facing portals for B2B apps
- Consumer Identity: Link consumers across B2B tenants by phone/email
- Order History: View past orders from POS systems
- Invoice Requests: Request CFDI invoices for purchases
- Product Catalogs: Browse tenant product catalogs
Architecture
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Consumer │────▶│ Cookie Monster │────▶│ B2B App APIs │
│ (Browser) │ │ (Portal) │ │ (Caracol, etc) │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│
▼
┌──────────────────┐
│ Constanza │
│ (CFDI Stamping) │
└──────────────────┘1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
Cookie Monster acts as a middleware between consumers and B2B tenant APIs, providing:
- Authentication via phone/email linking
- Unified portal branding per tenant
- Invoice request routing to Constanza
Portal Registration
B2B apps register their portal configuration with Cookie Monster via the tenantPortals collection:
typescript
// Firestore: tenantPortals/{platformId}_{tenantId}
{
platformId: 'caracol',
tenantId: 'tenant-abc123',
slug: 'tacos-el-rey',
name: 'Tacos El Rey',
enabled: true,
tier: 'free' | 'premium',
branding: {
logoUrl: 'https://...',
brandColor: '#7C3AED',
welcomeMessage: 'Bienvenido a nuestro portal',
tagline: 'Los mejores tacos de la ciudad'
},
contact: {
phone: '+52 55 1234 5678',
email: 'contacto@tacoselrey.com',
whatsapp: '+52 55 1234 5678'
},
features: {
showCatalog: true,
allowInvoiceRequests: true,
showOrderHistory: true
},
syncedAt: '2026-01-28T12:00:00.000Z'
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Consumer Portal URLs
Portals are accessed via:
https://cookies.redbroomsoftware.com/{platformId}/{slug}1
Examples:
https://cookies.redbroomsoftware.com/caracol/tacos-el-reyhttps://cookies.redbroomsoftware.com/cosmos-pet/pet-shop-norte
Platform API Integration
Cookie Monster calls B2B platform APIs to fetch data. Each platform must implement the Consumer API contract.
Authentication
All requests include:
http
X-API-Key: <COOKIE_MONSTER_API_KEY>
X-Source-App: cookie-monster
Content-Type: application/json1
2
3
2
3
Required Endpoints (B2B Apps Must Implement)
| Endpoint | Method | Description |
|---|---|---|
/api/consumer/link/by-phone | GET | Find consumer by phone |
/api/consumer/link/by-email | GET | Find consumer by email |
/api/consumer/tenants/:tenantId/branding | GET | Get portal branding |
/api/consumer/tenants/:tenantId/catalog | GET | List products |
/api/consumer/tenants/:tenantId/consumers/:consumerId/orders | GET | Order history |
/api/consumer/tenants/:tenantId/invoice-requests | POST | Request invoice |
See Caracol Consumer API for a reference implementation.
Data Flow: Invoice Request
1. Consumer views order in portal
2. Clicks "Solicitar Factura"
3. Cookie Monster → POST /api/consumer/tenants/{id}/invoice-requests
4. B2B App creates invoice request record
5. B2B App → Constanza API for CFDI stamping
6. Consumer receives invoice via email1
2
3
4
5
6
2
3
4
5
6
Tier Features
| Feature | Free | Premium |
|---|---|---|
| Portal URL | ✅ | ✅ |
| Order History | ✅ | ✅ |
| Invoice Requests | ✅ | ✅ |
| Product Catalog | ✅ | ✅ |
| Custom Branding | ❌ | ✅ |
| Custom Domain | ❌ | ✅ |
| Priority Support | ❌ | ✅ |
Error Handling
Standard RBS error format:
json
{
"error": "Consumer not found",
"code": "CONSUMER_NOT_FOUND"
}1
2
3
4
2
3
4
Common Error Codes
| Code | HTTP Status | Description |
|---|---|---|
UNAUTHORIZED | 401 | Invalid API key or source app |
TENANT_NOT_FOUND | 404 | Portal not configured |
CONSUMER_NOT_FOUND | 404 | No consumer matches criteria |
PORTAL_DISABLED | 403 | Portal is disabled |
VALIDATION_ERROR | 400 | Invalid request data |
Related Documentation
- Caracol Consumer API - Reference implementation
- Constanza CFDI API - Invoice stamping
- Ecosystem Architecture