# Set up in-app messages

## How it works[](#how-it-works)

An in-app message is a message that people see within the app. People won’t see your in-app messages until they open your app. If you set an *expiry* period for your message, and that time elapses before someone opens your app, they won’t see your message.

You can also set *page rules* to display your in-app messages when people visit specific pages in your app. However, to take advantage of page rules, you need to use [screen tracking](/integrations/sdk/react-native/tracking/screen-events) features. Screen tracking tells us the names of your pages and which page a person is on, so we can display in-app messages on the correct pages in your app.

## Set up in-app messaging[](#set-up-in-app-messaging)

In-app messages are disabled by default. Just set the `inApp.siteId` option in your `CioConfig`, and your app will be able to receive in-app messages.

1.  Go to and select **Workspace Settings** in the upper-right corner of the Customer.io app and go to [**API and Webhook Credentials**](https://fly.customer.io/workspaces/last/settings/api_credentials).
    
2.  Copy the **Site ID** for the set of credentials that you want to send your in-app messages from. If you don’t have a set of credentials, click **Create Tracking API Key** to generate them.
    
    [![find your site ID](https://docs.customer.io/images/cdp-js-site-id.png)](#64d2b27827ffddb00dc77b851a7a6854-lightbox)
    

```javascript
const config: CioConfig = {
    cdpApiKey: 'cdp_api_key',
    region: CioRegion.US,
    inApp: {
        siteId: 'site_id',
    }
};
```

## Page rules[](#page-rules)

You can set page rules when you create an in-app message. A page rule determines the page that your audience must visit in your app to see your message. However, before you can take advantage of page rules, you need to:

1.  Track screens in your app. See the [Track Events](/integrations/sdk/react-native/tracking/track-events/#manual-screenview) page for help sending `screen` events.
2.  Provide page names to whomever sets up in-app messages in fly.customer.io. If we don’t recognize the page that you set for a page rule, your audience will never see your message.

[![Set up page rules to limit in app messages by page](https://docs.customer.io/images/in-app-page-rule.png)](#a55af0f9917c15a7b484c9df200f448d-lightbox)

Keep in mind: page rules are case sensitive. Make sure your page rules match the casing of the `title` in your `screen` events.

[![The first page rule is Web contains /dashboard. The second page rule is iOS contains Dashboard.](https://docs.customer.io/images/page-rule-case-sensitive.png)](#ba51bbdc9b4c25b5402f99a8a9d30245-lightbox)

## Anonymous messages[](#anonymous-messages)

As of version 4.11, you can send [anonymous in-app messages](/journeys/anonymous-in-app/). These are messages that are sent *only* to people you haven’t identified yet.

You *can* use lead forms in anonymous messages to capture leads and potentially identify people when they submit your form. For example, you could use a lead form and offer a coupon or newsletter to people who provide their email addresses. See [Lead forms](/journeys/messages-and-webhooks/in-app/lead-form/) for more information.