Package Information
Documentation
n8n-nodes-tiktok
This is an n8n community node that integrates with the TikTok API. It allows you to automate tasks such as uploading videos, retrieving user statistics, and accessing detailed video analytics directly within your n8n workflows.
TikTok is a leading short-form video hosting service with over 1 billion monthly active users worldwide. This node provides comprehensive access to TikTok's Content Posting API, Display API, and user information endpoints, enabling powerful automation capabilities for TikTok creators and businesses.
Operations
This n8n node supports the following operations across various TikTok API resources:
Video Resource
- Upload: Upload videos to TikTok (supports both 'inbox' for manual publishing and 'direct post' for automatic publishing).
- Publish: Publish uploaded videos from your TikTok inbox with custom metadata like title, description, and privacy settings.
- List: Retrieve a paginated list of the user's videos.
- Get Status: Check the upload and publishing status of a specific video.
User Resource
- Get Profile: Fetch detailed user profile information, including display name, username, avatar URL, bio description, verification status, and profile deep link.
- Get Stats: Obtain comprehensive user statistics, such as follower count, following count, total likes received, and total video count.
Analytics Resource
- Get Video Analytics: Access in-depth analytics for specific videos, including view count, like count, comment count, and share count.
- Get Performance Metrics: Get overall performance metrics for the user's account, providing insights into their content's reach and engagement.
Authentication and Token Management
This node uses a direct token input method with robust automatic token refresh capabilities, simplifying the authentication process for n8n users.
Required Credentials
To configure this node, you need the following information from your TikTok Developer account:
- Client Key: Your application's unique client key.
- Client Secret: Your application's secret key.
- Access Token: An initial valid access token, typically obtained through TikTok's OAuth flow. This token has a short lifespan (24 hours).
- Refresh Token: A long-lived refresh token, also obtained through the OAuth flow. This token is valid for up to 365 days.
Automatic Token Refresh Logic
The node is designed to handle token expiration seamlessly:
- When an API call is made and the
Access Token
is found to be expired or invalid (e.g., HTTP 401/403 errors or specific TikTok API error codes like 10002/10003), the node automatically attempts to refresh it. - It uses the provided
Refresh Token
and yourClient Key
andClient Secret
to request a newAccess Token
from TikTok's OAuth endpoint (/v2/oauth/token/
). - Upon successful refresh, the new
Access Token
is used for the original API request, which is then retried. This process is transparent to the user, ensuring uninterrupted workflow execution. - This mechanism eliminates the need for manual token renewal every 24 hours, significantly improving the reliability and ease of use for long-running workflows.
Required Scopes
To ensure full functionality of all operations, your TikTok application must be authorized with the following scopes:
user.info.basic
user.info.profile
user.info.stats
video.list
video.upload
video.publish
This comprehensive approach to authentication ensures that your n8n workflows can reliably interact with the TikTok API without frequent manual intervention.
Table of Contents
Installation
Follow the installation guide in the n8n community nodes documentation.
You can install this node via the n8n community package manager:
npm install n8n-nodes-tiktok
Compatibility
- Minimum n8n version: 0.198.0
- Tested with n8n versions: 0.198.0+
- Node version: Requires Node.js 20.15+
Usage Examples
Example 1: Upload Video to TikTok
{
"resource": "video",
"operation": "upload",
"videoUrl": "https://example.com/my-video.mp4",
"uploadType": "inbox",
"title": "My Amazing Video",
"description": "Check out this cool video! #trending #viral",
"privacy": "PUBLIC_TO_EVERYONE"
}
Example 2: Get User Statistics
{
"resource": "user",
"operation": "getStats",
"statsFields": ["follower_count", "following_count", "likes_count", "video_count"]
}
Example 3: Get Video Analytics
{
"resource": "analytics",
"operation": "getVideoAnalytics",
"videoIds": ["7034682002927550598", "7035783003928561699"],
"analyticsFields": ["id", "title", "view_count", "like_count", "comment_count", "share_count"]
}
Example Workflow: Auto-Upload with Analytics Tracking
- HTTP Request → Fetch video from your content system
- TikTok (Upload) → Upload video to TikTok inbox
- Wait → Wait for processing (2-3 minutes)
- TikTok (Get Status) → Check upload status
- TikTok (Analytics) → Track performance after 24 hours
API Limitations
- Video upload: Max 20 videos per request for analytics
- File size: Follow TikTok's video requirements (typically up to 500MB)
- Rate limits: Respect TikTok's API rate limits
- Processing time: Videos take 30 seconds to 2 minutes to process
TikTok Requirements
Domain Verification
For pull URL uploads, you must verify domain ownership with TikTok by:
- Adding DNS TXT records, or
- Uploading a verification file to your domain
App Review Process
To use Direct Post functionality:
- Your app must be intended for public use (not internal/private)
- Submit detailed app review documentation
- Provide demo videos showing complete integration flow
- Wait 1-2 weeks for approval
Common Issues & Troubleshooting
Upload Errors
- Invalid video URL: Ensure the video URL is publicly accessible
- Domain not verified: Complete TikTok's domain verification process
- File format: Use supported formats (MP4, MOV, WEBM)
Authentication Issues
- Token expired: Tokens are automatically refreshed every 24 hours
- Insufficient scopes: Ensure all required scopes are approved
- App not approved: Some features require TikTok app approval
Processing Delays
- Videos typically process within 2 minutes
- Use the "Get Status" operation to monitor progress
- Status will change from
PROCESSING_UPLOAD
toPUBLISH_COMPLETE
Resources
- TikTok Developer Documentation
- TikTok API Reference
- n8n Community Nodes Documentation
- OAuth 2.0 Authorization Guide
Support
For issues related to:
- This n8n node: Open an issue on GitHub
- TikTok API: Contact TikTok Developer Support
- n8n platform: Visit n8n Community
Contributing
Contributions are welcome! Please read our contributing guidelines and submit pull requests to the GitHub repository.
License
This project is licensed under the MIT License - see the LICENSE file for details.