{"id":13658588,"url":"https://github.com/dimagi/gmail-filters","last_synced_at":"2025-04-24T11:32:13.450Z","repository":{"id":20956672,"uuid":"24245316","full_name":"dimagi/gmail-filters","owner":"dimagi","description":"Tool for creating basic Gmail filters","archived":false,"fork":false,"pushed_at":"2016-09-07T07:15:01.000Z","size":40,"stargazers_count":37,"open_issues_count":0,"forks_count":9,"subscribers_count":18,"default_branch":"master","last_synced_at":"2024-11-10T12:42:27.472Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dimagi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-09-19T21:00:12.000Z","updated_at":"2024-02-01T22:25:19.000Z","dependencies_parsed_at":"2022-07-30T02:38:00.406Z","dependency_job_id":null,"html_url":"https://github.com/dimagi/gmail-filters","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimagi%2Fgmail-filters","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimagi%2Fgmail-filters/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimagi%2Fgmail-filters/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimagi%2Fgmail-filters/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dimagi","download_url":"https://codeload.github.com/dimagi/gmail-filters/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250618451,"owners_count":21460098,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T05:01:00.946Z","updated_at":"2025-04-24T11:32:13.090Z","avatar_url":"https://github.com/dimagi.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Gmail Filters\n\nPython library and simple web app for creating GMail filters.\n\nSee [GMail help](https://support.google.com/mail/answer/6579) for info on importing filters into GMail.\n\n## Install\n\nTo install requirements:\n\n```bash\npip install -r requirements.txt\nnpm install -g coffee-script\n```\n\n## Compile Coffee\n\n```bash\ncoffee --compile gmailfilterrecipes/client/static/coffee/*.coffee\n```\n\n\n## Run\n\nJust run\n\n```bash\npython run_server.py\n```\n\nand the web frontend should be running at http://localhost:8080/.\n\n## Configure your recipeset\n\nEach organization or team within an organization will have a different set of filters that are relevant to them;\neach member of that team may then want to further tweak the base set to conform to their particular needs. For example,\neveryone may want a basic filter labeling emails that contain their name, but each person's name is different, so each person's\nfilter must be tweaked accordingly.\n\nIn this framework, the shared filter descriptions are codified as \"recipe sets\", which are then displayed to the individual through\na web interface, so that they may customize it to themself by simply filling out a web form.\n\nAn example recipe set (which is used by the dev team at Dimagi) is included in this repo at `recipesets/default.yml`.\nTo use your own instead, simply change the `gmailfilterrecipes.filters_yml` option in `settings.ini` to point to your own.\n\nA recipeset yaml file has two toplevel components, `options` and `recipes`: `options` let you specify filter options that can be shared\nacross all your recipes, which are then defined under `recipes`. A recipe looks somethin like this:\n\n```yaml\n    -\n        label: Mails directly to me\n        custom_options:\n            -\n                key: names\n                label: \"List your email addresses\"\n                type: list\n        match:\n            to: \"{{ names|join(' OR ') }}\"\n        filters:\n            - label: =^.^=\n              shouldNeverSpam: true\n              shouldAlwaysMarkAsImportant: true\n```\n\nEach recipe specifies a row in the web form that will be shown to the individual. In this case, that row would be labelled\n\"Mails directly to me\", they would require the individual to specify a list of email addresses (could also be just a single one),\nand would create a filter that matches on those emails, applies a gmail label named \"=^.^=\", keeps it from going to spam,\nand marks it as important.\n\n## Library Usage\n\nIf you aren't interested in the front end, you can use `gmailfilterxml`\nas a library for reading and writing gmail filter xml files.\n\nTo create a simple gmail filter:\n\n```python\n\u003e\u003e\u003e from gmailfilterxml import GmailFilterSet, GmailFilter\n\u003e\u003e\u003e import datetime\n\u003e\u003e\u003e\n\u003e\u003e\u003e\n\u003e\u003e\u003e filter_set = GmailFilterSet(\n...     author_name='Danny Roberts',\n...     author_email='droberts@dimagi.com',\n...     updated_timestamp=datetime.datetime(2014, 9, 19, 17, 40, 28),\n...     filters=[\n...         GmailFilter(\n...             id='1286460749536',\n...             from_='noreply@github.com',\n...             label='github',\n...             shouldArchive=True,\n...         )\n...     ]\n... )\n\u003e\u003e\u003e print filter_set.to_xml(pretty=True),\n\u003c?xml version='1.0' encoding='UTF-8'?\u003e\n\u003catom:feed xmlns:apps=\"http://schemas.google.com/apps/2006\" xmlns:atom=\"http://www.w3.org/2005/Atom\"\u003e\n  \u003catom:title\u003eMail Filters\u003c/atom:title\u003e\n  \u003catom:id\u003etag:mail.google.com,2008:filters:1286460749536\u003c/atom:id\u003e\n  \u003catom:updated\u003e2014-09-19T17:40:28Z\u003c/atom:updated\u003e\n  \u003catom:author\u003e\n    \u003catom:name\u003eDanny Roberts\u003c/atom:name\u003e\n    \u003catom:email\u003edroberts@dimagi.com\u003c/atom:email\u003e\n  \u003c/atom:author\u003e\n  \u003catom:entry\u003e\n    \u003catom:category term=\"filter\"/\u003e\n    \u003catom:title\u003eMail Filter\u003c/atom:title\u003e\n    \u003catom:id\u003etag:mail.google.com,2008:filter:1286460749536\u003c/atom:id\u003e\n    \u003catom:updated\u003e2014-09-19T17:40:28Z\u003c/atom:updated\u003e\n    \u003catom:content\u003e\u003c/atom:content\u003e\n    \u003capps:property name=\"from\" value=\"noreply@github.com\"/\u003e\n    \u003capps:property name=\"label\" value=\"github\"/\u003e\n    \u003capps:property name=\"shouldArchive\" value=\"true\"/\u003e\n  \u003c/atom:entry\u003e\n\u003c/atom:feed\u003e\n\u003e\u003e\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimagi%2Fgmail-filters","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdimagi%2Fgmail-filters","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimagi%2Fgmail-filters/lists"}