Skip to content

Instantly share code, notes, and snippets.

@moni-ai
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moni-ai/c8821c3a8dc1867a8d73 to your computer and use it in GitHub Desktop.
Save moni-ai/c8821c3a8dc1867a8d73 to your computer and use it in GitHub Desktop.
Is my last email good or bad?

If you ask Moni.ai, your virtual assistant, "Is my last email good or bad?" she will tell you by performing a sentiment analysis on your last email. She will then ask you if she should read you the email. Pleast note that you need to signup https://moni.ai first (free). The Moni.ai node is required.

[{"id":"efac32a8.1053d","type":"Moni.ai out","trigger":"","name":"","x":852,"y":525,"z":"d3333a50.2cccc8","wires":[]},{"id":"467b7161.b9849","type":"Moni.ai ask","name":"want to read the mail?","trigger":"","x":661,"y":306,"z":"d3333a50.2cccc8","wires":[["36290d56.c9d6f2"]]},{"id":"89625bca.769da8","type":"sentiment","name":"","x":242,"y":260,"z":"d3333a50.2cccc8","wires":[["b2d74b9d.4d28b8"]]},{"id":"963accd.f69c53","type":"change","name":"save msg","rules":[{"t":"set","p":"mymsg","to":"msg.payload"}],"action":"","property":"","from":"","to":"","reg":false,"x":451,"y":514,"z":"d3333a50.2cccc8","wires":[["a453c002.5bac4"]]},{"id":"fc70781f.038f88","type":"e-mail in","repeat":"300","server":"imap.gmail.com","port":"993","name":"emailbox","x":107,"y":329,"z":"d3333a50.2cccc8","wires":[["89625bca.769da8","963accd.f69c53"]]},{"id":"5a0ad32c.a5f52c","type":"Moni.ai in","name":"","trigger":"","username":"","password":"","x":633,"y":58,"z":"d3333a50.2cccc8","wires":[["6ae438ac.951bc8"]]},{"id":"b2d74b9d.4d28b8","type":"switch","name":"Is sentiment good or bad?","property":"sentiment.score","rules":[{"t":"gte","v":"0"},{"t":"lt","v":"0"}],"checkall":"true","outputs":2,"x":444,"y":184,"z":"d3333a50.2cccc8","wires":[["aa23c3ba.55dc4"],["5d44e407.a2bb1c"]]},{"id":"aa23c3ba.55dc4","type":"change","name":"Good","rules":[{"t":"set","p":"mymsg","to":"it is good, do you want me to read it?"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":127,"z":"d3333a50.2cccc8","wires":[["6ae438ac.951bc8"]]},{"id":"5d44e407.a2bb1c","type":"change","name":"Bad","rules":[{"t":"set","p":"mymsg","to":"It is bad, do you want me to read it?"}],"action":"","property":"","from":"","to":"","reg":false,"x":669,"y":227,"z":"d3333a50.2cccc8","wires":[["6ae438ac.951bc8"]]},{"id":"36290d56.c9d6f2","type":"switch","name":"Want me to read it?","property":"payload","rules":[{"t":"eq","v":"yes"},{"t":"else"}],"checkall":"true","outputs":2,"x":564,"y":368,"z":"d3333a50.2cccc8","wires":[["a453c002.5bac4"],["93f20deb.6c0df"]]},{"id":"93f20deb.6c0df","type":"Moni.ai out","trigger":"Ok, I won't read it","name":"","x":874,"y":371,"z":"d3333a50.2cccc8","wires":[]},{"id":"6ae438ac.951bc8","type":"function","name":"output sentiment","func":"\nif (msg.sentiment) {\n context.mymsg = msg.mymsg;\n}\n\n\nmsg.payload = context.mymsg;\nreturn msg;\n","outputs":1,"valid":true,"x":870,"y":174,"z":"d3333a50.2cccc8","wires":[["467b7161.b9849"]]},{"id":"a453c002.5bac4","type":"function","name":"output email","func":"\nif (msg.mymsg) {\n context.email = msg.mymsg;\n}\n\n\nmsg.payload = context.email;\nreturn msg;\n","outputs":1,"valid":true,"x":718,"y":442,"z":"d3333a50.2cccc8","wires":[["efac32a8.1053d"]]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment