{"id":17800302,"url":"https://github.com/santospatrick/notify","last_synced_at":"2025-03-17T08:37:24.306Z","repository":{"id":258722692,"uuid":"875433045","full_name":"santospatrick/notify","owner":"santospatrick","description":"🔔 Effortless Email and SMS Notification System using Third-Party Providers with Node.js","archived":false,"fork":false,"pushed_at":"2024-10-20T23:58:02.000Z","size":1104,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-02-27T21:37:37.557Z","etag":null,"topics":["babel","nodejs","twilio","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/santospatrick.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["santospatrick"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":null}},"created_at":"2024-10-20T00:49:23.000Z","updated_at":"2024-10-24T22:42:42.000Z","dependencies_parsed_at":"2024-10-27T12:40:59.390Z","dependency_job_id":null,"html_url":"https://github.com/santospatrick/notify","commit_stats":null,"previous_names":["santospatrick/notify"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/santospatrick%2Fnotify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/santospatrick%2Fnotify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/santospatrick%2Fnotify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/santospatrick%2Fnotify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/santospatrick","download_url":"https://codeload.github.com/santospatrick/notify/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243852499,"owners_count":20358271,"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":["babel","nodejs","twilio","typescript"],"created_at":"2024-10-27T12:18:51.271Z","updated_at":"2025-03-17T08:37:24.297Z","avatar_url":"https://github.com/santospatrick.png","language":"TypeScript","funding_links":["https://github.com/sponsors/santospatrick"],"categories":[],"sub_categories":[],"readme":"# `@santospatrick/notify`\n\u003e\n\u003e This library provides an easy-to-use notification system that supports sending notifications via email and SMS using third-party providers.\n\n\n![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=flat-square\u0026logo=typescript\u0026logoColor=white)\n![ESLint](https://img.shields.io/badge/ESLint-4B32C3?style=flat-square\u0026logo=eslint\u0026logoColor=white)\n![Babel](https://img.shields.io/badge/Babel-F9DC3E?style=flat-square\u0026logo=babel\u0026logoColor=black)\n[![npm version](https://img.shields.io/npm/v/@santospatrick/notify?style=flat-square)](https://www.npmjs.com/package/@santospatrick/notify)\n[![Alpha](https://img.shields.io/badge/status-alpha-red.svg?style=flat-square)](https://www.npmjs.com/package/@santospatrick/notify)\n[![Codecov](https://img.shields.io/codecov/c/gh/santospatrick/notify?style=flat-square)](https://codecov.io/github/santospatrick/notify)\n\n\u003cimg src=\"https://raw.githubusercontent.com/santospatrick/notify/main/docs/logo.png\" width=\"250px\" /\u003e\n\n\u003e **Disclaimer:** This library is currently in alpha version and should not be used in production environments. Use it at your own risk.\n\n## Table of Contents\n\n- [Features](#features)\n- [Installation](#installation)\n  - [Using `npm`](#using-npm)\n  - [Using `yarn`](#using-yarn)\n  - [Using `pnpm`](#using-pnpm)\n- [Usage](#usage)\n  - [Example: Sending an email](#example-sending-an-email)\n    - [Configuration: Setting up NotificationManager](#configuration-setting-up-notificationmanager)\n    - [Usage: Sending an email](#usage-sending-an-email)\n- [Third-Party Providers](#third-party-providers)\n  - [Email Providers](#email-providers)\n    - [How to get Twilio Sendgrid Grid API Key](#how-to-get-twilio-sendgrid-grid-api-key)\n- [Local Development](#local-development)\n  - [Step-by-Step Guide](#step-by-step-guide)\n- [Publishing to `npm`, `yarn` and `pnpm`](#publishing-to-npm-yarn-and-pnpm)\n\n## Features\n\n- [x] Send Email notifications\n- [ ] Send SMS notifications\n- [x] Centralized notification management\n- [x] Flexible architecture for extending to other notification channels\n\n## Installation\n\nYou can install this library using any of the following package managers:\n\n### Using `npm`\n\n```bash\nnpm install @santospatrick/notify\n```\n\n### Using `yarn`\n\n```bash\nyarn add @santospatrick/notify\n```\n\n### Using `pnpm`\n\n```bash\npnpm add @santospatrick/notify\n```\n\n## Usage\n\n### Example: Sending an email\n\nHere’s a basic example of how to send an email using the `NotificationManager` from the library:\n\n#### Configuration: Setting up NotificationManager\n\nFirst, create a file named `notificationConfig.ts` to configure the `NotificationManager`:\n\n```typescript\n// notificationConfig.ts\nimport { NotificationManager, EmailProviders } from '@santospatrick/notify';\n\n// Create a new instance of NotificationManager\nconst notificationManager = new NotificationManager();\n\n// Setup email service to use Twilio SendGrid (more to come!)\nnotificationManager.addEmailService({\n  provider: EmailProviders.SENDGRID,\n  apiKey: 'YOUR_API_KEY_HERE', // Your Twilio SendGrid API key that starts with \"SG.\"\n});\n\nexport { notificationManager };\n```\n\n#### Usage: Sending an email\n\nNow, create another file named `sendEmail.ts` to use the `notificationManager` object for sending an email:\n\n```typescript\n// sendEmail.ts\nimport { notificationManager } from './notificationConfig';\n\n// Send notification\nnotificationManager\n  .send({\n    from: 'info@santospatrick.com', // Needs to be a \"Single Sender\" verified in SendGrid.\n    to: 'info@santospatrick.com',\n    subject: 'Hello from my application!',\n    html: '\u003cstrong\u003eHi there! Using @santospatrick/notify lib.\u003c/strong\u003e',\n  })\n  .then(() =\u003e {\n    console.log('Email sent!');\n  })\n  .catch((error) =\u003e {\n    console.error(error);\n  });\n```\n\n## Third-Party Providers\n\n### Email Providers\n\n#### How to get Twilio Sendgrid Grid API Key\n\nThis library uses SendGrid to send email notifications. To set up the SendGrid API key:\n\n1. Sign up for a [Twilio SendGrid account](https://sendgrid.com/).\n2. Go to `Settings \u003e Sender Authentication \u003e Verify a Single Sender \u003e \"Create New Sender\"`.\n3. Fill out the form and click **\"Create\"**.\n4. Go to `Settings \u003e API Keys \u003e \"Create API Key\"`.\n5. Give it a name and select **\"Restricted Access\"**, click **\"Mail Send\"** and enable **\"Mail Send\"** (this is the only permission needed).\n![Notification System Diagram](./docs/sendgrid-mail-send.png)\n6. Click **\"Create \u0026 View\"** and copy the API key.\n\n## Local Development\n\nTo test the library locally while developing, you can use `npm link`. This allows you to symlink your local development version of the library into another project.\n\n### Step-by-Step Guide\n\n1. In the root directory of your library, run:\n\n```bash\nnpm link\n```\n\nThis will create a global symlink to your library.\n\n2. In the project where you want to test the library, run:\n\n```bash\nnpm link @santospatrick/notify\n```\n\nThis will create a symlink from the global `@santospatrick/notify` to the `node_modules` of your project.\n\n3. Make changes to this library and run `yarn build` to compile the TypeScript code.\n\n4. Run your project and test the changes.\n\n## Publishing to `npm`, `yarn` and `pnpm`\n\nTo publish the library to npm, follow these steps:\n\n1. Ensure your code is ready for publishing by running the build command:\n\n```bash\nyarn build\n```\n\n2. Update the version number in the `package.json` file.\n\n```json\n{\n  \"version\": \"0.0.3\" // Next version to be published\n}\n```\n\n3. Once the build is successful, publish the package to npm with public access:\n\n```bash\nnpm publish --access public\n```\n\nThis will publish your library to the npm registry, making it available for others to install and use.\n\nMade with ❤️ by Patrick Santos\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsantospatrick%2Fnotify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsantospatrick%2Fnotify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsantospatrick%2Fnotify/lists"}