> ## Documentation Index
> Fetch the complete documentation index at: https://feddy.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Unread badge

> Show users that a reply is waiting, on the button that opens Feddy or anywhere else in your app.

By the end of this page, the button that opens Feddy will show how many replies are waiting, and the number will disappear once the user has read them.

You don't have to keep the count up to date yourself. The SDK checks for new replies on its own: every 30 seconds on iOS, and every 45 seconds on the web plus whenever the user returns to the tab.

## iOS

### A row in a List or Form

```swift theme={null}
Form {
    Button("Support") { Feddy.present() }
        .feddyUnreadBadge()
}
```

This is the same badge iOS puts on rows in the Settings app. Nothing is drawn when the count is zero.

### A row that draws its own chevron

A list badge sits at the trailing edge of the row, which would put it outside your chevron. Place the marker yourself instead:

```swift theme={null}
HStack {
    Text("Support")
    Spacer()
    FeddyUnreadDot(showsCount: true)
    Image(systemName: "chevron.forward")
}
```

Pass `showsCount: false` for a plain dot without the number.

### A tab bar item or anything custom

Read the count from `FeddyUnread.shared`. It's an observable object, so a SwiftUI view that reads it updates itself whenever the count changes:

```swift theme={null}
struct RootTabs: View {
    @ObservedObject private var unread = FeddyUnread.shared

    var body: some View {
        TabView {
            SupportView()
                .tabItem { Label("Support", systemImage: "bubble.left") }
                .badge(unread.count)
        }
    }
}
```

In a UIKit app, assign a function to `Feddy.onUnreadCountChanged` and set `tabBarItem.badgeValue` from it.

### Keep it fresh when the app comes back

While the app is in the background, the SDK stops checking. When the user returns, ask for a fresh count right away so the badge is right before the next scheduled check:

```swift theme={null}
.onChange(of: scenePhase) { phase in
    if phase == .active { Feddy.refresh() }
}
```

## Web

If you're using the floating chat button, there's nothing to do: it shows the count itself.

If you've turned it off with `launcher: false`, give Feddy a function to call whenever the count changes, and update your own element from it:

```js theme={null}
Feddy.init({ projectId: 'fd_XXXXXXXXXXXXXXXX', launcher: false })

const badge = document.querySelector('#help-badge')
Feddy.onUnreadCountChanged = (count) => {
  badge.hidden = count === 0
  badge.textContent = String(count)
}
```

## Reply popups

A badge only helps if the user looks at where you put it. So when someone comes back to your app with a reply they haven't seen, Feddy also shows a card with the latest message, at the top of the screen on iOS and above the floating button on the web. Tapping it opens the conversation.

Each reply pops up at most once, and only replies from the last 14 days do. After that the badge is the only signal. Turn popups off with `Feddy.replyPopupsEnabled = false` on iOS (for example while a paywall is up) or `replyPopups: false` in `Feddy.init` on the web.

## What counts as unread

A reply is unread until the user opens the conversation it belongs to. Opening Feddy isn't enough on its own. Replies in closed conversations count too: closing a conversation doesn't mean the user has read your reply.

> [!TIP]
>
> Send a message from a test build, reply from the inbox, and watch the badge show `1`. Open the conversation in the app and it goes away.

## Next steps

> [card] [Conversations](https://feddy.app/docs/concepts/conversations.md)
>
> What makes a conversation unread in the inbox, and how to mark one unread again.

> [card] [iOS SDK reference](https://feddy.app/docs/reference/ios.md)
>
> `feddyUnreadBadge`, `FeddyUnreadDot`, `FeddyUnread`, and `refresh` in full.

> [card] [Web SDK reference](https://feddy.app/docs/reference/web.md)
>
> `onUnreadCountChanged` and the `launcher` option in full.

> [card] [Troubleshooting](https://feddy.app/docs/troubleshooting.md)
>
> What to check when the badge doesn't update.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.