Thomas Pierson d8af8276a1 Make all tests pass by fixing import paths in latest added files. 8 vuotta sitten
..
tests d8af8276a1 Make all tests pass by fixing import paths in latest added files. 8 vuotta sitten
README.md 7683f70a3d Change the project structure to match the Python package standard. 8 vuotta sitten
__init__.py 7683f70a3d Change the project structure to match the Python package standard. 8 vuotta sitten
gmail_checker.py c6f0598d8e fix the import path for the new layout. ex: 'from kalliope.core…' unstead of 'from core' 8 vuotta sitten

README.md

gmail_checker

Synopsis

This neuron access to Gmail and gives the number of unread mails and their titles.

Options

parameter required default choices comment
username YES User info.
password YES User info.

Return Values

Name Description Type sample
unread Number of unread messages int 5
subjects A List with all the unread messages subjects list ['Kalliope commit', 'Beer tonight?', 'cats have superpower']

Synapses example

Simple example :

  - name: "check-email"
    signals:
      - order: "Do I have emails"
    neurons:
      - gmail_checker:
          username: "me@gmail.com"
          password: "my_password"
          say_template: 
            -  "You have {{ unread }} new emails"    

A complex example that read subject emails. This is based on a file_template

  - name: "check-email"
    signals:
      - order: "Do I have emails"
    neurons:
      - gmail_checker:
          username: "me@gmail.com"
          password: "my_password"
          file_template: /templates/my_email_template.j2

Here the content of the my_email_template.j2

You have {{ unread }} email

{% set count = 1 %}
{% if unread > 0 %}
    {% for subject in subjects %}
     email number {{ count }}. {{ subject }}
     {% set count = count + 1 %}
    {% endfor %}
{% endif %}

Notes

Gmail now prevent some mailbox to be accessed from tier application. If you receive a mail like the following:

Sign-in attempt prevented ... Someone just tried to sign in to your Google Account mail@gmail.com from an app that doesn't meet modern security standards.

You can allow this neuron to get un access to your email in your Gmail account settings.