{"id":21258104,"url":"https://github.com/art1415926535/fcm-adapter","last_synced_at":"2026-05-20T03:34:56.862Z","repository":{"id":138187833,"uuid":"585906089","full_name":"art1415926535/fcm-adapter","owner":"art1415926535","description":"Firebase Cloud Messaging Adapter for Python Projects","archived":false,"fork":false,"pushed_at":"2024-07-30T12:20:55.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-21T21:32:52.694Z","etag":null,"topics":["cloudmessaging","fcm","fcm-http","fcm-messaging","fcm-notifications","fcm-push-notification","firebase","google","googlefirebase"],"latest_commit_sha":null,"homepage":"","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/art1415926535.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":"2023-01-06T12:07:22.000Z","updated_at":"2024-07-30T12:20:58.000Z","dependencies_parsed_at":"2024-07-30T15:38:33.528Z","dependency_job_id":null,"html_url":"https://github.com/art1415926535/fcm-adapter","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/art1415926535%2Ffcm-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/art1415926535%2Ffcm-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/art1415926535%2Ffcm-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/art1415926535%2Ffcm-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/art1415926535","download_url":"https://codeload.github.com/art1415926535/fcm-adapter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243691380,"owners_count":20331958,"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":["cloudmessaging","fcm","fcm-http","fcm-messaging","fcm-notifications","fcm-push-notification","firebase","google","googlefirebase"],"created_at":"2024-11-21T04:07:12.197Z","updated_at":"2026-05-20T03:34:51.838Z","avatar_url":"https://github.com/art1415926535.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FCM Adapter\n\nThis is a simple adapter for the [FCM](https://firebase.google.com/docs/cloud-messaging/) (Firebase Cloud Messaging) service.\n\n## Installation\n```bash\npip install fcm_adapter\n```\n\n```bash\npoetry add fcm_adapter\n```\n\n## Usage\n```python\nfrom fcm_adapter import FCMAdapter\nimport json\n\n\nasync def main(token: str):\n    with open('key.json') as f:\n        key = json.load(f)\n\n    fcm_adapter = FCMAdapter(key)\n\n    await fcm_adapter.send_message(\n        {\n            \"token\": token,\n            \"notification\": {\"title\": \"Hello World\"},\n        }\n    )\n\n```\n\n\n## FCMAdapter initialization\n### Parameters\n- `key: dict` - Google key. You can get it from the [Firebase Console](https://console.firebase.google.com/). Documentation [here](https://firebase.google.com/docs/admin/setup#initialize-sdk).\n- `client: Union[httpx.AsyncClient, None] = None` - httpx.AsyncClient instance. If not provided, a new instance will be created.\n- `send_message_url: Union[str, None] = None` - FCM send message url. If not provided, the default value will be used.\n- `validate_only: bool = False` - Flag for testing the request without actually delivering the message. Works only with the `send_message` method.\n\n\n## `send`\nSend a message to a device.\nSee [FCM documentation](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages/send) for more details.\n\n### Parameters\n- `data: dict` - Data to send to FCM service.\n\n### Returns\n- Response from FCM service. See [FCM documentation](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#Message) for more details.\n\n### Example\n```python\nfrom fcm_adapter import FCMAdapter\n\n\nasync def main(fcm_adapter: FCMAdapter, token: str):\n    response = await fcm_adapter.send(\n        {\n            \"validate_only\": False,\n            \"message\": {\n                \"token\": token,\n                \"notification\": {\"title\": \"Hello World\"},\n            },\n        }\n    )\n```\n\n## `send_message`\nSend a message to a device. The function is a wrapper around the `send` method, \nbut it expects to receive only inner message data.\n\nIf `fcm_adapter.validate_only` is set to `True`, \nthe request to FCM will be sent with `\"validate_only\": true`.\n\n### Parameters\n- `message: dict` - Message data to send to FCM service.\n\n### Returns\n- Response from FCM service. See [FCM documentation](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#Message) for more details.\n\n### Example\n```python\nfrom fcm_adapter import FCMAdapter\n\n\nasync def main(fcm_adapter: FCMAdapter, token: str):\n    response = await fcm_adapter.send_message(\n        {\n            \"token\": token,\n            \"notification\": {\"title\": \"Hello World\"},\n        }\n    )\n```\n\n# Development\nFirst, install [poetry](https://python-poetry.org/docs/#installation).\n\nThen, install dependencies:\n```bash\npoetry install\n```\n\n## Formatting\n```bash\npoetry run black .\n```\n\n## Testing\n```bash\npoetry run pytest\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fart1415926535%2Ffcm-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fart1415926535%2Ffcm-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fart1415926535%2Ffcm-adapter/lists"}