Files

136 lines
5.1 KiB
Markdown

# 2026-05-12
## TikTok App Review — Submission Prep
### Completed
1. **URL verification (squaremcp.com root)**
- Added `tiktokIIxGZsCAoYNJVObSA8cYj8FyWrAu1nIW.txt` to site root
- Added `tiktokwJMUoUxgRBFO9T8p08qlMgtsez0Ktr9y.txt` to site root (production)
- Rebuilt and redeployed squaremcp-site
- Verified both files accessible at `https://squaremcp.com/`
2. **Fixed token resolution bug**
- `resolveToken()` was looking for `TIKTOK_TIKTOK_ACCESS_TOKEN` when account="tiktok"
- Added fallback to `TIKTOK_DEFAULT_ACCESS_TOKEN`
- Rebuilt and redeployed Hermes
3. **Fixed sandbox privacy level**
- Unaudited apps MUST use `SELF_ONLY` privacy
- Changed `createVideo()` to prefer `SELF_ONLY` when `PUBLIC_TO_EVERYONE` unavailable
- Video publish now works end-to-end
4. **Demo video recorded**
- File: `product/site/tiktok-demo-video.mp4`
- Duration: 2:36, Size: 1.2 MB
- Shows full flow: connect → profile → creator info → publish → status check
5. **Vault documentation saved**
- `SquareMCP/TikTok App Review Submission.md` — complete submission package
### Live Verification
```bash
# Profile
curl -s "https://hermes.squaremcp.com/api/tiktok/profile?account=tiktok" \
-H "x-api-key: 114521f3f9e6858480d6269446a446ef"
# Publish
curl -s -X POST "https://hermes.squaremcp.com/api/tiktok/video" \
-H "x-api-key: 114521f3f9e6858480d6269446a446ef" \
-H "Content-Type: application/json" \
-d '{"video_url":"https://squaremcp.com/squaremcp-tiktok-launch.mp4","title":"Test","account":"tiktok"}'
# Status → PUBLISH_COMPLETE
```
### ChatGPT Custom GPT OpenAPI Split — Completed 2026-05-21
- **Problem discovered**: ChatGPT Custom GPTs have a **25 endpoint limit**. The original `/openapi-chatgpt.json` had **29 paths**, causing endpoints to be silently dropped.
- **Root cause**: Email REST handlers (`/api/email/*`) were missing from `src/index.ts` — added and deployed.
- **Solution**: Split into focused OpenAPI specs, all under 25 endpoints:
| Spec | Endpoints | Paths | Use Case |
|------|-----------|-------|----------|
| `/openapi-mail.json` | Email + Obsidian | 8 | Mail & notes GPT |
| `/openapi-social.json` | All social platforms | 24 | Full social media GPT |
| `/openapi-messaging.json` | Email + WhatsApp + Telegram + Discord | 12 | Messaging GPT |
| `/openapi-media.json` | Instagram + TikTok + Facebook media + LinkedIn video + Twitter video | 11 | Graphics & video GPT |
| `/openapi-chatgpt.json` | Everything (legacy) | 29 | **Deprecated** — exceeds limit |
| `/openapi.json` | Everything | 35 | Non-ChatGPT consumers |
---
## Facebook Integration Testing
### Fixed
- `src/clients/facebook.ts` — `getPosts()` endpoint changed from `/feed` to `/published_posts`
- Rebuilt and redeployed Hermes
### Credentials configured
- `FACEBOOK_DEFAULT_ACCESS_TOKEN` (page token for Squaremcp)
- `FACEBOOK_DEFAULT_PAGE_ID` = `1152192567968569`
### Test results
```bash
# Page info ✅
curl -s "https://hermes.squaremcp.com/api/facebook/page?account=default" -H "x-api-key: $API_KEY"
# Posts ✅
curl -s "https://hermes.squaremcp.com/api/facebook/posts?limit=3&account=default" -H "x-api-key: $API_KEY"
# Text post ✅
curl -s -X POST "https://hermes.squaremcp.com/api/facebook/post" \
-H "x-api-key: $API_KEY" \
-d '{"message":"Testing SquareMCP Facebook integration","account":"default"}'
# Photo post ✅ (JPG only — SVG rejected)
curl -s -X POST "https://hermes.squaremcp.com/api/facebook/photo" \
-H "x-api-key: $API_KEY" \
-d '{"image_url":"https://picsum.photos/800/600.jpg","caption":"SquareMCP test","account":"default"}'
# Video post ✅
curl -s -X POST "https://hermes.squaremcp.com/api/facebook/video" \
-H "x-api-key: $API_KEY" \
-d '{"video_url":"https://squaremcp.com/squaremcp-tiktok-launch.mp4","description":"Testing video","account":"default"}'
```
### Platforms still needing credentials
| Platform | Missing Env Vars |
|---|---|
| Instagram | `INSTAGRAM_DEFAULT_ACCESS_TOKEN`, `INSTAGRAM_DEFAULT_BUSINESS_ACCOUNT_ID` |
| Discord | `DISCORD_DEFAULT_BOT_TOKEN` |
---
## SaaS Implementation Summary
### Phase 1: Auth Foundation
- JWT session cookies (7-day expiry, httpOnly, secure, SameSite=strict)
- Password hashing with bcrypt (12 rounds)
- First user auto-promoted to admin/enterprise
- `requireAuth` supports 4 methods: global API key, customer API key, OAuth Bearer, JWT cookie
### Phase 2: Credential Storage
- Generic `POST /api/connect/:platform` endpoint
- `GET /api/connections` status check
- AES-256-GCM encrypted per-user credentials in Redis
- `callTool()` wrapper passes customer to `handleToolCall`
### Phase 3: Usage & Billing
- `usage_logs` table tracks every successful tool call
- Plan limits: Free=100/mo, Starter=1000/mo, Growth=10000/mo, Enterprise=unlimited
- Invoice generation: $0.05/action from usage data
- Admin can generate/send/mark-paid invoices
### Phase 4: Web App
- `https://app.squaremcp.com` deployed
- Dark theme, responsive grid
- Platform cards with connection modals
- Usage bar with warning/danger states
- Invoice list
- Admin panel with customer table
### URLs
- App: `https://app.squaremcp.com`
- API: `https://hermes.squaremcp.com`