---
title: "Send personal messages only to the · Agent Wranglers"
url: https://agentwranglers.se/playbook/notifications/push-notifications/personal-push-to-devices
updated: 2026-10-21
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Send personal messages only to the person's devices

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Push notifications](https://agentwranglers.se/playbook/notifications/push-notifications.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers). Updated 2026-10-21.

- Level: Required
- Chapter: [Push notifications](https://agentwranglers.se/playbook/notifications/push-notifications)
- Rule: Send a broadcast topic only what anyone may read. Every message about one person goes to that person's own device tokens.
- Risk: Data leaked or lost
- Applies when: The project has user accounts.
- How: In Firebase Cloud Messaging, client apps can subscribe to any existing topic. So anyone who guesses a topic named after a user or an order can read it. Firebase calls topics best suited for publicly available information, such as weather alerts. Mark each catalogue type `public` or `personal`, and let only public types use a topic send. Keep the payload itself small as [Send only what the message needs](https://agentwranglers.se/playbook/email/email-privacy/email-data-minimisation) asks.
- Check: A unit test runs every catalogue type through the send code. No personal type produces a topic or condition target. A grep finds no topic name built from a user, order or account ID.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### JavaScript example

```js
export function fcmTarget(type, recipient) {
  if (type.audience === 'public') return { topic: type.topic };
  if (!recipient?.token) throw new Error(`Personal type ${type.id} needs a device token`);
  return { token: recipient.token };
}
```

### Python example

```python
def fcm_target(kind, recipient=None) -> dict:
    if kind.audience == "public":
        return {"topic": kind.topic}
    if recipient is None or not recipient.token:
        raise ValueError(f"Personal type {kind.id} needs a device token")
    return {"token": recipient.token}
```

## Sources

- [Firebase, Topic messaging](https://firebase.google.com/docs/cloud-messaging/topic-messaging)
- [Firebase, Manage topic subscriptions](https://firebase.google.com/docs/cloud-messaging/manage-topics)

## Related rules

- [Send only what the message needs](https://agentwranglers.se/playbook/email/email-privacy/email-data-minimisation) in Email

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/notifications/push-notifications/personal-push-to-devices">Agent Wranglers notifications playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Accept push endpoints only from known push services](https://agentwranglers.se/playbook/notifications/push-notifications/push-endpoint-allow-list)
- Next: [Send the current subscription to the server on every start](https://agentwranglers.se/playbook/notifications/push-notifications/refresh-push-subscriptions)
- [Push notifications](https://agentwranglers.se/playbook/notifications/push-notifications)
