Dreamflow push notifications with PushFire
This guide shows how to add Dreamflow push notifications with PushFire. Dreamflow builds real Flutter code from prompts, so you ask its agent to add the PushFire Flutter SDK, then check the result. PushFire is the easiest lifecycle messaging platform for AI agents and vibe coders: push and email lifecycle campaigns, segments and workflows behind one small API.
Push needs Firebase Cloud Messaging, and FCM does not work in Dreamflow's browser preview. Test on a real device or an emulator.
Prerequisites
- A PushFire account and project. Create one at console.pushfire.app.
- Firebase credentials uploaded to the PushFire project. See Create your first project.
- A Public key (pf_pk_...) from Developers → API keys. See Public and Secret keys.
- A Dreamflow project that you own (only the owner can connect Firebase).
Connect Firebase in Dreamflow
- In the Firebase console, click Add project and create a project.
- In Dreamflow, open Firebase in the project sidebar and click Connect.
- Pick your Google account, select the Firebase project and click Continue. This takes two to five minutes.
- Click Configure Firebase. Dreamflow adds Android and iOS apps with your package name and bundle ID, and links google-services.json and GoogleService-Info.plist.
- In Firebase, check Project Settings → Your apps lists both apps. For iOS push, upload your APNs key under Cloud Messaging.
Install the SDK with a Dreamflow prompt
Optional: give the agent context first. Download llms.txt from the SDK repository and add it to your project root.
Paste this prompt if your app uses Firebase Auth:
If your app uses Supabase Auth, use this prompt:
Replace MY_PUSHFIRE_PUBLIC_KEY with your Public key.
Initialize: check the generated code
Check pubspec.yaml:
Check main.dart:
If you prefer to finish by hand, export the project from Dreamflow, run flutter pub add pushfire_sdk, run flutterfire configure, and add the same main.dart code.
Register the device and identify the subscriber
PushFireSDK.initialize registers the device and asks for notification permission. With AuthProvider.firebase or AuthProvider.supabase, the SDK logs the subscriber in on sign-in with the user ID as externalId, and logs out on sign-out. You write no extra code.
To store profile fields such as a plan, ask Dreamflow to call:
Add tags with a prompt
Create the tag in Audience → Tags in the PushFire console and copy its ID. Then prompt:
Trigger a workflow
Start workflows from a server function, for example a Firebase Cloud Function or a Supabase edge function. Your app calls the function, and the function starts the workflow through the REST API with a Secret key. See Send push notifications from Node.js for the function code.
Warning: never ship pf_sk_ in a mobile app, browser bundle or no-code frontend. PushFire does not block a Secret key on a client, and anyone can extract it from your app and message all your users. Start workflows and send messages from your server, a Supabase edge function or a Firebase Cloud Function.
If the Dreamflow agent writes createWorkflowExecution or createImmediateWorkflowForSubscribers into the app, remove it. Those SDK calls are secret key only, not for production apps, and the Public key gets 403 Client key cannot perform this action.
You can also start journeys with no call: set a tag in the app, and a segment on that tag starts the workflow.
Send push and email from your server
From any server, with a Secret key, target the user IDs the app logged in:
Warning: never ship pf_sk_ in a mobile app, browser bundle or no-code frontend. PushFire does not block a Secret key on a client, and anyone can extract it from your app and message all your users. Start workflows and send messages from your server, a Supabase edge function or a Firebase Cloud Function.
For no-code sends, use Broadcast in the console.
Verify delivery
- Export or run the app on a device. Add enableLogging: true to PushFireConfig for this test only, because it logs email and phone.
- Sign in, then confirm the subscriber and device in Audience → Subscribers.
- Send the curl test and check Developers → API Messages → Push Notifications.
- Before you publish, set enableLogging back to false.
Troubleshooting
- Nothing happens in the preview: expected. FCM does not run in the Dreamflow browser preview.
- The agent used ^0.1.3: change the version to ^0.3.4.
- The agent wrote PushFireSDK.initialize(config: ...): the config is positional. Use PushFireSDK.initialize(PushFireConfig(...)).
- PushFireNotInitializedException: a PushFire call runs before initialize finishes. Await it in main().
- No subscriber after sign-in: the authProvider does not match your auth system.
- Tag call fails with "Invalid tag ID": use the tag UUID from the console.
FAQ
Why do push notifications not work in the Dreamflow preview?
Dreamflow previews run in a browser, and the PushFire Flutter SDK supports iOS and Android only. Firebase Cloud Messaging needs a real device or an emulator with Google Play services to issue a token. Run or export the app to a device, sign in, and the subscriber appears in PushFire.
Do I need to write code to use PushFire with Dreamflow?
No. The prompts in this guide make the Dreamflow agent add the package and the initialization. Your auth provider then logs subscribers in automatically. You build workflows, segments and broadcasts visually in the PushFire console. Code is needed only to send targeted push from your own backend.
Which PushFire key should I give Dreamflow?
The Public key (pf_pk_). It can register devices, manage subscribers and set tags, and nothing else. That makes it safe in an app and in a prompt. Never paste a Secret key (pf_sk_) into a prompt or app code, because it can send messages to all your users.
Next steps
- Every SDK method: Flutter push notifications with the PushFire SDK.
- Teach your coding agent PushFire: PushFire AI agent skill.
- Build journeys: Workflows.
- All SDKs: PushFire SDKs and libraries.