{"id":20064103,"url":"https://github.com/i10416/firebase-messaging-rs","last_synced_at":"2025-08-17T16:16:23.557Z","repository":{"id":104298466,"uuid":"587344196","full_name":"i10416/firebase-messaging-rs","owner":"i10416","description":"firebase messaging API wrapper for Rust","archived":false,"fork":false,"pushed_at":"2025-04-29T15:55:18.000Z","size":121,"stargazers_count":6,"open_issues_count":15,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-29T16:48:14.708Z","etag":null,"topics":["fcm","firebase","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/i10416.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,"zenodo":null}},"created_at":"2023-01-10T14:35:18.000Z","updated_at":"2025-04-15T05:39:08.000Z","dependencies_parsed_at":"2023-12-21T04:57:22.563Z","dependency_job_id":"b3db8130-d7fe-4f53-b23f-28c83988896e","html_url":"https://github.com/i10416/firebase-messaging-rs","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i10416%2Ffirebase-messaging-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i10416%2Ffirebase-messaging-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i10416%2Ffirebase-messaging-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i10416%2Ffirebase-messaging-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/i10416","download_url":"https://codeload.github.com/i10416/firebase-messaging-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252542561,"owners_count":21764989,"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","firebase","rust"],"created_at":"2024-11-13T13:44:49.381Z","updated_at":"2025-05-05T17:33:27.848Z","avatar_url":"https://github.com/i10416.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"## firebase-messaging-rs\n\n[![ci](https://github.com/i10416/firebase-messaging-rs/actions/workflows/ci.yaml/badge.svg)](https://github.com/i10416/firebase-messaging-rs/actions/workflows/ci.yaml)\n\n## Install\n\nCargo.toml\n\n```toml\nfirebase-messaging-rs  = {git = \"ssh://git@github.com/i10416/firebase-messaging-rs.git\", branch = \"main\", version = \"0.8\"}\n\n# wip: firebase-messaging-rs = \"0.8\"\n\n```\n\n## Overview\n\nThis crate implements some wrapper functions for google FCM APIs and Instant ID APIs.\n\nGeneral features like authorization are delegated to [gcloud-sdk-rs](https://github.com/abdolence/gcloud-sdk-rs) under the hood, so you can use oauth2 and OIDC instead of API_KEY.\n\n\n## Features\n\nYou can choose tls backend from native-tls or rustls.\n\n```toml\nfirebase-messaging-rs  = {git = \"ssh://git@github.com/i10416/firebase-messaging-rs.git\", branch = \"main\", version = \"0.4\", features = [\"rustls\"] }\n\n# firebase-messaging-rs = { version = \"\u003cversion\u003e\", features = [\"fcm\", \"topic\", \"rustls\"] }\n```\n\n## Required GCP roles\n\nYour service account needs following GCP role(s).\n\n- roles/firebase.sdkAdminServiceAgent.\n\nIf you need fine-grained permissions, see the table bellow and grant required roles for each api.\n\n\n| api                            | roles                              |\n| ------------------------------ | ---------------------------------- |\n| [https://iid.googleapis.com/iid](https://iid.googleapis.com/iid) | roles/identityplatform.admin       |\n|                                | roles/firebasecloudmessaging.admin |\n|                                | roles/cloudconfig.admin            |\n## Example\n\n\n### Register Token to Topic and Un-Register Token from Topic\n\n```rust no_run\nuse firebase_messaging_rs::FCMClient;\nuse firebase_messaging_rs::topic::*;\n\n// you need to have application_default_credentials.json at $HOME/.config/gcloud directory\n// or export GOOGLE_APPLICATION_CREDENTIALS env to authenticate to Firebase.\n#[tokio::main]\nasync fn main() {\n  let client = FCMClient::new().await.unwrap();\n\n\n  let topic_name = \"topic_name\";\n  // bulk register tokens\n  let res = client.register_tokens_to_topic(\n    topic_name.into(),\n    vec![\"token_0\".to_string(),\"token_1\".to_string()]\n  ).await.unwrap();\n\n  println!(\"{res:?}\");\n  // =\u003e TopicManagementResponse {results: [{}, {\"error\": \"INVALID_ARGUMENT\"}, ...] }\n\n  let sts = client\n    .get_info_by_iid_token(\"token_0\", true)\n    .await\n    .unwrap();\n  println!(\"{sts:?}\");\n  // =\u003e Ok(\n  //  TopicInfoResponse {\n  //    application: \"com.example.app.name\",\n  //    authorized_entity: \"123456789012\",\n  //    platform: \"ANDROID\",\n  //    app_signer: \"....\",\n  //    rel: Some(\n  //      topics: {\"topic_name\" : { \"addDate: : \"yyyy-MM-dd\" }}\n  //    )\n  //  }\n  //)\n\n  // un-register token from topic\n  let res = client\n    .unregister_tokens_from_topic(\n      topic_name,\n      vec![\"token_0\".to_string()]\n    ).await\n    .unwrap();\n  // =\u003e Ok(TopicManagementResponse { results: [{}] })\n}\n\n```\n\n### Send Notification to Topic\n\n```rust no_run\nuse std::collections::HashMap;\nuse firebase_messaging_rs::FCMClient;\nuse firebase_messaging_rs::fcm::*;\nuse firebase_messaging_rs::fcm::android::*;\nuse firebase_messaging_rs::fcm::ios::*;\nuse firebase_messaging_rs::fcm::webpush::*;\n\n#[tokio::main]\nasync fn main() {\n  let client = FCMClient::new().await.unwrap();\n\n  let message = Message::Topic {\n    topic: \"example\".to_string(),\n    fcm_options: Some(FcmOptions::new(\"example\")),\n    notification: Some(Notification {\n      title: Some(\"example\".to_string()),\n      body: Some(\"example\".to_string()),\n      ..Default::default()\n    }),\n    android: Some(AndroidConfig {\n       priority: Some(AndroidMessagePriority::High),\n       ..Default::default()\n    }),\n    webpush: None,\n    apns: Some(ApnsConfig::new(\n      \u0026Aps {\n        content_available: Some(ContentAvailable::On),\n        ..Default::default()\n      },\n      \u0026HashMap::from_iter([\n        (\"foo\".to_string(),\"bar\".to_string())\n      ]),\n      Some(\n        ApnsHeaders {\n          apns_push_type: Some(ApnsPushType::Alert),\n          ..Default::default()\n        }\n      )\n    ))\n  };\n  let res = client.validate(\u0026message).await;\n  // =\u003e Ok(MessageOutput { name: \"projects/{project-id}/messages/{id}\" })\n}\n\n```\n\n\n## License\n\nLicensed under either of [Apache License, Version 2.0](https://github.com/abdolence/gcloud-sdk-rs/blob/master/LICENSE-APACHE) or [MIT license](https://github.com/abdolence/gcloud-sdk-rs/blob/master/LICENSE-MIT) at your option.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fi10416%2Ffirebase-messaging-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fi10416%2Ffirebase-messaging-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fi10416%2Ffirebase-messaging-rs/lists"}