n8n EXECUTIONS_PROCESS setting (default: own, main): main
Running n8n via (Docker, npm, n8n cloud, desktop app): npm
Operating system: Linux
Hello. Trying to automate the process of document circulation when an employee goes on vacation, a business trip, etc…
Briefly, how the system should work: Initial mail (IMAP) - test mail that receives a letter with a specific tag in the subject. If the tag matches what is in the business_trip or vacation condition, then the document goes further down the chain to the next user. The user sees this letter and, depending on how the letter is responded to: agreed - the letter goes further along the chain, if not agreed - the letter goes back to the first sender. Now it is not possible to implement the moment when the document should stop for agreed/not agreed; it immediately tries to go through the entire process.
@Jon, I thought that it would be possible to add an html buttons approved/not agreed to in the letter itself, if possible, and then the letter would go further along the mail chain. For example, after the Initial mail (IMAP) trigger was processed, the letter was sent to the next person in the mail. Then he sees this letter, and in the body of the letter there are buttons: agreed/not agreed. If he clicked agreed, then the letter goes to the next person. If not agreed upon, the letter is sent back to the first sender. This was the first option. Now the second one. Again, after the trigger worked, the letter went to the next person in the mail. He saw this letter and liked everything. He decided to respond to this letter and wrote #agreed in the subject of the letter and the letter went on to the next mail
In the email node before you need to create a html with two buttons in it. (I asked ChatGPT to generate it for me ):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Email with Buttons</title>
</head>
<body>
<p>Dear recipient,</p>
<p>We would like to get your feedback. Please click on one of the buttons below:</p>
<!-- Agree Button -->
<a href="{{ $execution.resumeUrl }}?agree=true" style="text-decoration: none; display: inline-block; padding: 10px 20px; background-color: #4CAF50; color: white; border-radius: 5px; margin-right: 10px;">
Agree
</a>
<!-- Disagree Button -->
<a href="{{ $execution.resumeUrl }}?agree=false" style="text-decoration: none; display: inline-block; padding: 10px 20px; background-color: #f44336; color: white; border-radius: 5px;">
Disagree
</a>
<p>Thank you for your response!</p>
</body>
</html>
Make sure to reference $execution.resumeUrl as href in the anchor tag. I also added the query parameter agree which can be true or false depending on the clicked button.
And then you can just repeat all of this with the next recipients. The url is always $execution.resumeUrl in your send email nodes for the buttons in html.
What is not working like you would expect? Please give more information. What happend in your waiting nodes after clicking one of the buttons? how does the email look like? What is $execution.resumeUrl in your case?
You need to set the WEBHOOK_URL environment variable so that n8n knows what URL to use that should then remove the localhost option and also fix the other webhook issues you have not ran into yet.
Hey @KamaR, WEBHOOK_URL is an environment variable in your installation settings. You told in your first post that you installed n8n with npm. Is it on your local mashine or is it on a server?
It is crucial that the mashine n8n is running on, is reachable for the rest of the internet. At least the email receivers must be able to reach out the n8n instance.
You find the instructions for setting WEBHOOK_URL depending on your installation method over here:
@nico-kow “Is it on your local mashine or is it on a server?” - on a server
Look how I’m trying to do it:
I launch webhook and enter the domain with n8n in the browser field
Hey @KamaR,
So to make this work (and also the Webhook Trigger node) you need to set the environment variable WEBHOOK_URL to the url you access n8n. Something like:
WEBHOOK_URL=https://yourserver.ru:5678/
Important note!
Your email receivers need network access to your server where n8n is running, otherwise this will not work.
If you have no clue what im talking about it, I would recommend to try the cloud version of n8n. Selfhosting is not that easy and on the cloud version everything will just work as expected.
this problem is not the workflow configuration. You can copy the one i posted yesterday and it will work.
The problem is that your installation of n8n is not configured correctly. Please read the documentation about this:
Please consider switching to the cloud version of n8n, if you don’t understand what my message is about. You could also ask for professional (paid) help to install your n8n instance properly.