A lightweight Go-based CLI for sending push notifications to mobile and web devices using Firebase Cloud Messaging (FCM). Built with Cobra, designed for developers, DevOps teams, and automation workflows.
- 🔥 Send push notifications to a single device
- 📎 Include custom data payloads (e.g., URLs, actions, metadata)
- 🎛️ Easy-to-use flags and subcommands
- 🧩 Clean project structure (Cobra-style)
- 🔐 Uses Firebase Service Account credentials
- ⚙️ Works with backend scripts, cron jobs, CI/CD, and automation pipelines
Notifycli/
├── cmd/
│ ├── root.go # CLI root command
│ └── notify.go # "send" command
├── internal/
│ └── firebase/
│ └── client.go # Firebase FCM client wrapper
├── go.mod
├── go.sum
├── test/
└── main.go # CLI entry point
git clone https://github.com/johnafariogun/Notifycli
cd Notifycligo build -o notifcligo installDownload a serviceAccount.json from Firebase Console:
Project Settings → Service Accounts → Generate new private key
Place it in in your project root.
notifcli notify --token <DEVICE_TOKEN> [flags]
| Flag | Description | Required |
|---|---|---|
--token |
FCM device token | ✅ yes |
--title |
Notification title | ✅ yes |
--body |
Notification body | ✅ yes |
--url |
Optional link added to data payload | no (defaults to https://google.com) |
--creds |
Path to Firebase service account file | ✅ yes (default: serviceAccount.json) |
You can get an fcm token from https://clever-florentine-b7c154.netlify.app/
notifcli notify \
--token "DEVICE_FCM_TOKEN" \
--title "Deployment Successful" \
--body "Your service is live."notifcli notify \
--token "DEVICE_FCM_TOKEN" \
--title "New Article" \
--body "Tap to read the latest update." \
--url "https://example.com/articles/42"When the mobile app receives the notification, the FCM payload contains:
{
"url": "https://example.com/articles/42"
}Your app can use this to open a web browser or deep-link into a screen.
When calling the CLI with:
--url "https://example.com"The CLI attaches the link to the FCM data payload:
data := map[string]string{
"link": url,
}This ensures the mobile client always receives the link, regardless of platform (Android / iOS).
Handles:
- Firebase app initialization
- Authentication using service account key
- Sending notifications via FCM REST API
- Support for custom data payloads
Easy to extend with:
- batch messaging
- topic messaging
- image notifications
- deep links
- silent pushes
The CLI prints descriptive errors on:
- invalid or missing flags
- missing service account file
- invalid FCM token
- Firebase initialization failures
- network issues