EmailDiscussions.com  

Go Back   EmailDiscussions.com > Email Service Provider-specific Forums > FastMail Forum
Register FAQ Members List Calendar Today's Posts
Stay in touch wirelessly

FastMail Forum All posts relating to FastMail.FM should go here: suggestions, comments, requests for help, complaints, technical issues etc.

Reply
 
Thread Tools
Old 3 Nov 2022, 08:41 AM   #1
unreal
Junior Member
 
Join Date: Nov 2022
Posts: 4
Calling webhook / get request from Sieve script

Sorry if this has been asked before, but is it possible to directly issue a get request from a Sieve script in Fastmail? Any code sample would be amazing! I'm trying to no longer have to rely on IFTTT for some home automation stuff. Thanks!
unreal is offline   Reply With Quote

Old 3 Nov 2022, 09:40 AM   #2
BritTim
The "e" in e-mail
 
Join Date: May 2003
Location: mostly in Thailand
Posts: 3,090
I am not sure exactly what you hope to achieve. However, in general (and with very limited exceptions) sieve scripts are designed only to operate directly on the received email itself. Part of its value is that sieve script functionality can rarely involve security risks for that reason. It almost certainly will not directly implement the functionality you have in mind. You may be able to simplify certain tasks. Creative uses of forwarding email copies or generating "vacation" responses based on conditions detected within messages can sometimes replace a lot of complex logic elsewhere. However, sieve scripts are, by design, extremely restricted in the direct side effects they are allowed to have.
BritTim is offline   Reply With Quote
Old 3 Nov 2022, 11:19 AM   #3
unreal
Junior Member
 
Join Date: Nov 2022
Posts: 4
Thanks for the quick response. Here's what I'm trying to achieve: my alarm system doesn't allow integration with home automation systems (such as SmartThings or Home Assistant), therefore the only way I found to capture alarm status changes (armed home, away, off) is to have the system send an email notification to my fastmail account. I have a Sieve script that deciphers the content of the email, and forward a trigger email to an IFTTT trigger, that trigger in return invokes a webhook on my Home Assistant instance to set the Alarm System status accordingly. I want to bypass the IFTTT step entirely and ideally call the webhook (get request to a specific URL) directly from sieve/fastmail. Thanks.
unreal is offline   Reply With Quote
Old 3 Nov 2022, 12:43 PM   #4
BritTim
The "e" in e-mail
 
Join Date: May 2003
Location: mostly in Thailand
Posts: 3,090
Quote:
I want to bypass the IFTTT step entirely and ideally call the webhook (get request to a specific URL) directly from sieve/fastmail
By design, a sieve script will not be allowed to directly have that kind of a side effect.
BritTim is offline   Reply With Quote
Old 3 Nov 2022, 07:12 PM   #5
JeremyNicoll
Essential Contributor
 
Join Date: Dec 2017
Location: Scotland
Posts: 484
Quote:
Originally Posted by unreal View Post
I want to bypass the IFTTT step entirely and ideally call the webhook (get request to a specific URL) directly from sieve/fastmail. Thanks.
I think you're forgetting that the Sieve script runs on fastmail's server. I can think of no reason that they'd want to allow arbitrary code to run there.

You could possibly do something like this if you ran your own mail server somewhere and sent the notification mails to it. Then - assuming that the server had the ability to run custom code to process all or selected incoming emails - you could program it accordingly.
JeremyNicoll is offline   Reply With Quote
Old 4 Nov 2022, 02:46 AM   #6
unreal
Junior Member
 
Join Date: Nov 2022
Posts: 4
Thanks all for the responses. I do understand that Sieve scripts run on FM's servers, all I was looking for is whether there is a way for these scripts to invoke a URL... I already wrote a pretty complex Sieve script to detect my alarm system's automated emails, extract key information from these emails (is the system being armed, disarmed, etc.) and forward to IFTTT's email endpoint to trigger the webhook call from there. None of that is rocket science but if I could remove a step and directly invoke the webhook URL from Sieve, then it would make things more reliable and performant (again by removing the IFTTT link from the chain). I'm not expecting to have Sieve/FM run arbitrary code on their servers, just letting me "poke" a webhook URL through get/post request. Apparently that's not possible. Thanks again for the responses!
unreal is offline   Reply With Quote
Old 4 Nov 2022, 04:10 AM   #7
JeremyNicoll
Essential Contributor
 
Join Date: Dec 2017
Location: Scotland
Posts: 484
Quote:
Originally Posted by unreal View Post
I'm not expecting to have Sieve/FM run arbitrary code on their servers, just letting me "poke" a webhook URL through get/post request.
It's not arbitrary code, from your point of view... but if FM had a mechanism where you could do what /you/ want, it would also allow other people to do arbitrary other things.

Where do you suppose a GET request would put the data returned by the remote server?

Suppose they allowed POST requests? Then their server would be attempting to update locations on third-party webservers. Can you not see that that could be misused, and perhaps cause FM to have their servers blocked?
JeremyNicoll is offline   Reply With Quote
Old 4 Nov 2022, 05:29 AM   #8
somdcomputerguy
Cornerstone of the Community
 
Join Date: Jun 2004
Location: Rupert, WV
Posts: 879
Perhaps this add-on could be used? https://quickfilters.quickfolders.org/filtaquilla.html
Of course, an add-on such as this can only be used in an email client and only when that client is running.

- Bruce
somdcomputerguy is offline   Reply With Quote
Old 4 Nov 2022, 07:46 AM   #9
hadaso
The "e" in e-mail
 
Join Date: Oct 2002
Location: Holon, Israel.
Posts: 4,837
FM already issues get requests when a user opens an email message that contains external images: they issue an http get request and host the retrieved content on fastmailusercontent.com.


So if fetching data from a url counts as running arbitrary code, then FM allows anyone that can send email to FM users to run arbitrary code on their server (and not just arbitrary code that FM users create).
hadaso is offline   Reply With Quote
Old 8 Nov 2022, 02:12 AM   #10
unreal
Junior Member
 
Join Date: Nov 2022
Posts: 4
Quote:
Originally Posted by JeremyNicoll View Post
Where do you suppose a GET request would put the data returned by the remote server?
I'd be happy with the ability to simply "hit" a URL (with parameters, etc. only to trigger something on the receiving end, but with no interest to do anything with the data being returned.

In any case, I get from this thread that this is not something that is going to be possible with FM, so for now I will continue using IFTTT as my intermediate stage to translate emails forwarded from FM into webhook calls, and I'll keep looking for other options, including switching to gmail and investigating building a gmail script to do what I'm trying to accomplish here.

Thanks all again!
unreal is offline   Reply With Quote
Old 8 Nov 2022, 02:36 AM   #11
somdcomputerguy
Cornerstone of the Community
 
Join Date: Jun 2004
Location: Rupert, WV
Posts: 879
Here is another TBird add-on which may or may not (probably the latter) be of use to you. Scriptable Notifications - https://addons.thunderbird.net/eN-US...notifications/

- Bruce
somdcomputerguy is offline   Reply With Quote
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +9. The time now is 05:24 PM.

 

Copyright EmailDiscussions.com 1998-2022. All Rights Reserved. Privacy Policy