使用 Anysite Twitter 节点在 n8n 工作流中提取 Twitter/X 数据
Anysite Twitter 节点使您能够在 n8n 工作流中提取 Twitter (X) 数据。搜索推文、分析用户资料、监控标签并跟踪社交媒体对话。
从下拉菜单中选择您的 Anysite API 凭证,或创建新凭证。
按用户名、简介或其他条件搜索 Twitter 用户。
参数:
输出示例:
{
"users": [
{
"id": "twitter123",
"username": "johnsmith_dev",
"displayName": "John Smith",
"bio": "Senior Software Engineer | Python enthusiast",
"followers": 15000,
"following": 800,
"verified": false,
"location": "San Francisco, CA",
"profileImageUrl": "https://pbs.twimg.com/profile_images/..."
}
]
}
从特定 Twitter 用户提取推文和帖子。
参数:
输出示例:
{
"tweets": [
{
"id": "tweet456",
"text": "Just shipped a new feature! Excited to see how users respond 🚀",
"createdAt": "2024-08-26T14:30:00Z",
"engagement": {
"likes": 125,
"retweets": 32,
"replies": 18,
"views": 2500
},
"mediaUrls": [],
"hashtags": ["#ProductLaunch", "#TechStartup"]
}
]
}
按关键词、标签或短语搜索推文。
参数:
输出示例:
{
"tweets": [
{
"id": "search789",
"text": "The future of AI development is looking incredible! #AI #MachineLearning",
"author": {
"username": "ai_researcher",
"displayName": "Dr. Sarah Wilson"
},
"createdAt": "2024-08-26T12:00:00Z",
"engagement": {
"likes": 89,
"retweets": 24,
"replies": 12
}
}
]
}
获取特定推文的详细信息。
参数:
输出示例:
{
"tweet": {
"id": "tweet123",
"text": "Thread about building scalable APIs: 1/8",
"author": {
"username": "backend_expert",
"followers": 25000
},
"engagement": {
"likes": 245,
"retweets": 89,
"replies": 34
},
"threadTweets": [
{
"id": "tweet124",
"text": "First, consider your data architecture..."
}
]
}
}
搜索提及您的品牌、产品或竞争对手的推文。
使用 AI 节点分析情感,并将提及分类为正面、负面或中性。
找到提及您品牌的高互动用户并评估他们的影响力。
为重要提及或负面情感向您的社交媒体团队发送通知。
工作流示例:
{
"nodes": [
{
"name": "Monitor Brand",
"type": "@horizondatawave/n8n-nodes-anysite.Twitter",
"operation": "searchTweets",
"parameters": {
"query": "YourBrand OR @YourHandle OR #YourHashtag",
"resultType": "recent",
"limit": 100
}
},
{
"name": "Sentiment Analysis",
"type": "n8n-nodes-base.openAi",
"parameters": {
"operation": "analyze",
"prompt": "Analyze sentiment: {{ $json.text }}"
}
},
{
"name": "Filter Negative",
"type": "n8n-nodes-base.filter",
"parameters": {
"conditions": [
{
"field": "sentiment",
"operation": "equal",
"value": "negative"
}
]
}
},
{
"name": "Alert Team",
"type": "n8n-nodes-base.slack",
"parameters": {
"channel": "#social-media",
"text": "🚨 Negative mention detected: {{ $json.text }}"
}
}
]
}
查找和分析潜在的影响者合作伙伴:
跟踪热门话题和标签:
使用 Twitter 的高级搜索运算符:
// 精确短语搜索
{
"query": "\"artificial intelligence\""
}
// 排除转推
{
"query": "machine learning -RT"
}
// 来自特定用户
{
"query": "from:elonmusk"
}
// 提及用户
{
"query": "@openai"
}
// 多个标签
{
"query": "#AI #MachineLearning"
}
// 基于位置
{
"query": "startup near:\"San Francisco\""
}
// 日期范围
{
"query": "product launch since:2024-08-01 until:2024-08-31"
}
按互动指标筛选:
{
"name": "High Engagement Filter",
"type": "n8n-nodes-base.filter",
"parameters": {
"conditions": [
{
"field": "engagement.likes",
"operation": "greaterThan",
"value": 100
},
{
"field": "engagement.retweets",
"operation": "greaterThan",
"value": 20
}
]
}
}
错误: 429 - Too Many Requests
解决方案:
错误: 404 - Tweet not found
解决方案:
错误: 403 - User account suspended
解决方案:
{
"name": "Twitter with Retry",
"type": "@horizondatawave/n8n-nodes-anysite.Twitter",
"retryOnFail": true,
"maxTries": 3,
"waitBetweenTries": 5000,
"parameters": {
"operation": "searchTweets",
"query": "your search query"
}
}
从推文数据中提取洞察:
// 计算互动率
{
"engagementRate": "={{ ($json.engagement.likes + $json.engagement.retweets + $json.engagement.replies) / $json.engagement.views * 100 }}"
}
// 提取标签
{
"hashtags": "={{ $json.text.match(/#\w+/g) }}"
}
// 检查是否为认证用户
{
"isInfluencer": "={{ $json.author.verified || $json.author.followers > 10000 }}"
}
使用 AI 对推文进行分类:
{
"name": "Classify Content",
"type": "n8n-nodes-base.openAi",
"parameters": {
"operation": "classify",
"prompt": "Classify this tweet into categories (Product, Marketing, Support, Other): {{ $json.text }}"
}
}
将推文数据导出到电子表格:
{
"name": "Export to Sheets",
"type": "n8n-nodes-base.googleSheets",
"parameters": {
"operation": "append",
"sheetId": "your-sheet-id",
"values": [
"={{ $json.author.username }}",
"={{ $json.text }}",
"={{ $json.createdAt }}",
"={{ $json.engagement.likes }}",
"={{ $json.engagement.retweets }}"
]
}
}
发送实时警报:
{
"name": "Webhook Alert",
"type": "n8n-nodes-base.webhook",
"parameters": {
"httpMethod": "POST",
"responseMode": "onReceived",
"options": {
"data": {
"tweet": "={{ $json.text }}",
"author": "={{ $json.author.username }}",
"engagement": "={{ $json.engagement.likes }}"
}
}
}
}
高效处理大型数据集:
{
"name": "Process in Batches",
"type": "n8n-nodes-base.splitInBatches",
"parameters": {
"batchSize": 25
}
}
缓存频繁访问的数据:
// 在内存中存储用户数据
{
"name": "Cache User Data",
"type": "n8n-nodes-base.set",
"parameters": {
"values": {
"userCache.{{ $json.username }}": "={{ $json }}"
}
}
}