Approval via email #2697
-
I have just discovered windmill and it looks awesome ❤️ As I was thinking about how to develop a few flows (I was considering Airflow before) and one of the ones I do not know how to approach is a general "approval by email". The idea would be to use the SMPT integration to send emails with two links: approve and deny. Clicking on these links would call a webhook that would update a workflow step. (EDIT: I specifically do not want to have the approvers to go to Windmill to perform the approval on the web interface, I need the links in the email to directly trigger an approval or a deny). First of all: is this the right approach, generally speaking (especially the webhook part) Then, the webhook would need to be called with a unique token that can identify and confirm the source (so it is impossible to spoof the approver). What do you think is the right way to handle this?
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Hi, Windmill has a built-in mechanism for approval steps: https://www.windmill.dev/docs/flows/flow_approval |
Beta Was this translation helpful? Give feedback.
-
Thank you for your answer @HugoCasa
I saw that one as one of the possible actions.
This was a solution I did not want to use. I should have made it explicit in the question (which I will do). The thing is that I do not want to redirect the recipients to Windmill to perform their approval (for various reasons, some very good, some less good). I need to have the link in the email to trigger the approval/deny on its own, without further intervention. Thus the idea of the webhook, and especially the possibility to use a built-in solution to handle this, as opposed to writing the engine myself (a database that would get populated with the requests IDs, and then updated with the approval/denial) |
Beta Was this translation helpful? Give feedback.
-
Fantastic, thank you. I will try this out.
This is a good point - and it has already surfaced with other similar cases (even for basic "an email was sent with a link to confirm ..." that got checked in the background, confirming something not intended to be confirmed). This triggered a change of the email security provider because the other one could not prevent that. |
Beta Was this translation helpful? Give feedback.
you only need to slightly modify the script to have access to the direct url to approve it:
Line 43:
and send the resume url instead. It works with both POST and GET. We do not recommend doing this because most email provider will check the urls and thus trigger the approval