OpenAI を使用して、任意の Twitter ユーザーのスタイルを模倣して AI ティッター投稿を生成
中級
これはContent Creation, Multimodal AI分野の自動化ワークフローで、7個のノードを含みます。主にSet, OpenAi, Twitter, Function, ManualTriggerなどのノードを使用。 OpenAIを使用してTwitterユーザーのスタイルを模倣してAIツイート生成
前提条件
- •OpenAI API Key
- •Twitter API認証情報
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
"nodes": [
{
"name": "手動トリガー",
"type": "n8n-nodes-base.manualTrigger",
"notes": {
"text": "### 1. Start Workflow\n\nThis `Manual Trigger` node is used for easy testing of your style mimicry. \n\n**To trigger the workflow manually:** Click the 'Execute Workflow' button in the top right.\n\n**For automation:** You could connect this to a `Webhook` (if you build a simple form to input handles/content) or integrate it with a content calendar system.",
"position": "right"
},
"position": [
240,
300
],
"parameters": {},
"typeVersion": 1,
"id": "--0"
},
{
"name": "設定 Target & Content",
"type": "n8n-nodes-base.set",
"notes": {
"text": "### 2. Define Target Handle & New Content\n\nThis `Set` node defines who's style you want to copy and what topic you want to tweet about.\n\n**Setup:**\n1. **`targetTwitterHandle`:** **IMPORTANT:** Change `@n8n_io` to the Twitter handle (username, e.g., `@elonmusk`, `@TheOnion`) of the user whose style you want to mimic.\n2. **`newTweetContent`:** Describe clearly what you want the AI to write about in the target style.\n\n**For automation:** These values could come from a previous node (e.g., from a spreadsheet, a form input, or an RSS feed item).",
"position": "right"
},
"position": [
460,
300
],
"parameters": {
"values": [
{
"name": "targetTwitterHandle",
"value": "@n8n_io"
},
{
"name": "newTweetContent",
"value": "Describe the new features coming in n8n version 1.35 focused on advanced AI integrations and new credential types. Make it exciting!"
}
],
"options": {}
},
"typeVersion": 2,
"id": "-Target-Content-1"
},
{
"name": "Get User's Tweets",
"type": "n8n-nodes-base.twitter",
"notes": {
"text": "### 3. Get User's Recent Tweets\n\nThis `Twitter` node fetches recent tweets from the specified `targetTwitterHandle`. These tweets will serve as examples for the AI to learn the style.\n\n**Setup:**\n1. **Twitter Credential:** Click 'Credentials' and select 'New Credential'. Choose 'Twitter API'. You'll need to create a Twitter Developer App, get API keys/tokens, and configure them in n8n. Ensure your app has **Read** permissions for user timelines.\n2. **User ID:** This field automatically pulls the `targetTwitterHandle` from the previous node.\n3. **Max Results:** Adjust the number of tweets to fetch. More tweets provide more context for the AI, but also consume more tokens in the next step.\n\n**Test this node by executing it and checking the output to ensure tweets are fetched correctly.**",
"position": "right"
},
"position": [
700,
300
],
"parameters": {
"userId": "={{ $json.targetTwitterHandle }}",
"options": {
"exclude": [
"retweets"
],
"maxResults": 30
},
"resource": "tweet",
"operation": "getUserTimeline"
},
"credentials": {
"twitterApi": {
"id": "YOUR_TWITTER_CREDENTIAL_ID",
"resolve": false
}
},
"typeVersion": 1,
"id": "Get-User-s-Tweets-2"
},
{
"name": "Prepare Style Examples",
"type": "n8n-nodes-base.function",
"notes": {
"text": "### 4. Prepare Style Examples for AI\n\nThis `Function` node extracts the text content from the fetched tweets and formats them into a clean, list-like string. This string will be embedded directly into the AI prompt.\n\n**Output:** It creates a `tweetExamples` field with formatted tweets and passes along `newTweetContent` for the next step.\n\n**No configuration needed here**; it processes the tweet data.",
"position": "right"
},
"position": [
940,
300
],
"parameters": {
"options": {},
"function": "let tweetExamples = \"\";\n\nif (items.length === 0) {\n tweetExamples = \"No example tweets found. Cannot mimic style.\";\n} else {\n tweetExamples = items.map(item => `- \"${item.json.text}\"`).join('\\n');\n}\n\nreturn [{ json: { tweetExamples: tweetExamples, newTweetContent: items[0].json.newTweetContent } }];"
},
"typeVersion": 1,
"id": "Prepare-Style-Examples-3"
},
{
"name": "AI: Mimic Style & Generate Tweet",
"type": "n8n-nodes-base.openAi",
"notes": {
"text": "### 5. AI: Mimic Style & Generate Tweet (The Magic!)\n\nThis `OpenAI` node is where the core style mimicry happens. It receives the example tweets and your new content, then generates a tweet in the learned style.\n\n**Setup:**\n1. **OpenAI Credential:** Select your existing OpenAI API Key credential.\n2. **Model:** Choose `gpt-3.5-turbo` for general use, or `gpt-4o` (or `gpt-4`) for superior style replication at a higher cost.\n3. **Prompts:** The 'System' prompt provides the example tweets, and the 'User' prompt gives the AI the new content to rewrite.\n\n**Output:** The AI-generated tweet will be in `{{ $node[\"AI: Mimic Style & Generate Tweet\"].json.choices[0].message.content }}`.",
"position": "right"
},
"position": [
1180,
300
],
"parameters": {
"model": "gpt-3.5-turbo",
"options": {},
"messages": [
{
"role": "system",
"content": "You are a highly skilled AI specializing in replicating specific writing styles. Your task is to analyze the provided example tweets and then rewrite new content in that exact style. Pay attention to tone, vocabulary, phrasing, brevity, emoji usage, and any unique quirks. The output should be a standalone tweet.\n\nExample Tweets (from target user):\n{{ $json.tweetExamples }}"
},
{
"role": "user",
"content": "Rewrite the following content as a tweet, mimicking the style of the examples:\n\nOriginal Content: {{ $json.newTweetContent }}"
}
]
},
"credentials": {
"openAiApi": {
"id": "YOUR_OPENAI_CREDENTIAL_ID",
"resolve": false
}
},
"typeVersion": 1,
"id": "AI-Mimic-Style-Generate-Tweet-4"
},
{
"name": "Consolidate Generated Tweet",
"type": "n8n-nodes-base.set",
"notes": {
"text": "### 6. Consolidate Generated Tweet\n\nThis `Set` node simply consolidates the AI-generated tweet into a clearly named field (`generatedTweet`) for easy access in subsequent nodes (e.g., for publishing or review).\n\n**No configuration needed here**; it just maps the data from the previous AI node.",
"position": "right"
},
"position": [
1420,
300
],
"parameters": {
"values": [
{
"name": "generatedTweet",
"value": "={{ $node[\"AI: Mimic Style & Generate Tweet\"].json.choices[0].message.content }}"
}
],
"options": {}
},
"typeVersion": 2,
"id": "Consolidate-Generated-Tweet-5"
},
{
"name": "Publish Generated Tweet (Optional)",
"type": "n8n-nodes-base.twitter",
"notes": {
"text": "### 7. Publish Generated Tweet (Optional)\n\nThis `Twitter` node allows you to directly publish the AI-generated tweet to your Twitter account.\n\n**Setup:**\n1. **Twitter Credential:** Select the same Twitter API credential you used for 'Get User's Tweets'. Ensure your app has **Write** permissions (Tweet, Retweet, etc.).\n2. **Text:** This field pulls the `generatedTweet` from the previous node.\n\n**IMPORTANT:**\n* **Review before publishing!** The AI might not always get the style perfectly or generate content you want to share. It's highly recommended to review the output first.\n* **To disable auto-publishing:** Simply disconnect this node or set it to 'Inactive' if you only want to review the generated tweet without sending it directly.",
"position": "right"
},
"position": [
1660,
300
],
"parameters": {
"text": "={{ $json.generatedTweet }}",
"options": {},
"resource": "tweet",
"operation": "create"
},
"credentials": {
"twitterApi": {
"id": "YOUR_TWITTER_CREDENTIAL_ID",
"resolve": false
}
},
"typeVersion": 1,
"id": "Publish-Generated-Tweet-Optional--6"
}
],
"pinData": {},
"version": 1,
"connections": {
"Manual Trigger": {
"main": [
[
{
"node": "Set Target & Content",
"type": "main"
}
]
]
},
"Get-User-s-Tweets-2": {
"main": [
[
{
"node": "Prepare-Style-Examples-3",
"type": "main"
}
]
]
},
"Set Target & Content": {
"main": [
[
{
"node": "Get-User-s-Tweets-2",
"type": "main"
}
]
]
},
"Prepare-Style-Examples-3": {
"main": [
[
{
"node": "AI-Mimic-Style-Generate-Tweet-4",
"type": "main"
}
]
]
},
"Consolidate-Generated-Tweet-5": {
"main": [
[
{
"node": "Publish-Generated-Tweet-Optional--6",
"type": "main"
}
]
]
},
"AI-Mimic-Style-Generate-Tweet-4": {
"main": [
[
{
"node": "Consolidate-Generated-Tweet-5",
"type": "main"
}
]
]
}
}
}よくある質問
このワークフローの使い方は?
上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。
このワークフローはどんな場面に適していますか?
中級 - コンテンツ作成, マルチモーダルAI
有料ですか?
このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。
関連ワークフロー
OpenAIとWordPressを使用したブログコンテンツの自動生成と公開
OpenAI と WordPress でブログコンテンツ生成と公開を自動化
Set
Open Ai
Word Press
+
Set
Open Ai
Word Press
6 ノードPiotr Sobolewski
コンテンツ作成
OpenAIとGmailを使用してポッドキャストの文字起こしを要約し、キーワードを生成
OpenAIとGmailを使用してポッドキャストの字幕を要約し、キーワードを生成する
Set
Gmail
Open Ai
+
Set
Gmail
Open Ai
6 ノードPiotr Sobolewski
コンテンツ作成
AI駆動の製品調査と価格比較 - Google検索とOpenAI
Google検索とOpenAIを活用したAI駆動の製品調査と価格比較
Set
Gmail
Open Ai
+
Set
Gmail
Open Ai
8 ノードPiotr Sobolewski
市場調査
AIゲスト記事ジェネレーターとOpenAI及びGoogle Sheets自動化
AIゲスト記事ジェネレーターとOpenAI及びGoogle Sheets自動化
If
Set
Open Ai
+
If
Set
Open Ai
7 ノードJuan de Dios Estrella Sáez
コンテンツ作成
コンテンツジェネレーター v3
AI驱动ブログ自動化:使用GPT-4生成并公開SEO記事至WordPressとTwitter
If
Set
Code
+
If
Set
Code
144 ノードJay Emp0
コンテンツ作成
コンテンツ集約
Gemini AIを使ってウェブ記事からLinkedInとX/Twitterへのソーシャルメディア投稿を自動化する
If
Set
Xml
+
If
Set
Xml
34 ノードVadim
コンテンツ作成
ワークフロー情報
難易度
中級
ノード数7
カテゴリー2
ノードタイプ5
作成者
Piotr Sobolewski
@piotrsobolewskiAI PhD with 7 years experience as a game dev CEO, currently teaching, helping others and building something new.
外部リンク
n8n.ioで表示 →
このワークフローを共有