Skip to content

Instantly share code, notes, and snippets.

@partzan
Created October 21, 2025 09:45
Show Gist options
  • Select an option

  • Save partzan/0d3031a3c12e40e0f20c3ea4b12c84a0 to your computer and use it in GitHub Desktop.

Select an option

Save partzan/0d3031a3c12e40e0f20c3ea4b12c84a0 to your computer and use it in GitHub Desktop.
X Media Posting
{
"name": "Posting on X",
"nodes": [
{
"parameters": {
"text": "=hi, this is caption",
"additionalFields": {
"attachments": "={{ $json.media_id }}"
}
},
"type": "n8n-nodes-base.twitter",
"typeVersion": 2,
"position": [720, 432],
"id": "14b3ac47-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"name": "Create Tweet",
"credentials": {
"twitterOAuth2Api": {
"id": "CRED_TWITTER_OAUTH2_PLACEHOLDER",
"name": "Twitter OAuth2"
}
}
},
{
"parameters": {
"rule": {
"interval": [
{
"field": "hours",
"hoursInterval": 2
}
]
}
},
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.2,
"position": [-176, 304],
"id": "fe17e197-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"name": "Schedule Trigger2"
},
{
"parameters": {
"operation": "download",
"fileId": {
"__rl": true,
"value": "GOOGLE_DRIVE_FILE_ID_PLACEHOLDER",
"mode": "list",
"cachedResultName": "Example.png",
"cachedResultUrl": "https://drive.google.com/file/d/GOOGLE_DRIVE_FILE_ID_PLACEHOLDER/view?usp=drivesdk"
},
"options": {
"binaryPropertyName": "data"
}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [48, 304],
"id": "fc9f68e4-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"name": "Google Drive3",
"credentials": {
"googleDriveOAuth2Api": {
"id": "CRED_GOOGLE_DRIVE_PLACEHOLDER",
"name": "Google Drive Account"
}
}
},
{
"parameters": {
"method": "POST",
"url": "https://api.twitter.com/2/tweets",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "twitterOAuth2Api",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"text\": \"Hi, this is caption\",\n \"media\": {\n \"media_ids\": [\"{{ $node['Upload Media'].json.media_id_string }}\"]\n }\n}",
"options": {
"response": {
"response": {
"fullResponse": true,
"responseFormat": "json"
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [704, 144],
"id": "2240992d-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"name": "HTTP Request",
"credentials": {
"twitterOAuth2Api": {
"id": "CRED_TWITTER_OAUTH2_PLACEHOLDER",
"name": "Twitter OAuth2"
},
"twitterOAuth1Api": {
"id": "CRED_TWITTER_OAUTH1_PLACEHOLDER",
"name": "Twitter OAuth1"
}
}
},
{
"parameters": {
"method": "POST",
"url": "https://upload.twitter.com/1.1/media/upload.json",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "twitterOAuth1Api",
"sendBody": true,
"contentType": "multipart-form-data",
"bodyParameters": {
"parameters": [
{
"parameterType": "formBinaryData",
"name": "media",
"inputDataFieldName": "data"
},
{
"name": "additional_owners",
"value": "=123456789"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [352, 304],
"id": "5c19c5f7-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"name": "Upload Media",
"credentials": {
"twitterOAuth1Api": {
"id": "CRED_TWITTER_OAUTH1_PLACEHOLDER",
"name": "Twitter OAuth1"
}
}
}
],
"pinData": {},
"connections": {
"Schedule Trigger2": {
"main": [
[
{
"node": "Google Drive3",
"type": "main",
"index": 0
}
]
]
},
"Google Drive3": {
"main": [
[
{
"node": "Upload Media",
"type": "main",
"index": 0
}
]
]
},
"Upload Media": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
},
{
"node": "Create Tweet",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1",
"callerPolicy": "workflowsFromSameOwner",
"executionTimeout": -1
},
"versionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
},
"id": "EqHdo0AE6cmt4Mq5",
"tags": []
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment