Get started with Firebase In-App Messaging

This quickstart shows you how to set upFirebase In-App Messaging and send your first message.


Before you begin

Before starting, make sure toadd Firebase to your Apple project.

Add theFirebase In-App Messaging SDK to your project

Use Swift Package Manager to install and manage Firebase dependencies.

Visitour installation guide to learn about the different ways you can add Firebase SDKs to your Apple project, including importing frameworks directly and using CocoaPods.
  1. In Xcode, with your app project open, navigate toFile > Add Packages.
  2. When prompted, add the Firebase Apple platforms SDK repository:
  3.   https://github.com/firebase/firebase-ios-sdk.git
    Note: New projects should use the default (latest) SDK version, but you can choose an older version if needed.
  4. Choose theIn-App Messaging library.
  5. Add the-ObjC flag to theOther Linker Flags section of your target's build settings.
  6. To useIn-App Messaging, you mustenableGoogle Analyticsin your Firebase project and add the Firebase SDK for Google Analytics to your app. You can selecteither the library without IDFA collection or with IDFA collection. See our FAQ on thelatest organization of modules in theGoogle Analytics for Firebase SDK.
  7. When finished, Xcode will automatically begin resolving and downloading your dependencies in the background.

Now, initialize the SDK in your app:

  1. Import the Firebase module in yourApp struct orUIApplicationDelegate, if you haven't yet:
    Swift
    importFirebase
    Objective-C
    @importFirebase;
  2. Also configure aFirebaseApp shared instance, typically in yourApp's initializer or your app delegate'sapplication(_:didFinishLaunchingWithOptions:) method, if you haven't yet:
    Swift
    FirebaseApp.configure()
    Objective-C
    [FIRAppconfigure];
  3. Compile and run your app.
Note:Firebase In-App Messaging requires Firebase version 5.6.0 or higher. If you're having trouble compiling your app, try runningpod update in your app's project directory. Keep in mind, though, that the command updates all of your app's dependencies, not just Firebase ones.

Send a test message

Get your app's installation ID

To conserve power,Firebase In-App Messaging only retrieves messages from theserver once per day. That can make testing difficult, so theFirebase console allows you to specify a test device that displays messageson demand.

That testing device is determined by aFirebase installation ID provided by theFirebase installations service. To find your testing app's installation ID, run the app with theruntime command argument-FIRDebugEnabled:

  1. With your Xcode project open, selectProduct > Scheme > Edit scheme... from the top menu bar.
  2. Open theArguments tab of the dialog that pops up.
  3. Click+ Add items underArguments Passed On Launch.
  4. Enter "-FIRDebugEnabled" in the newly-created field.
  5. ClickClose, then run your app.

Once your app starts running, look for the following line in the Xcode console's logs:

[Firebase/InAppMessaging][I-IAM180017] Starting InAppMessaging runtime with Firebase Installation IDYOUR_INSTALLATION_ID

Send a message to your testing device

Once you've launched your app on the testing device and you have itsFirebase installation ID (FID), you can try out yourFirebase In-App Messagingsetup by sending a test message:

  1. In theFirebase console, open theMessaging page.
  2. If this is your first campaign, clickCreate your first campaign.
    1. SelectFirebase In-App messages and clickCreate.
  3. Otherwise, on theCampaigns tab, clickNew campaign.
    1. SelectIn-App Messaging.
  4. Enter aTitle for your first message.
  5. ClickTest on Device
  6. Enter your app'sFirebase installation ID in theAdd an installation ID field.
  7. ClickTest to send the message.

Firebase In-App Messaging sends your test message as soon as you clickTest. To see themessage, you need to close, then reopen the app on your testing device.

To confirm whether your device is a test device, look for the followinglog message:

[Firebase/InAppMessaging][I-IAM180017] Seeing test message in fetch response. Turn the current instance into a testing instance.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-17 UTC.