๐Ÿ“ฆ karishnu / rule-based-gmail

โ˜… 0 stars โ‘‚ 0 forks ๐Ÿ‘ 0 watching
๐Ÿ“ฅ Clone https://github.com/karishnu/rule-based-gmail.git
HTTPS git clone https://github.com/karishnu/rule-based-gmail.git
SSH git clone git@github.com:karishnu/rule-based-gmail.git
CLI gh repo clone karishnu/rule-based-gmail
Loading files...
๐Ÿ“„ README.md

rule-based-gmail

How To

  • Add credentials.json to root dir for google auth
{
    "installed": {
        "client_id": "",
        "project_id": "",
        "auth_uri": "https://accounts.google.com/o/oauth2/auth",
        "token_uri": "https://oauth2.googleapis.com/token",
        "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
        "client_secret": "",
        "redirect_uris": [
            "http://localhost"
        ]
    }
}

  • Fetching and storing emails
node src/emailDownloader.js

  • Performing rule-based actions
node src/action.js

  • Modifying rules
Add rules.json to root dir for rules with format:
{
    "rules": [
        {
            "name": "rule1",
            "predicate": "All", // All, Any
            "conditions": [
                {
                    "field": "from", 
                    "operator": "contains", // contains, does_not_contain, equals, does_not_equal, less_than_days, greater_than_days, less_than_months, greater_than_months
                    "value": "ET Prime: Today's Edition"
                }
            ],
            "actions": [
                {
                    "type": "mark_as_unread" // mark_as_read, mark_as_unread, archive, add_label
                },
                {
                    "type": "archive"
                },
                {
                    "type": "add_label",
                    "value": "test"
                }
            ]
        }
    ]
}