{"id":13781183,"url":"https://github.com/lookinlab/adonis-fcm","last_synced_at":"2026-01-31T20:07:41.612Z","repository":{"id":95861903,"uuid":"226200717","full_name":"lookinlab/adonis-fcm","owner":"lookinlab","description":"Firebase Cloud Messaging for AdonisJS","archived":false,"fork":false,"pushed_at":"2021-07-08T08:47:59.000Z","size":36,"stargazers_count":24,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-10-19T14:44:21.310Z","etag":null,"topics":["adonis-cloud-messaging","adonis-fcm","adonis-firebase","adonis-push-notification","adonisjs","fcm"],"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/lookinlab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-12-05T22:35:06.000Z","updated_at":"2025-07-13T14:05:32.000Z","dependencies_parsed_at":"2023-07-11T14:34:17.832Z","dependency_job_id":null,"html_url":"https://github.com/lookinlab/adonis-fcm","commit_stats":{"total_commits":43,"total_committers":2,"mean_commits":21.5,"dds":0.06976744186046513,"last_synced_commit":"88585e7790d05cee2b9ea0b61b833f1d437b1770"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/lookinlab/adonis-fcm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lookinlab%2Fadonis-fcm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lookinlab%2Fadonis-fcm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lookinlab%2Fadonis-fcm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lookinlab%2Fadonis-fcm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lookinlab","download_url":"https://codeload.github.com/lookinlab/adonis-fcm/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lookinlab%2Fadonis-fcm/sbom","scorecard":{"id":598681,"data":{"date":"2025-08-11","repo":{"name":"github.com/lookinlab/adonis-fcm","commit":"88585e7790d05cee2b9ea0b61b833f1d437b1770"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.5,"checks":[{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/28 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T23:48:32.227Z","repository_id":95861903,"created_at":"2025-08-20T23:48:32.232Z","updated_at":"2025-08-20T23:48:32.232Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28952600,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T18:30:42.805Z","status":"ssl_error","status_checked_at":"2026-01-31T18:30:19.593Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["adonis-cloud-messaging","adonis-fcm","adonis-firebase","adonis-push-notification","adonisjs","fcm"],"created_at":"2024-08-03T18:01:23.704Z","updated_at":"2026-01-31T20:07:41.593Z","avatar_url":"https://github.com/lookinlab.png","language":"TypeScript","funding_links":[],"categories":["Packages"],"sub_categories":[],"readme":"# Adonis FCM (Firebase Cloud Messaging)\n\n[![npm-image]][npm-url] [![license-image]][license-url] [![typescript-image]][typescript-url]\n\nThis wrapper for send messages to Firebase Cloud Messaging with help [node-gcm](https://github.com/ToothlessGear/node-gcm)\n\u003e Works with AdonisJS v5\n\nDocs [**for AdonisJS v4**](https://github.com/lookinlab/adonis-fcm/tree/v0)\n\n## Installation\n\nMake sure to install it using `npm` or `yarn`.\n\n```bash\n# npm\nnpm i adonis-fcm\nnode ace invoke adonis-fcm\n\n# yarn\nyarn add adonis-fcm\nnode ace invoke adonis-fcm\n```\n\n## How to use\n\n### Step 1: Get API key\n\nYou need add your app and to receive API key into [Firebase Console](https://console.firebase.google.com/)\n\n### Step 2: Initialization\n\n- Make sure to register the provider inside `.adonisrc.json` file.\n\n```json\n\"providers\": [\n  \"...other packages\",\n  \"adonis-fcm\"\n]\n```\n\n- Add a variables to `.env` file of project.\n```txt\n...\nFCM_API_KEY=YOUR_API_KEY\n```\n\n- Set options in `config/fcm.ts`.\n\n```js\nimport Env from '@ioc:Adonis/Core/Env'\nimport { FCMConfig } from '@ioc:Adonis/Addons/FCM'\n\nconst fcmConfig: FCMConfig = {\n  apiKey: Env.get('FCM_API_KEY'),\n  requestOptions: {\n    // proxy: 'http://127.0.0.1'\n    // timeout: 5000\n  }\n}\nexport default fcmConfig\n```\n\n### Step 3: Use service into controllers/routes/listeners\n\nExample:\n\n```js\nimport { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'\nimport Notification from 'App/Models/Notification'\nimport Event from '@ioc:Adonis/Core/Event'\n\nexport default class NotificationController {\n  // ...\n  async store({ request }: HttpContextContract) {\n    const { title, text } = request.body()\n    const notification = await Notification.create({ title, text })\n\n    Event.emit('notification::created', notification)\n    return notification\n  }\n}\n```\n\nAdd an event to `start/events.ts` file.\n\n```js\nimport Event from '@ioc:Adonis/Core/Event'\nEvent.on('notification::created', 'Notification.created');\n```\n\nCreate a listener:\n\n```bash\nnode ace make:listener Notification\n```\n\nAdd a listener to `app/Listeners/Notification.ts` file.\n\n```js\nimport { EventsList } from '@ioc:Adonis/Core/Event'\nimport FCM from '@ioc:Adonis/Addons/FCM'\n\nexport default class NotificationListener {\n  public async created(notification: EventsList['notification::created']) {\n    const { title, text } = notification.toJSON();\n    \n    const recipients = { condition: \"'notifications' in topics\" }; // or { registrationTokens: [...] }\n    const response = await FCM.send({ notification: { title, body: text }}, recipients);\n  }\n}\n```\n\n## Methods\n\n### FCM.message(params) - return a Message instance\n- params:  {Object} - [Additional Message Options](https://github.com/ToothlessGear/node-gcm#additional-message-options) and [Notification Payload](https://github.com/ToothlessGear/node-gcm#notification-payload-option-table)\n\n### FCM.send(message, options, numberOfTimes) - return a Promise\n- message: {Object|Message}\n- options: {Object} - [Docs](https://github.com/ToothlessGear/node-gcm#recipients)\n\n### FCM.sendNoRetry(message, options) - return a Promise\n- message: {Object|Message}\n- options: {Object} - [Docs](https://github.com/ToothlessGear/node-gcm#recipients)\n \n## Answers:\n\n### Q: Where get a registration tokens?\nThe registration token is sent by the user when he uses your application. You need save token to use it later\n\n### Q: I need to remove all \"bad\" token from my database, how do I do that? \nFor example like this:\n\n```js\nimport { EventsList } from '@ioc:Adonis/Core/Event'\nimport FCM from '@ioc:Adonis/Addons/FCM'\nimport Device from 'App/Models/Device'\n\nexport default class NotificationListener {\n  public async created(notification: EventsList['notification::created']) {\n    const { title, text } = notification.toJSON();\n\n    const devices = await Device.all();\n    const registrationTokens = devices.toJSON().map(device =\u003e device.token);\n    \n    const recipients = { registrationTokens };\n    const response = await FCM.send({ notification: { title, body: text }}, recipients);\n    \n    const badTokens = registrationTokens.filter((token, i) =\u003e response[i].error !== null);\n    await Device.query().whereIn('token', badTokens).delete();\n  }\n}\n```\n\n[npm-image]: https://img.shields.io/npm/v/adonis-fcm?logo=npm\u0026style=for-the-badge\n[npm-url]: https://www.npmjs.com/package/adonis-fcm\n\n[license-image]: https://img.shields.io/npm/l/adonis-fcm?style=for-the-badge\u0026color=blueviolet\n[license-url]: https://github.com/lookinlab/adonis-fcm/blob/develop/LICENSE.md\n\n[typescript-image]: https://img.shields.io/npm/types/adonis-fcm?color=294E80\u0026label=%20\u0026logo=typescript\u0026style=for-the-badge\n[typescript-url]: https://github.com/lookinlab\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flookinlab%2Fadonis-fcm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flookinlab%2Fadonis-fcm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flookinlab%2Fadonis-fcm/lists"}