Page 1 of 1

SOLVED: Access email contents

PostPosted: Mon Jun 29, 2020 9:39 am
by ryanbuckner
This feature request is to optionally capture the contents of the scanned email either in a variable or postgres DB.

Use Case:

Email gets scanned and contains information about whether school is closed or government is closed and an action group executes to trigger the right Indigo house mode.

Re: Access email contents

PostPosted: Mon Jun 29, 2020 9:42 am
by FlyingDiver
Use Better Email plugin. The message contents are stored in the device state, and you can use a trigger to do whatever you want with it.

Re: Access email contents

PostPosted: Mon Jun 29, 2020 9:49 am
by jay (support)
+1

Re: Access email contents

PostPosted: Mon Jun 29, 2020 10:57 am
by ryanbuckner
FlyingDiver wrote:
Use Better Email plugin. The message contents are stored in the device state, and you can use a trigger to do whatever you want with it.


I'll give it a shot

Re: Access email contents

PostPosted: Sat Jul 04, 2020 10:14 am
by ryanbuckner
ryanbuckner wrote:
FlyingDiver wrote:
Use Better Email plugin. The message contents are stored in the device state, and you can use a trigger to do whatever you want with it.


I'll give it a shot


This solution worked great. Here's what I was able to do:

1) Step 1 - Better Email scans the email and triggers when the "from" field matches
2) The trigger runs a quick python script to extract a URL and push it to an Indigo variable
3) Another trigger sees the variable change and launches a python script that visits the URL from the variable (email) to complete a daily survey

This saves me lots of compliance issues because I have a survey I must submit each morning. The URL changes every day but my results are always the same.

Re: Access email contents

PostPosted: Sat Jul 04, 2020 10:33 am
by FlyingDiver
ryanbuckner wrote:
This solution worked great. Here's what I was able to do:

1) Step 1 - Better Email scans the email and triggers when the "from" field matches
2) The trigger runs a quick python script to extract a URL and push it to an Indigo variable
3) Another trigger sees the variable change and launches a python script that visits the URL from the variable (email) to complete a daily survey

This saves me lots of compliance issues because I have a survey I must submit each morning. The URL changes every day but my results are always the same.


Excellent.

Though I do wonder why you're doing that with two different scripts, rather than all in one script. Unless there's a reason you need to save the URL in the variable?

Re: Access email contents

PostPosted: Sat Jul 04, 2020 10:58 am
by ryanbuckner
to save it for rerun in case it fails

Re: Access email contents

PostPosted: Sat Jul 04, 2020 10:59 am
by FlyingDiver
ryanbuckner wrote:
to save it for rerun in case it fails


Ah. Good point.