{"id":21818663,"url":"https://github.com/itisnajim/strapi-plugin-fcm","last_synced_at":"2025-03-05T04:14:43.785Z","repository":{"id":42938883,"uuid":"510941619","full_name":"itisnajim/strapi-plugin-fcm","owner":"itisnajim","description":"Send FCM notifications from your Strapi app.","archived":false,"fork":false,"pushed_at":"2024-09-03T09:22:52.000Z","size":2889,"stargazers_count":23,"open_issues_count":14,"forks_count":15,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-26T00:08:59.483Z","etag":null,"topics":["fcm","fcm-notifications","firebase-cloud-messaging","notifications","strapi","strapi-plugin","strapi-plugin-fcm","strapi-v4"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/itisnajim.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-06T01:01:59.000Z","updated_at":"2024-09-03T09:19:09.000Z","dependencies_parsed_at":"2024-05-09T13:30:52.209Z","dependency_job_id":"4c62bc00-7930-459d-8e3a-990217f538b6","html_url":"https://github.com/itisnajim/strapi-plugin-fcm","commit_stats":{"total_commits":21,"total_committers":2,"mean_commits":10.5,"dds":0.1428571428571429,"last_synced_commit":"dd0383a608a3a332388a48264416c35a72c5bd87"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itisnajim%2Fstrapi-plugin-fcm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itisnajim%2Fstrapi-plugin-fcm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itisnajim%2Fstrapi-plugin-fcm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itisnajim%2Fstrapi-plugin-fcm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itisnajim","download_url":"https://codeload.github.com/itisnajim/strapi-plugin-fcm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241960888,"owners_count":20049344,"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":["fcm","fcm-notifications","firebase-cloud-messaging","notifications","strapi","strapi-plugin","strapi-plugin-fcm","strapi-v4"],"created_at":"2024-11-27T16:14:23.755Z","updated_at":"2025-03-05T04:14:43.767Z","avatar_url":"https://github.com/itisnajim.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg style=\"max-width: 200px; width: 24%; min-width: 60px; height: auto; margin-block: 1em;\" src=\"public/assets/strapi-plugin-fcm-logo.svg\" /\u003e\n  \u003ch1\u003eStrapi v4 - FCM plugin\u003c/h1\u003e\n  \u003cp\u003eSend FCM notifications from Strapi.\u003c/p\u003e\n\n  \u003cp\u003e\n    \u003ca href=\"https://www.npmjs.org/package/strapi-plugin-fcm\"\u003e\n      \u003cimg src=\"https://img.shields.io/npm/v/strapi-plugin-fcm/latest.svg\" alt=\"NPM Version\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.org/package/strapi-plugin-fcm\"\u003e\n      \u003cimg src=\"https://img.shields.io/npm/dm/strapi-plugin-fcm\" alt=\"Monthly download on NPM\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://codecov.io/gh/itisnajim/strapi-plugin-fcm\"\u003e\n      \u003cimg src=\"https://codecov.io/gh/itisnajim/strapi-plugin-fcm/coverage.svg?branch=master\" alt=\"codecov.io\" /\u003e\n    \u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n\u003cbr/\u003e\n\n## Installation\n\n### From NPM:\n```bash\nnpm install strapi-plugin-fcm\n```\n\n### From YARN:\n```bash\nyarn add strapi-plugin-fcm\n```\n\n### From Git:\n\n1. Clone the plugin into your Strapi project\n\n```bash\ncd /\u003cpath-to-your-strapi-project\u003e/src\n\n# create plugins folder if not exists\n# mkdir plugins\n\n# go to plugins folder\ncd plugins\n\n# clone the plugin code into a folder and skip the prefix\ngit clone https://github.com/itisnajim/strapi-plugin-fcm.git strapi-plugin-fcm\n# install dependencies\ncd strapi-plugin-fcm \u0026\u0026 yarn install # or npm install\n```\n\n2. Enable the plugin in `\u003croot\u003e/config/plugins.js` .\n\n```javascript\nmodule.exports = {\n  // ...\n  'strapi-plugin-fcm': {\n    enabled: true,\n    resolve: './src/plugins/strapi-plugin-fcm' // path to plugin folder\n  },\n  // ...\n}\n```\n\n3. Build the plugin\n\n```bash\n# back to project root and build the plugin\nyarn build # or npm run build\n# start\nyarn develop # or npm run develop\n```\n\n## Configuration\n- In the Firebase console, open Settings \u003e [Service Accounts](https://console.firebase.google.com/project/_/settings/serviceaccounts/adminsdk).\n- Click Generate New Private Key, then confirm by clicking Generate Key.\n- Past the content of your downloaded service account json file into FCM Plugin Configuration \u003e serviceAccount. (like in the picture below, then you may need to restart the server)\n\u003cdiv style=\"margin: 20px 0\" align=\"center\"\u003e\n  \u003cimg style=\"width: 100%; height: auto;\" src=\"public/assets/configuration.png\" alt=\"Configuration\" /\u003e\n\u003c/div\u003e\n\n- In the same interface 'FCM Plugin Configuration', optionally you can provide where the devices tokens are stored, in the picture example above, I store them in User -\u003e **deviceToken** (strapi generate the users database table with the name up_users).\n\n- Optionally you can provide all the topics you have, in the 'FCM Topic' collection type (via the dashboard or via the api - Post requests).\n\u003cdiv style=\"margin: 20px 0\" align=\"center\"\u003e\n  \u003cimg style=\"width: 100%; height: auto;\" src=\"public/assets/topics.png\" alt=\"Topics\" /\u003e\n\u003c/div\u003e\n\n## Usage\n### Via the dashboard\n- Enter the notification content.\n- Select targets to send to.\n- Click send!\n\u003cdiv style=\"margin: 20px 0\" align=\"center\"\u003e\n  \u003cimg style=\"width: 100%; height: auto;\" src=\"public/assets/admin-fcm.png\" alt=\"Admin Fcm\" /\u003e\n\u003c/div\u003e\n\u003cdiv style=\"margin: 20px 0\" align=\"center\"\u003e\n  \u003cimg style=\"width: 100%; height: auto;\" src=\"public/assets/admin-fcm-targets.png\" alt=\"Admin Fcm\" /\u003e\n\u003c/div\u003e\n\n### Another way via the dashboard.\n- you can create a new entry in the 'FCM Notification' collection type and click publish to send to the FCM.\n\n### Via the api\n- First you have to enable and give routes permissions to a specific role or roles.\n\u003cdiv style=\"margin: 20px 0\" align=\"center\"\u003e\n  \u003cimg style=\"width: 100%; height: auto;\" src=\"public/assets/permissions.png\" alt=\"Permissions\" /\u003e\n\u003c/div\u003e\n- Then via an Http Client (axios, ajax, postman, curl or whatever) send a post request with the body data: \n\n```json\n{\n    \"data\": {\n        \"title\": \"OKey\",\n        \"body\": \"Test body\",\n        \"image\": \"\",\n        \"payload\": \"\",\n        \"targetType\": \"topics\",\n        //or \"targetType\": \"tokens\",\n        \"target\": \"client_android\",\n        //or multiple topics \"target\": \"client_android,client_ios\",\n        //or \"target\": \"eyJhbGciOiJFUzI1...\",\n        //publishedAt: null //\u003c\u003c- uncomment this if you want to just add an entry as a draft to 'FCM Notification' collection without publishing and sending FCM.\n    }\n}\n```\n\n- You can send an array too:\n```json\n{\n    \"data\": [{...entry1}, {...entry2}, {...entry3}, ...]\n}\n```\n\n## Trick\nIf you have saved the entries in the FCM Notification collection as drafts, you can scheduled them to be sent to FCM at a later time.\n- [Scheduled publication](https://docs.strapi.io/developer-docs/latest/guides/scheduled-publication.html)\n- [strapi-plugin-publisher\n](https://github.com/ComfortablyCoding/strapi-plugin-publisher)\n\n\u003cbr/\u003e\n\n## References\n\n- [Strapi v4 developer documentation](https://docs.strapi.io/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitisnajim%2Fstrapi-plugin-fcm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitisnajim%2Fstrapi-plugin-fcm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitisnajim%2Fstrapi-plugin-fcm/lists"}