{"id":28473235,"url":"https://github.com/nylas/nodejs-sample-process-all-mail","last_synced_at":"2025-08-05T12:25:18.989Z","repository":{"id":76969568,"uuid":"70755631","full_name":"nylas/nodejs-sample-process-all-mail","owner":"nylas","description":"An example of a NodeJS application that processes all existing and incoming email messages in connected accounts.","archived":false,"fork":false,"pushed_at":"2016-10-14T00:32:30.000Z","size":18,"stargazers_count":6,"open_issues_count":2,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-02T02:37:49.205Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nylas.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-10-13T01:09:02.000Z","updated_at":"2017-09-12T19:07:11.000Z","dependencies_parsed_at":"2023-02-27T05:45:49.683Z","dependency_job_id":null,"html_url":"https://github.com/nylas/nodejs-sample-process-all-mail","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nylas/nodejs-sample-process-all-mail","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nylas%2Fnodejs-sample-process-all-mail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nylas%2Fnodejs-sample-process-all-mail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nylas%2Fnodejs-sample-process-all-mail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nylas%2Fnodejs-sample-process-all-mail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nylas","download_url":"https://codeload.github.com/nylas/nodejs-sample-process-all-mail/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nylas%2Fnodejs-sample-process-all-mail/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267417664,"owners_count":24083839,"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","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-06-07T12:06:37.009Z","updated_at":"2025-07-27T20:04:46.004Z","avatar_url":"https://github.com/nylas.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nylas Sync Example\n\nThis example demonstrates how to process all mail in your user's email accounts,\ncreating a cache of the messages in an application database and processing each\nmessage as it is ingested.\n\nWhen an email account is linked via the example web service, a task is queued\nwhich starts pagination through all of the messages available via the Nylas API.\nThe web service responds to the Nylas Webhooks API to process messages that\nare synced or received after the initial pagination. This ensures that every\nmessage in the email account is seen and processed.\n\nThis example also demonstrates how to use Redis to queue work, rather than processing\nit on the fly as it is received. The fetching and processing of mail is separated\nfrom the web service which responds to webhooks, so the two can be scaled separately.\nIn production, you might consider using another queue service, like [Amazon SQS](https://aws.amazon.com/sqs/), and \nusing the number of items in the queue as a scaling trigger for the worker pool.\n\n# Dependencies\n\n## ngrok\n\nUsing the Nylas Webhooks API requires that Nylas is able to reach your machine\nto send a webhook. To make testing easy, this example uses [ngrok](https://ngrok.com/).\n\n## NodeJS / NPM\n\nMake sure `node` and `npm` are installed. **This example requires Node 4.0 or greater and uses [ES2016 JavaScript syntax](https://babeljs.io/docs/learn-es2015/).**\n\n## Redis\n\nThis example uses [Redis](http://redis.io/) as a simple queue service. In production, you might consider\nusing ActiveMQ or [Amazon Simple Queue Service]((https://aws.amazon.com/sqs/)) (SQS). To install redis on Mac OS X,\nrun `brew install redis`.\n\n# Getting Started\n\n1. Install Dependencies:\n\n```bash\nnpm install\n```\n\n2. Place your Nylas App ID and Secret in `config.js`\n\n3. Start a Redis server by running `redis-server` at a command prompt.\n\n4. Start [ngrok](https://ngrok.com/) by running `ngrok http 1234` at a command prompt.\n\n# Running\n\nIn two separate terminals, launch the web service and a sync worker. You can run\nmultiple sync workers if you'd like - they pull tasks from the Redis queue:\n\n```\nnpm run web\n```\n\n```\nnpm run worker\n```\n\nFollow the instructions that are printed to the console by the web service. To\nsee the example in action, you'll need to link an account by visiting http://localhost:1234/\n\nOnce you've linked an account, you'll see `database.sqlite` begin to fill with\nemail messages, with the subject prefixed with \"PROCESSED:\".\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnylas%2Fnodejs-sample-process-all-mail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnylas%2Fnodejs-sample-process-all-mail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnylas%2Fnodejs-sample-process-all-mail/lists"}