Overview
This workflow tracks TikTok hashtag performance weekly by querying Scavio TikTok API for each tracked hashtag's view count, video count, and engagement metrics. It stores weekly snapshots to build trend data, detects sudden spikes or drops in hashtag performance, and generates a report for marketing teams. Use it to monitor campaign hashtags, track competitor branded tags, and identify emerging trends in your category.
Trigger
Cron schedule (every Monday at 9:00 AM UTC)
Schedule
Runs every Monday at 9:00 AM UTC
Workflow Steps
Load tracked hashtag list
Read the list of hashtags to monitor from configuration, including campaign and competitor tags.
Query TikTok hashtag data
Call Scavio TikTok hashtag endpoint for each tracked tag to get current view counts and video metrics.
Compare against previous week
Load last week's snapshot and calculate week-over-week changes in views and video count.
Flag anomalies
Detect hashtags with unusual growth or decline compared to their rolling average.
Generate weekly report
Compile a ranked hashtag performance report with trends and anomaly flags.
Python Implementation
import requests
import json
from datetime import datetime
from pathlib import Path
API_KEY = "your_scavio_api_key"
TIKTOK_URL = "https://api.scavio.dev/api/v1/tiktok"
def check_hashtag(hashtag: str) -> dict:
res = requests.post(
f"{TIKTOK_URL}/hashtag",
headers={"Authorization": f"Bearer {API_KEY}"},
json={"hashtag": hashtag},
timeout=15,
)
if not res.ok:
return {"hashtag": hashtag, "views": 0, "videos": 0, "error": True}
data = res.json()
return {
"hashtag": hashtag,
"views": data.get("view_count", 0),
"videos": data.get("video_count", 0),
"error": False,
}
def run():
date = datetime.utcnow().strftime("%Y-%m-%d")
hashtags = ["#scavio", "#searchapi", "#webscraping", "#aitools", "#n8nautomation", "#openwebui"]
results = []
for tag in hashtags:
data = check_hashtag(tag.lstrip("#"))
results.append(data)
results.sort(key=lambda x: x["views"], reverse=True)
report = {"date": date, "hashtags_tracked": len(hashtags), "results": results}
Path(f"tiktok_hashtags_{date}.json").write_text(json.dumps(report, indent=2))
print(f"TikTok hashtag tracker {date}:")
for r in results:
print(f" {r['hashtag']}: {r['views']:,} views, {r['videos']:,} videos")
if __name__ == "__main__":
run()JavaScript Implementation
const API_KEY = "your_scavio_api_key";
const T = "https://api.scavio.dev/api/v1/tiktok";
async function checkHashtag(hashtag) {
const res = await fetch(`${T}/hashtag`, {
method: "POST",
headers: { Authorization: `Bearer ${API_KEY}`, "content-type": "application/json" },
body: JSON.stringify({ hashtag }),
});
if (!res.ok) return { hashtag, views: 0, videos: 0 };
const data = await res.json();
return { hashtag, views: data.view_count ?? 0, videos: data.video_count ?? 0 };
}
const tags = ["scavio", "searchapi", "webscraping", "aitools"];
for (const tag of tags) {
const r = await checkHashtag(tag);
console.log(`#${r.hashtag}: ${r.views.toLocaleString()} views, ${r.videos.toLocaleString()} videos`);
}Platforms Used
TikTok
Trending video, creator, and product discovery