Overview
This workflow generates a weekly competitive intelligence report for up to 5 TikTok competitor accounts. For each competitor, it pulls their profile stats (followers, following, likes) and their recent posts with engagement data. The output is a structured report that marketing teams use to benchmark their TikTok performance, spot content trends competitors are riding, and identify gaps in their own strategy.
Trigger
Cron schedule (every Monday at 9:00 AM UTC)
Schedule
Runs every Monday at 9:00 AM UTC
Workflow Steps
Load competitor account list
Read the list of competitor TikTok usernames from configuration.
Pull profile stats for each competitor
Call Scavio TikTok /profile endpoint for each username to get follower count, total likes, and bio.
Pull recent posts for each competitor
Use the sec_user_id from profile data to call /user/posts and retrieve recent video performance.
Compute engagement benchmarks
Calculate average views, likes, and comments per video for each competitor to establish benchmarks.
Generate competitive report
Compile all data into a structured weekly report with week-over-week follower changes and top-performing content.
Python Implementation
import requests
import json
from pathlib import Path
from datetime import datetime
API_KEY = "your_scavio_api_key"
TIKTOK_URL = "https://api.scavio.dev/api/v1/tiktok"
COMPETITORS = ["competitor1", "competitor2", "competitor3", "competitor4", "competitor5"]
def get_profile(username: str) -> dict:
res = requests.post(
f"{TIKTOK_URL}/profile",
headers={"Authorization": f"Bearer {API_KEY}"},
json={"username": username},
timeout=15,
)
res.raise_for_status()
return res.json()
def get_recent_posts(sec_user_id: str) -> list[dict]:
res = requests.post(
f"{TIKTOK_URL}/user/posts",
headers={"Authorization": f"Bearer {API_KEY}"},
json={"sec_user_id": sec_user_id},
timeout=15,
)
res.raise_for_status()
return res.json().get("videos", [])
def run():
date = datetime.utcnow().strftime("%Y-%m-%d")
reports = []
for username in COMPETITORS:
profile = get_profile(username)
sec_uid = profile.get("sec_uid", "")
stats = {
"username": username,
"followers": profile.get("followers", 0),
"following": profile.get("following", 0),
"total_likes": profile.get("likes", 0),
"bio": profile.get("bio", ""),
}
posts = get_recent_posts(sec_uid) if sec_uid else []
post_data = []
for video in posts[:20]:
post_data.append({
"title": video.get("title", "")[:100],
"views": video.get("views", 0),
"likes": video.get("likes", 0),
"comments": video.get("comments", 0),
"shares": video.get("shares", 0),
})
avg_views = sum(p["views"] for p in post_data) / len(post_data) if post_data else 0
avg_likes = sum(p["likes"] for p in post_data) / len(post_data) if post_data else 0
reports.append({
**stats,
"posts_analyzed": len(post_data),
"avg_views": round(avg_views),
"avg_likes": round(avg_likes),
"top_post": max(post_data, key=lambda x: x["views"]) if post_data else None,
"recent_posts": post_data[:5],
})
output = {"date": date, "competitors": len(COMPETITORS), "reports": reports}
Path(f"tiktok_competitor_{date}.json").write_text(json.dumps(output, indent=2))
print(f"TikTok Competitor Report {date}")
for r in reports:
print(f" @{r['username']}: {r['followers']:,} followers, avg {r['avg_views']:,} views/video")
if __name__ == "__main__":
run()JavaScript Implementation
const API_KEY = "your_scavio_api_key";
const TIKTOK_URL = "https://api.scavio.dev/api/v1/tiktok";
const COMPETITORS = ["competitor1", "competitor2", "competitor3"];
async function getProfile(username) {
const res = await fetch(`${TIKTOK_URL}/profile`, {
method: "POST",
headers: { Authorization: `Bearer ${API_KEY}`, "content-type": "application/json" },
body: JSON.stringify({ username }),
});
if (!res.ok) throw new Error(`scavio ${res.status}`);
return res.json();
}
async function getRecentPosts(secUserId) {
const res = await fetch(`${TIKTOK_URL}/user/posts`, {
method: "POST",
headers: { Authorization: `Bearer ${API_KEY}`, "content-type": "application/json" },
body: JSON.stringify({ sec_user_id: secUserId }),
});
if (!res.ok) return [];
return (await res.json()).videos ?? [];
}
for (const username of COMPETITORS) {
const profile = await getProfile(username);
const posts = await getRecentPosts(profile.sec_uid ?? "");
const avgViews = posts.length ? Math.round(posts.reduce((s, v) => s + (v.views ?? 0), 0) / posts.length) : 0;
console.log(`@${username}: ${(profile.followers ?? 0).toLocaleString()} followers, avg ${avgViews.toLocaleString()} views`);
}Platforms Used
TikTok
Trending video, creator, and product discovery