{"id":125017,"date":"2025-03-14T13:31:59","date_gmt":"2025-03-14T13:31:59","guid":{"rendered":"\/tutorials\/?p=125017"},"modified":"2026-03-09T19:16:45","modified_gmt":"2026-03-09T19:16:45","slug":"how-to-integrate-n8n-with-discord","status":"publish","type":"post","link":"\/ng\/tutorials\/how-to-integrate-n8n-with-discord","title":{"rendered":"How to integrate n8n with Discord"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p>There are many platforms you can integrate with n8n, Discord being one of the most popular options. This compatibility lets you automate various tasks in the messaging app, from sending a notification to managing users.<\/p><p>In this article, we will explain how to integrate n8n with Discord. We will discuss how to do so using a webhook, an HTTP request, and OpenAI so you can find the best method based on your needs.<\/p><p>Before getting started, let&rsquo;s dive into the prerequisites and the initial n8n setup.<\/p><p>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-setting-up-n8n-for-discord-workflows\"><strong>Setting up n8n for Discord workflows<\/strong><\/h2><p>Before going into the steps, let&rsquo;s set up n8n. This platform offers an officially hosted plan, but we will self-host it on a virtual private server (VPS) because it is more affordable.<\/p><p>Since n8n is relatively lightweight, a system with <a href=\"https:\/\/docs.n8n.io\/embed\/prerequisites\/\">4 GB of SSD storage and 2 GB of RAM is enough<\/a>.<\/p><p>If you don&rsquo;t have a server, we recommend Hostinger <a href=\"\/ng\/self-hosted-n8n\">n8n self-hosted<\/a> solution, which starts <strong>\u20a610900.00\/month<\/strong>.<\/p><p>After purchasing a VPS hosting plan, <a href=\"\/ng\/tutorials\/how-to-install-n8n\">install n8n on your server<\/a>. Hostinger users can do so with one click using the <strong>OS template<\/strong>, which makes the process much easier.<\/p><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-large\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-vps-hosting\" href=\"\/ng\/vps-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/public\" alt=\"\" class=\"wp-image-77934\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><p>Once installed, open n8n using your server&rsquo;s IP address on port <strong>5678<\/strong>. Otherwise, you can access it from <strong>n8n.hostname.com<\/strong>, with <strong>hostname.com <\/strong>being your actual server hostname.<\/p><p>In the n8n dashboard, complete the configuration by creating an account and a project.<\/p><p>If you face difficulties during this initial setup process, watch and follow our video guide below.<\/p><figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"How to Set Up n8n on Hostinger VPS: A Step-by-Step Guide\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/OfHTZBZUNaI?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure><p>\n  <div class=\"youtube-shortcode\">\n    <div class=\"row\">\n      <div class=\"col-7 col-sm-8 d-flex align-items-center\">\n        <img decoding=\"async\" class=\"channel-logo\" src=\"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-content\/themes\/tutorialsthemeuplift\/public\/images\/youtube-channels\/hostinger-academy.jpg\" alt=\"youtube channel logo\">\n        <div class=\"d-flex flex-column justify-content-between\">\n          <span class=\"slogan d-none d-sm-block\">Subscribe For more educational videos!<\/span>\n          <span class=\"channel-name\">Hostinger Academy<\/span>\n                    <\/div>\n      <\/div>\n      <div class=\"col-5 col-sm-4 d-flex align-items-center justify-content-end\">\n          <a class=\"subscribe-button\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" href=\"http:\/\/www.youtube.com\/channel\/UCbNIC-svDbtUOH2qsLnPQPg?sub_confirmation=1\">\n            <img decoding=\"async\" src=\"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-content\/themes\/tutorialsthemeuplift\/public\/images\/icons\/youtube.svg\" alt=\"subscribe\">\n            <span>Subscribe<\/span>\n          <\/a>\n      <\/div>\n    <\/div>\n  <\/div>\n\n    \n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-popular-n8n-integrations-for-discord\"><strong>Popular n8n integrations for Discord<\/strong><\/h2><p>In this section, we will explain how to integrate Discord with n8n using a webhook, OpenAI, and an HTTP request. Since each platform suits different automation workflows and use cases, we will also discuss when it is best to use it.<\/p><h3 class=\"wp-block-heading\" id=\"h-how-to-integrate-n8n-with-discord-and-webhook\"><strong>How to integrate n8n with Discord and Webhook<\/strong><\/h3><p><strong>Webhook<\/strong> is a lightweight, event-driven communication method that lets multiple applications communicate via HTTP. It is a versatile method for triggering n8n workflow.<\/p><p>A webhook is sent after a specific action that was previously determined occurs. Depending on how you define it, this action can be different events.<\/p><p>When a webhook starts, it triggers an action in Discord using n8n, such as sending a message or deleting a channel.<\/p><p>For demonstration purposes, let&rsquo;s create a basic integration that sends a message in Discord when the webhook is called:<\/p><ol class=\"wp-block-list\">\n<li>Open <strong>Discord<\/strong> and <a href=\"https:\/\/support.discord.com\/hc\/en-us\/articles\/228383668-Intro-to-Webhooks\">create a new webhook<\/a>. Save the URL and return to n8n.&nbsp;<\/li>\n\n\n\n<li>Click the <strong>+<\/strong> icon on the top right corner to create a new node. Select <strong>Webhook<\/strong>.<\/li>\n\n\n\n<li>Double-click the <strong>Webhook <\/strong>node to open the configuration menu.&nbsp;<\/li>\n\n\n\n<li>Select the <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/Methods\"><strong>HTTP<\/strong> method<\/a> that will trigger the hook. We will choose <strong>GET<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e20287a677e\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"1172\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-webhook-configuration-menu.png\/public\" alt=\"n8n webhook configuration menu\" class=\"wp-image-125020\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-webhook-configuration-menu.png\/w=1280,fit=scale-down 1280w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-webhook-configuration-menu.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-webhook-configuration-menu.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-webhook-configuration-menu.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-webhook-configuration-menu.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"5\" class=\"wp-block-list\">\n<li>Click <strong>Back to canvas<\/strong>.<\/li>\n\n\n\n<li>Create a new node and select<strong> Discord<\/strong>. Pick the type of action the webhook will trigger, like <strong>sending a message<\/strong>.<\/li>\n\n\n\n<li>Enter the following configurations:<\/li>\n<\/ol><ul class=\"wp-block-list\">\n<li><strong>Connection Type<\/strong>:<strong> <\/strong>Webhook.<\/li>\n\n\n\n<li><strong>Credential for Discord Webhook<\/strong>: the Discord webhook you created earlier.<\/li>\n\n\n\n<li><strong>Message<\/strong>: the message you want to send to your Discord server.<\/li>\n<\/ul><ol start=\"8\" class=\"wp-block-list\">\n<li>Return to the canvas and click<strong> Test workflow<\/strong>.<\/li>\n\n\n\n<li>Open the <strong>webhook URL<\/strong> on your browser, and a new message will pop up in your Discord server.&nbsp;<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e20287a882d\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1074\" height=\"564\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/basic-webhook-discord-workflow-in-n8n.png\/public\" alt=\"A basic webhook and Discord workflow in n8n\" class=\"wp-image-125021\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/basic-webhook-discord-workflow-in-n8n.png\/w=1074,fit=scale-down 1074w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/basic-webhook-discord-workflow-in-n8n.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/basic-webhook-discord-workflow-in-n8n.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/basic-webhook-discord-workflow-in-n8n.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/basic-webhook-discord-workflow-in-n8n.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1074px) 100vw, 1074px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>Note that this is a basic implementation of n8n with Discord using a webhook. By adding more nodes, you can automate a more complex workflow.<\/p><p>For instance, you can make a new user registration in Discord trigger a webhook, which then assigns a role to the person. Check out <a href=\"https:\/\/n8n.io\/integrations\/webhook\/and\/discord\/\">n8n&rsquo;s DIscord and webhook integration page<\/a> for more examples and templates.<\/p><p><div><p class=\"important\"><strong>Important!<\/strong> Since Discord API limits the number of calls for webhooks and bots, avoid sending too many requests in a short time.<\/p><\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-how-to-integrate-n8n-with-discord-and-openai\"><strong>How to integrate n8n with Discord and OpenAI<\/strong><\/h3><p>Integrating n8n with Discord using OpenAI creates an AI-powered bot that can analyze messages, write content, or search for information on your server.<\/p><p>The steps to integrate n8n with Discord and OpenAI are similar to those when using a webhook but require an additional node. You also need an <strong>OpenAI API <\/strong>key to access the large language model (LLM).<\/p><p>If you don&rsquo;t have one, open <a href=\"https:\/\/platform.openai.com\/api-keys\">OpenAI&rsquo;s API key generation page<\/a> and log in to your account. Then, click <strong>Create new secret key<\/strong>.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e20287aa474\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"511\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/openai-api-key-generation-page.png\/public\" alt=\"OpenAI API key generation page\" class=\"wp-image-125023\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/openai-api-key-generation-page.png\/w=1460,fit=scale-down 1460w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/openai-api-key-generation-page.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/openai-api-key-generation-page.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/openai-api-key-generation-page.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/openai-api-key-generation-page.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>Enter a name for your secret key and hit <strong>Create secret key<\/strong>. Copy your new API credential and store it in a safe location. Click <strong>Done<\/strong> to finish.<\/p><p>    <p class=\"warning\">\n        <strong>Warning!<\/strong> Once you click <strong>Done<\/strong>, you won&rsquo;t be able to see the full API key anymore. Make sure you properly copy the credential and store it in a safe location before proceeding.    <\/p>\n    \n\n\n\n<\/p><p>For example, you have an application that takes message submission. You want a workflow to evaluate the inputted message for harmful content and notify the developers about it. Here&rsquo;s how to do so:<\/p><ol class=\"wp-block-list\">\n<li>Add a <strong>Webhook<\/strong> node.&nbsp;<\/li>\n\n\n\n<li>Open the node and select the <strong>POST <\/strong>method that will trigger the hook when a user submits a message.<\/li>\n\n\n\n<li>Copy the <strong>Webhook URL<\/strong> and add it to your application.&nbsp;&nbsp;<\/li>\n\n\n\n<li>Return to n8n and add an <strong>OpenAI <\/strong>node. Choose <strong>Classify Text for Violations<\/strong>.&nbsp;<\/li>\n\n\n\n<li>Open the <strong>OpenAI <\/strong>node. Click <strong>Create new credential <\/strong>and enter your API key.&nbsp;&nbsp;<\/li>\n\n\n\n<li>For the <strong>Text input<\/strong>, choose <strong>Expression <\/strong>and enter the following prompt. This will forward the received message to OpenAI for evaluation:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Evaluate this: {{ $json.message.text }}<\/pre><figure data-wp-context='{\"imageId\":\"69e20287ac462\"}' data-wp-interactive=\"core\/image\" class=\"wp-block-image aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"632\" height=\"526\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/openai-node-configuration.png\/public\" alt=\"OpenAI node configuration\n\" class=\"wp-image-125024\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/openai-node-configuration.png\/w=632,fit=scale-down 632w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/openai-node-configuration.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/openai-node-configuration.png\/w=150,fit=scale-down 150w\" sizes=\"auto, (max-width: 632px) 100vw, 632px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><ol start=\"7\" class=\"wp-block-list\">\n<li>Return to the canvas and add a <strong>Switch<\/strong> node to route the output according to the evaluation result.<\/li>\n\n\n\n<li>Open the <strong>Switch <\/strong>node and add two rules for when<strong> {{ $json.flagged }} <\/strong>value is <strong>true<\/strong> and <strong>false<\/strong>.&nbsp;<\/li>\n<\/ol><figure data-wp-context='{\"imageId\":\"69e20287ae258\"}' data-wp-interactive=\"core\/image\" class=\"wp-block-image aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"780\" height=\"1234\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-switch-node-configuration.png\/public\" alt=\"n8n Switch node configuration\n\" class=\"wp-image-125025\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-switch-node-configuration.png\/w=780,fit=scale-down 780w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-switch-node-configuration.png\/w=190,fit=scale-down 190w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-switch-node-configuration.png\/w=647,fit=scale-down 647w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-switch-node-configuration.png\/w=95,fit=scale-down 95w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-switch-node-configuration.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 780px) 100vw, 780px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><ol start=\"9\" class=\"wp-block-list\">\n<li>Add the <strong>Discord send message<\/strong> node, configure the webhook, and enter the automated message.&nbsp;<\/li>\n\n\n\n<li>Add the <strong>No operation <\/strong>node, which we will use to ignore unflagged messages.&nbsp;<\/li>\n\n\n\n<li>Connect the <strong>Switch<\/strong> node&rsquo;s <strong>TRUE<\/strong> endpoint to the <strong>Discord <\/strong>node and <strong>FALSE<\/strong> to the <strong>No operation<\/strong> one.<\/li>\n<\/ol><figure data-wp-context='{\"imageId\":\"69e20287b0167\"}' data-wp-interactive=\"core\/image\" class=\"wp-block-image aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"2020\" height=\"818\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-harmful-content-alert-workflow.png\/public\" alt=\"An n8n harmful content alert workflow\n\" class=\"wp-image-125026\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-harmful-content-alert-workflow.png\/w=2020,fit=scale-down 2020w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-harmful-content-alert-workflow.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-harmful-content-alert-workflow.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-harmful-content-alert-workflow.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-harmful-content-alert-workflow.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-harmful-content-alert-workflow.png\/w=1536,fit=scale-down 1536w\" sizes=\"auto, (max-width: 2020px) 100vw, 2020px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><p>Now, when a user enters a message in your application, the OpenAI LLM evaluates it for harmful content. n8n will send a Discord notification if it deems the message inappropriate and does nothing if otherwise.<\/p><p><div class=\"protip\">\n                    <h4 class=\"title\">Using mock data<\/h4>\n                    <p> If you can&rsquo;t call the webhook URL, set up a mock data. This is enough to test the workflow without properly triggering the webhook.<\/p>\n                <\/div>\n\n\n\n<\/p><p>Check out the <a href=\"https:\/\/n8n.io\/integrations\/discord\/and\/openai\/\">n8n&rsquo;s Discord and OpenAI integration page<\/a> to learn more about other example workflows.<\/p><h3 class=\"wp-block-heading\" id=\"h-how-to-integrate-n8n-with-http-request\"><strong>How to integrate n8n with HTTP Request<\/strong><\/h3><p>For a more complex workflow with direct API interactions, you can <a href=\"https:\/\/n8n.io\/integrations\/discord\/and\/http-request\/\">integrate n8n with Discord and other platforms using HTTPS requests<\/a>. There are two ways to do so &ndash; by using node parameters and importing the cURL command.<\/p><p>For a basic request, using the default node parameters is enough. Meanwhile, you should import the <a href=\"\/ng\/tutorials\/curl-command\">cURL command<\/a> if the service you want to integrate provides a specific API configuration.<\/p><p>As a demo, let&rsquo;s integrate n8n with Discord and YouTube using HTTP requests. In this workflow, we want to summarize newly uploaded videos and send the synopsis to Discord. Here&rsquo;s how to do that:<\/p><ol class=\"wp-block-list\">\n<li>Add a new <strong>RSS feed <\/strong>node to track new uploads on your YouTube channel.&nbsp;<\/li>\n\n\n\n<li>Open the RSS node and enter the following Feed URL. Replace <strong>CHANNEL_ID<\/strong> with your actual <a href=\"https:\/\/support.google.com\/youtube\/answer\/3250431?hl=en\">YouTube channel ID<\/a>.<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">https:\/\/www.youtube.com\/feeds\/videos.xml?channel_id=CHANNEL _ID<\/pre><ol start=\"3\" class=\"wp-block-list\">\n<li>Head to your YouTube channel and <a href=\"https:\/\/support.google.com\/youtube\/answer\/3250431?hl=en\">generate the OAuth 2.0 client ID and secret key<\/a>. Once finished, store them in a safe location.<\/li>\n\n\n\n<li>Return to n8n and add a <strong>new HTTP request<\/strong> node. In the Parameters tab, add the following configuration:\n<ul class=\"wp-block-list\">\n<li><strong>Method: <\/strong>GET<\/li>\n\n\n\n<li><strong>URL<\/strong>: https:\/\/www.googleapis.com\/youtube\/v3\/captions<\/li>\n\n\n\n<li><strong>Authentication:<\/strong> Predefined Credential Type<\/li>\n\n\n\n<li><strong>Credential Type<\/strong>: YouTube OAuth2 API<\/li>\n\n\n\n<li><strong>YouTube OAuth2 API: <\/strong>your client ID and secret key&nbsp;<\/li>\n\n\n\n<li><strong>Send Query Parameters:<\/strong> on<\/li>\n\n\n\n<li><strong>Specify Query Parameters<\/strong>: Using Fields Below<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>In the query parameter fields, enter the following configuration:\n<ul class=\"wp-block-list\">\n<li><strong>Name<\/strong>: videoid<\/li>\n\n\n\n<li><strong>Value<\/strong>: {{ $json.id.match(\/(?:[^:]*:){2}s*(.*)\/)[1] }}<\/li>\n\n\n\n<li><strong>Name<\/strong>: part<\/li>\n\n\n\n<li><strong>Value<\/strong>: snippet<\/li>\n<\/ul>\n<\/li>\n<\/ol><figure data-wp-context='{\"imageId\":\"69e20287b24cd\"}' data-wp-interactive=\"core\/image\" class=\"wp-block-image aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1229\" height=\"888\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-youtube-http-request-node-configuration.png\/public\" alt=\"YouTube HTTP request node configuration in n8n\n\" class=\"wp-image-125027\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-youtube-http-request-node-configuration.png\/w=1229,fit=scale-down 1229w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-youtube-http-request-node-configuration.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-youtube-http-request-node-configuration.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-youtube-http-request-node-configuration.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-youtube-http-request-node-configuration.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1229px) 100vw, 1229px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><ol start=\"6\" class=\"wp-block-list\">\n<li>Create an <strong>Edit Fields<\/strong> node and open its configuration panel.&nbsp;<\/li>\n\n\n\n<li>Click <strong>Add fields<\/strong>, add a <strong>name<\/strong>, and select <strong>Object<\/strong>. Then, enter the following setting:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{{ $jmespath( $json.items, \"[?snippet.language == 'en'] | [0]\" ) }}<\/pre><ol start=\"8\" class=\"wp-block-list\">\n<li>Add another<strong> HTTP request <\/strong>node. Use the same configuration as the previous HTTP request node, but turn off <strong>Send Query Parameters<\/strong> and insert the following URL instead:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">https:\/\/www.googleapis.com\/youtube\/v3\/captions\/{{ $json.caption.id }}<\/pre><ol start=\"9\" class=\"wp-block-list\">\n<li>Add an <strong>Extract from Text File <\/strong>node and change the <strong>Destination Output Field<\/strong> to <strong>Content<\/strong>.<\/li>\n\n\n\n<li>Add an <strong>OpenAI<\/strong> node to summarize the video transcript. Choose <strong>Text <\/strong>as the resource and use the following prompt:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Summarise this transcript into three bullet points to sum up what the video is about and why someone should watch it: {{ $json[\"content\"] }}<\/pre><ol start=\"11\" class=\"wp-block-list\">\n<li>Add a Discord node to send the message using Webhook. Your message might look as follows:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">New video out!\n\n**{{ $('YouTube Video Trigger').item.json[\"title\"] }}**\n\n{{ $json[\"message\"][\"content\"] }}\n\n[Watch NOW]({{ $('YouTube Video Trigger').item.json[\"link\"] }}) and remember to share and comment!<\/pre><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e20287b4526\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"2168\" height=\"368\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-youtube-http-request-discord-workflow.png\/public\" alt=\"n8n with YouTube and HTTP request workflow\" class=\"wp-image-125028\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-youtube-http-request-discord-workflow.png\/w=2168,fit=scale-down 2168w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-youtube-http-request-discord-workflow.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-youtube-http-request-discord-workflow.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-youtube-http-request-discord-workflow.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-youtube-http-request-discord-workflow.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-youtube-http-request-discord-workflow.png\/w=1536,fit=scale-down 1536w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-youtube-http-request-discord-workflow.png\/w=2048,fit=scale-down 2048w\" sizes=\"auto, (max-width: 2168px) 100vw, 2168px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><h2 class=\"wp-block-heading\" id=\"h-setting-up-discord-bot-with-n8n\"><strong>Setting up Discord bot with n8n<\/strong><\/h2><p>Leveraging <a href=\"\/ng\/tutorials\/n8n-integrations\">n8n&rsquo;s integration with various platforms<\/a>, you can easily create a Discord bot for different purposes with minimal coding.<\/p><p>Traditionally, you would have had to manually write the bot&rsquo;s function and integrate it with external services for data processing. With n8n, simply add the required nodes and connect them to set up the data flow.<\/p><p>However, n8n currently doesn&rsquo;t have a Discord trigger node, meaning it can&rsquo;t read messages from a server. That said, we can still take input by creating a basic bot.<\/p><p>For example, let&rsquo;s create a bot that generates an image based on a Discord message. Let&rsquo;s start with the n8n workflow:<\/p><ol class=\"wp-block-list\">\n<li>Add a <strong>Webhook<\/strong> node with the <strong>POST<\/strong> method to forward your Discord message. Copy the webhook and store it for later.<\/li>\n\n\n\n<li>Add an <strong>OpenAI <\/strong>node to <strong>generate an image<\/strong>, and then configure your OpenAI account API key.&nbsp;<\/li>\n\n\n\n<li>Go to the <strong>Prompt <\/strong>field, select <strong>Expression<\/strong>,<strong> <\/strong>and enter the following:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{{ $json.body.content }}<\/pre><ol start=\"4\" class=\"wp-block-list\">\n<li>Insert a <strong>Discord <\/strong>node to<strong> send a message<\/strong>.&nbsp; Use the following configuration:\n<ul class=\"wp-block-list\">\n<li><strong>Connection Type<\/strong>: Bot token<\/li>\n\n\n\n<li><strong>Credential for Discord Bot API<\/strong>: Your Discord bot token<\/li>\n\n\n\n<li><strong>Server<\/strong>: The Discord server you want to send the image to<\/li>\n\n\n\n<li><strong>Send to<\/strong>: Channel<\/li>\n\n\n\n<li><strong>Channel<\/strong>: The Discord channel you want to send the image to&nbsp;<\/li>\n\n\n\n<li><strong>Files<\/strong>:<strong> <\/strong>Data<\/li>\n<\/ul>\n<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e20287b6924\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1438\" height=\"478\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/discord-bot-image-generator-workflow-in-n8n.png\/public\" alt=\"The Discord bot image generator workflow in n8n\" class=\"wp-image-125029\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/discord-bot-image-generator-workflow-in-n8n.png\/w=1438,fit=scale-down 1438w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/discord-bot-image-generator-workflow-in-n8n.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/discord-bot-image-generator-workflow-in-n8n.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/discord-bot-image-generator-workflow-in-n8n.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/discord-bot-image-generator-workflow-in-n8n.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1438px) 100vw, 1438px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>This workflow starts when the Discord bot receives a message, sends the message as a prompt to OpenAI, and forwards the generated image to Discord.<\/p><p>Now, let&rsquo;s configure the Discord bot. Here are the steps:<\/p><ol class=\"wp-block-list\">\n<li><a href=\"\/ng\/tutorials\/how-to-host-discord-bot\">Create a Discord bot<\/a> and invite it to your server, but skip the coding process for now.&nbsp;<\/li>\n\n\n\n<li>Open a code editor like <strong>VSCode<\/strong> and create a new folder containing two files &ndash; <strong>main.py<\/strong> and <strong>.env<\/strong>.<\/li>\n\n\n\n<li>In <strong>VSCode&rsquo;s Terminal<\/strong>, enter this command to install the Python dependencies:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">python3 -m pip install discord python-dotenv requests<\/pre><ol start=\"4\" class=\"wp-block-list\">\n<li>Open <strong>main.py <\/strong>in VSCode and enter the following code to define your bot&rsquo;s functionality:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># Import the required modules\n\nimport discord\n\nimport os\n\nimport logging\n\nfrom discord.ext import commands&nbsp;\n\nfrom dotenv import load_dotenv\n\nimport requests\n\nload_dotenv()\n\nWEBHOOK_URL = os.getenv(\"WEBHOOK_URL\")\n\n# Create a Discord client instance and set the command prefix\n\nintents = discord.Intents.all()\n\nclient = discord.Client(intents=intents)\n\nbot = commands.Bot(command_prefix='!', intents=intents)\n\nlogging.basicConfig(\n\n&nbsp;&nbsp;&nbsp;&nbsp;level=logging.INFO,\n\n&nbsp;&nbsp;&nbsp;&nbsp;format='[%(asctime)s] [%(levelname)s]: %(message)s',\n\n&nbsp;&nbsp;&nbsp;&nbsp;handlers=[\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;logging.FileHandler('bot.log'),\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;logging.StreamHandler()\n\n&nbsp;&nbsp;&nbsp;&nbsp;]\n\n)\n\n# Set the confirmation message when the bot is ready\n\n@bot.event\n\nasync def on_ready():\n\n&nbsp;&nbsp;&nbsp;&nbsp;print(f'Logged in as {bot.user.name}')\n\n@bot.event&nbsp;\n\nasync def on_command_error(ctx, error):\n\n&nbsp;&nbsp;&nbsp;&nbsp;error_message = f'Error occured while processing command: {error}'\n\n&nbsp;&nbsp;&nbsp;&nbsp;logging.error(error_message)\n\n&nbsp;&nbsp;&nbsp;&nbsp;await ctx.send(error_message)\n\n# Set the commands for your bot\n\n@bot.command()\n\nasync def message(ctx, *, content: str = None):\n\n&nbsp;&nbsp;&nbsp;&nbsp;\"\"\"Sends a message to the webhook when !message is used\"\"\"\n\n&nbsp;&nbsp;&nbsp;&nbsp;# Check if the user provided a message\n\n&nbsp;&nbsp;&nbsp;&nbsp;if not content:\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;await ctx.send(\"Please provide a message after !message.\")\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return\n\n&nbsp;&nbsp;&nbsp;&nbsp;# Prepare the payload for the webhook\n\n&nbsp;&nbsp;&nbsp;&nbsp;payload = {\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'username': ctx.author.display_name,\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'content': content,\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'avatar_url': ctx.author.avatar.url if ctx.author.avatar else None,\n\n&nbsp;&nbsp;&nbsp;&nbsp;}\n\n&nbsp;&nbsp;&nbsp;&nbsp;# Send the payload to the webhook URL\n\n&nbsp;&nbsp;&nbsp;&nbsp;try:\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;response = requests.post(WEBHOOK_URL, json=payload)\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;response.raise_for_status()\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;await ctx.send(\"Message sent successfully!\")\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(f'Message forwarded: {content}')\n\n&nbsp;&nbsp;&nbsp;&nbsp;except requests.exceptions.RequestException as e:\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;await ctx.send(\"Failed to send the message.\")\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(f'Failed to forward message: {e}')\n\n# Retrieve token from the .env file\n\nbot.run(os.getenv('TOKEN'))<\/pre><ol start=\"5\" class=\"wp-block-list\">\n<li>Open the <strong>.env <\/strong>file, then add your bot token and n8n webhook in their respective placeholders.<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">WEBHOOK_URL=your-webhook-url\n\nTOKEN=your-discord-bot-token<\/pre><ol start=\"6\" class=\"wp-block-list\">\n<li>Save both files by hitting <strong>Ctrl<\/strong> + <strong>S<\/strong>.<\/li>\n<\/ol><p>Now, let&rsquo;s launch your bot by hitting the <strong>Run <\/strong>button on the top right of VSCode. You should see &ldquo;Logged in as Bot-name&rdquo; in the Terminal.<\/p><p>Head to n8n and start your workflow. Then, return to your Discord server and try generating an image using this message:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">!message create an image of a black cat with a purple wizard hat<\/pre><p>Your bot should return the AI-generated image like so.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e20287b8b31\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"726\" height=\"493\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/discord-bot-image-generator.png\/public\" alt=\"Discord bot image generator giving an output\" class=\"wp-image-125030\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/discord-bot-image-generator.png\/w=726,fit=scale-down 726w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/discord-bot-image-generator.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/03\/discord-bot-image-generator.png\/w=150,fit=scale-down 150w\" sizes=\"auto, (max-width: 726px) 100vw, 726px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>To create a more complex Discord bot, simply add more nodes or integrate another workflow. For example, you can integrate n8n with Google Sheets to post data recap to your server.<\/p><h2 class=\"wp-block-heading\" id=\"h-conclusion\"><strong>Conclusion<\/strong><\/h2><p>Integrating n8n with Discord lets you create a custom workflow to automate various tasks. For example, you can create an image generator bot, a message analysis pipeline, or an alerting tool.<\/p><p>To integrate Discord with n8n, start by defining the trigger that starts your workflow. Use <strong>a webhook<\/strong> for a simpler, event-driven flow or <strong>HTTP requests<\/strong> to pull data from third-party APIs.<\/p><p>Optionally add the <strong>OpenAI<\/strong> node to process the passed data. For example, you can feed messages sent through a webhook to the LLM for analysis or use them as prompts for generating images.<\/p><p>Finally, add the <strong>Discord<\/strong> node to perform an action based on the previous node&rsquo;s output, which ranges from sending a message to removing a user form your server.<\/p><p>After learning to integrate n8n with Discord, it&rsquo;s now your time to create your custom workflow! You can purchase an officially hosted plan or <strong>self-host n8n on Hostinger&rsquo;s VPS platform<\/strong>.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-integrate-n8n-with-discord-faq\"><strong>How to integrate n8n with Discord FAQ<\/strong><\/h2><div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1741958895803\"><h3 class=\"schema-faq-question\"><strong>How do I connect n8n to Discord?<\/strong><\/h3> <p class=\"schema-faq-answer\">Simply add the Discord node in n8n and connect it with the trigger event. The trigger event can be a manual action, webhook, or an HTTP request.&nbsp;<br><br>Select the action that Discord will perform, which ranges from sending a response message to managing a user role. Then, activate it by adding a webhook or bot token.&nbsp;<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1741958903440\"><h3 class=\"schema-faq-question\"><strong>What can I do with n8n and Discord?<\/strong><\/h3> <p class=\"schema-faq-answer\">You can <a href=\"\/ng\/tutorials\/what-can-you-automate-with-n8n\">automate various tasks with n8n<\/a> and Discord. For example, you can create a workflow that pulls a user-submitted message and filters it based on OpenAI&rsquo;s moderation rule. You can also create an automated bot that sends a summary of a newly uploaded YouTube video.&nbsp;<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1741958909574\"><h3 class=\"schema-faq-question\"><strong>Are there any pre-built workflows for n8n and Discord?<\/strong><\/h3> <p class=\"schema-faq-answer\">Yes, n8n has user-shared pre-built workflow templates for Discord. You can access them from the <a href=\"https:\/\/n8n.io\/integrations\/discord\/\">n8n Discord integration page<\/a> under the <strong>Popular ways to use Discord integration<\/strong> section. Simply select the template you want, click <strong>Use template<\/strong>, and import it to your server.<\/p> <\/div> <\/div>\n","protected":false},"excerpt":{"rendered":"<p>There are many platforms you can integrate with n8n, Discord being one of the most popular options. This compatibility lets you automate various tasks in the messaging app, from sending a notification to managing users. In this article, we will explain how to integrate n8n with Discord. We will discuss how to do so using [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ng\/tutorials\/how-to-integrate-n8n-with-discord\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":337,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to integrate n8n with Discord: Automate your workflows","rank_math_description":"How to integrate n8n with Discord to automate your workflows: Different methods using webhook, OpenAI, and HTTP requests.","rank_math_focus_keyword":"n8n discord","footnotes":""},"categories":[22644],"tags":[],"class_list":["post-125017","post","type-post","status-publish","format-standard","hentry","category-vps"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/how-to-integrate-n8n-with-discord","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/how-to-integrate-n8n-with-discord","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/how-to-integrate-n8n-with-discord","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/how-to-integrate-n8n-with-discord","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/how-to-integrate-n8n-with-discord","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/how-to-integrate-n8n-with-discord","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/how-to-integrate-n8n-with-discord","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/how-to-integrate-n8n-with-discord","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/125017","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/users\/337"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/comments?post=125017"}],"version-history":[{"count":11,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/125017\/revisions"}],"predecessor-version":[{"id":143406,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/125017\/revisions\/143406"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/media?parent=125017"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/categories?post=125017"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/tags?post=125017"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}