Poster sur Discord depuis Reddit

Intermédiaire

Ceci est unAIworkflow d'automatisation du domainecontenant 11 nœuds.Utilise principalement des nœuds comme If, Code, Reddit, Discord, ScheduleTrigger, combinant la technologie d'intelligence artificielle pour une automatisation intelligente. Extraire automatiquement les images et publier le contenu le plus récent de Reddit sur Discord

Prérequis
  • Token Bot Discord ou Webhook
Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "id": "pQsIsuD3FqbyPYgJ",
  "meta": {
    "instanceId": "f5447aacc75878ec23c68728277d69b42b8a47397d6598c62610dabdfff5c5f1",
    "templateCredsSetupCompleted": true
  },
  "name": "Reddit Poster to Discord",
  "tags": [],
  "nodes": [
    {
      "id": "93d15b82-9ce5-4189-8913-1f29bea05a23",
      "name": "Déclencheur Planifié",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -140,
        -40
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes",
              "minutesInterval": 15
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4bd7becf-e6cc-4975-a098-441accc2d24b",
      "name": "Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        120,
        -200
      ],
      "parameters": {
        "width": 600,
        "height": 440,
        "content": "## Fetch and filter reddit posts\n- Fetches latest post from a subreddit, filters out aome postIDs from mod posts.\n- Add another one if nessecary"
      },
      "typeVersion": 1
    },
    {
      "id": "2602f8be-c1c3-4403-9b61-714bbfe517e7",
      "name": "Récupérer les dernières publications reddit",
      "type": "n8n-nodes-base.reddit",
      "position": [
        220,
        -40
      ],
      "parameters": {
        "limit": 3,
        "filters": {},
        "operation": "getAll",
        "subreddit": "news"
      },
      "credentials": {
        "redditOAuth2Api": {
          "id": "sdadadsaddasd",
          "name": "Stream8"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1c24ec32-b231-4139-967d-677dad046ac6",
      "name": "Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        740,
        -200
      ],
      "parameters": {
        "color": 7,
        "width": 560,
        "height": 440,
        "content": "## Post fetching and URL extraction\n- Fetches per post data, extracts direct URL for image."
      },
      "typeVersion": 1
    },
    {
      "id": "fc5bca77-baaa-4e68-ae8c-4c246aea43bc",
      "name": "Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1320,
        -200
      ],
      "parameters": {
        "color": 3,
        "width": 280,
        "height": 440,
        "content": "## Post To platforms\n- Send Direct image + context to social media platforms"
      },
      "typeVersion": 1
    },
    {
      "id": "38f3aa18-95db-4814-9383-801d22b66cee",
      "name": "Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -220,
        -200
      ],
      "parameters": {
        "color": 5,
        "width": 320,
        "height": 440,
        "content": "## Scheduling\n- Set up the frequency of time to check for new posts\n"
      },
      "typeVersion": 1
    },
    {
      "id": "2331d25e-9468-4787-871f-8692ff0b8546",
      "name": "Filtrer les annonces",
      "type": "n8n-nodes-base.if",
      "position": [
        440,
        -40
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "7e7d515c-16f4-4fe7-9636-8282f53ac104",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.author_fullname }}",
              "rightValue": "t2_6l4z3"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "a8126cca-1674-478a-878a-a69d1d002959",
      "name": "Récupérer la publication Reddit",
      "type": "n8n-nodes-base.reddit",
      "position": [
        800,
        -40
      ],
      "parameters": {
        "postId": "={{ $('Filter out announcement posts').item.json.id }}",
        "operation": "get",
        "subreddit": "news"
      },
      "credentials": {
        "redditOAuth2Api": {
          "id": "oz2vVkjLl9rNadasdadNB",
          "name": "Stream8"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "85e63030-ed64-4f82-a2a5-c4aeecbb4679",
      "name": "Extraire l'URL de l'image",
      "type": "n8n-nodes-base.code",
      "position": [
        1100,
        -40
      ],
      "parameters": {
        "jsCode": "return items.map(item => {\n  const mediaMetadata = item.json.media_metadata;\n  if (!mediaMetadata) return { directUrl: null };\n  \n  const mediaKey = Object.keys(mediaMetadata)[0];\n  const media = mediaMetadata[mediaKey];\n  if (!media || !media.s || !media.s.u) return { directUrl: null };\n\n  let url = media.s.u.replace(/&/g, '&');\n  \n  const match = url.match(/([a-z0-9]+)\\.(jpg|png|gif)/i);\n  if (!match) return { directUrl: null };\n  \n  const imageName = match[1];\n  const extension = match[2];\n  \n  const directUrl = `https://i.redd.it/${imageName}.${extension}`;\n  \n  return { directUrl };\n});\n"
      },
      "typeVersion": 2
    },
    {
      "id": "c11ecaf3-9f82-47cd-bc86-0a17b1c869db",
      "name": "Envoyer vers discord",
      "type": "n8n-nodes-base.discord",
      "position": [
        1420,
        -40
      ],
      "webhookId": "0b28872f-2769-4474-a1bc-0a95228cd934",
      "parameters": {
        "content": "=New post on reddit:\n{{ $('Fetch Reddit Post').item.json.title }}\n{{ $json.directUrl }}\n{{ $('Filter out announcement posts').item.json.url_overridden_by_dest }}",
        "options": {},
        "authentication": "webhook"
      },
      "credentials": {
        "discordWebhookApi": {
          "id": "sdadsadadadada",
          "name": "Debug"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "63672e8c-1ebc-44ca-845c-2a17ad0acc40",
      "name": "Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -220,
        -380
      ],
      "parameters": {
        "color": 6,
        "width": 940,
        "content": "## SETUP\n- Set up a reddit account including reddit app, copy client/id secret.\n- Configure redirect URL as n8n base url.\n- Configure subreddit in both reddit nodes.\n- Add a webhook to discord."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "1909d356-13e9-4045-8aed-8c640c93fe39",
  "connections": {
    "93d15b82-9ce5-4189-8913-1f29bea05a23": {
      "main": [
        [
          {
            "node": "2602f8be-c1c3-4403-9b61-714bbfe517e7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "85e63030-ed64-4f82-a2a5-c4aeecbb4679": {
      "main": [
        [
          {
            "node": "c11ecaf3-9f82-47cd-bc86-0a17b1c869db",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a8126cca-1674-478a-878a-a69d1d002959": {
      "main": [
        [
          {
            "node": "85e63030-ed64-4f82-a2a5-c4aeecbb4679",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2602f8be-c1c3-4403-9b61-714bbfe517e7": {
      "main": [
        [
          {
            "node": "2331d25e-9468-4787-871f-8692ff0b8546",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2331d25e-9468-4787-871f-8692ff0b8546": {
      "main": [
        [],
        [
          {
            "node": "a8126cca-1674-478a-878a-a69d1d002959",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Intermédiaire - Intelligence Artificielle

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Informations sur le workflow
Niveau de difficulté
Intermédiaire
Nombre de nœuds11
Catégorie1
Types de nœuds6
Description de la difficulté

Adapté aux utilisateurs expérimentés, avec des workflows de complexité moyenne contenant 6-15 nœuds

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34