TikTok V3

This commit is contained in:
2026-07-09 18:18:17 +02:00
parent cc2522f7a4
commit 1a39593b29
3 changed files with 26 additions and 11 deletions

View File

@@ -56,12 +56,19 @@
- Do not treat a generic approval like "Go" as permission for automatic/direct TikTok publishing.
## TikTok Analytics (Display API, read-only)
- Both apps request the scopes `user.info.basic,user.info.stats,video.list,video.upload,video.publish`.
- The requested scopes MUST exactly match what each app has approved in the TikTok Developer Portal — requesting an unapproved scope aborts the whole OAuth login with a generic "scope" error.
- Approved scopes per app (as of 2026-07-09):
- QRMaster: `user.info.basic, user.info.profile, user.info.stats, video.list, video.upload` (NO `video.publish` — upload/draft only).
- GreenLens Pro: `user.info.basic, video.upload, video.publish` (NO analytics scopes yet — a portal revision adding `user.info.stats` + `video.list` is required before GreenLens analytics works).
- Admin-key-protected live analytics endpoints (no data is stored, every call reads fresh from TikTok):
- QRMaster: `GET /api/tiktok/analytics?key=<TIKTOK_ADMIN_KEY>&max_videos=50`
- GreenLens: `GET /api/tiktok/analytics` (guarded by the plant import admin key)
- Response: account stats (followers, total likes, video count) plus per-video views/likes/comments/shares with computed `engagement_rate`, `posted_weekday_utc` and `posted_hour_utc`, and a summary block (totals, average/median views).
- The new scopes must be enabled for the app in the TikTok Developer Portal, and accounts connected before the scope change must re-authorize via `/api/tiktok/connect` otherwise TikTok returns a scope error.
- After any scope change the account must re-authorize via `/api/tiktok/connect`, otherwise the stored token keeps the old permissions.
## TikTok Photo/Carousel Upload Notes
- Photo posts use `POST /v2/post/publish/content/init/` with `post_mode: MEDIA_UPLOAD` (draft in the creator's inbox, needs only `video.upload`). Valid post modes are only `MEDIA_UPLOAD` and `DIRECT_POST``DRAFT` is not a valid value.
- Photos are delivered via `source_info.photo_images` as public URLs (`PULL_FROM_URL`). TikTok only pulls from **verified domains** — verify the hosting domain (e.g. `greenlenspro.com` for MinIO storage URLs) under Content Posting API → "Verify domains" in the Developer Portal, otherwise the upload fails.
## Refresh Behavior
- Meta user/page tokens werden automatisch refreshed durch `python C:\Users\timo\Documents\meta_token_refresh.py`.