Setting up Firebase (push notifications)
Push notifications use Firebase Cloud Messaging (FCM). The API sends them with the FCM HTTP v1 API using a service account, and the app receives them with the Firebase SDK.
1. Create the Firebase project
- Go to the Firebase console → Add project. Google Analytics is optional.
- Add an Android app with your package name (e.g.
com.yourcompany.app) and downloadgoogle-services.json. - Add an iOS app with your bundle ID and download
GoogleService-Info.plist. - iOS only: under Project settings → Cloud Messaging → Apple app configuration, upload your APNs authentication key (
.p8from Apple Developer → Keys, with "Apple Push Notifications service" enabled), plus its Key ID and your Team ID.
Where the app expects these files, iOS APNs setup and how the app handles pushes: see push-notifications.md. Never commit them to a public repository.
2. Give the API a service account
- In Firebase → Project settings → Service accounts, click Generate new private key. A JSON file downloads.
- In Admin → Settings → Integrations → Firebase, paste the whole JSON file. It is stored encrypted.
That's all. Without this setting, push is off. In-app notifications and emails still work.
3. What the app sends and receives
- After login, and whenever the token changes or the user switches between customer and provider mode, the app calls
POST /api/v1/deviceswithtoken,platform(android/ios) andapp_mode(customer/provider). On logout it callsDELETE /api/v1/devices/{token}. - Every push has
data.typeanddata.link, the deep-link path to open on tap (e.g./bookings/HS-7K3P9Q), plus ids such asbooking_codeorjob_id. - Provider notifications go only to devices registered in provider mode, and customer notifications to customer mode. Account notices (approval, payments) go to every device.
- Titles and texts are in the recipient's language (their
locale). - Users can switch push off per group (bookings, jobs, chat, marketing) under
PATCH /api/v1/me/notification-settings. Payment and account notices are always sent. - Tokens that FCM reports as no longer valid are deleted automatically.
Queue
Notifications are queued. Run php artisan queue:work (or Supervisor/systemd in production). On shared hosting without a long-running worker, see the cPanel install guide (cron-based queue).