← All NIPs

NIP-08

Handling Mentions

UnrecommendedEvents

The old way to mention people and notes: replace the mention with #[index] pointing into the tags array. Deprecated in favor of NIP-27 nostr: URIs.

At a glance

Status
Still documented, but new software should not build on it.
Last changed
Nov 16, 2023

Not recommended: deprecated in favor of NIP-27

Use instead: NIP-27

Try it

Edit the form or the JSON: both stay in sync, the badge says whether the result is valid, and tapping any field explains it.

Examples
Valid 1 note

Not signed yet · Demo keys only. These personas' secret keys are public on purpose.

Form
Jan 1, 2025, 12:00 AM UTC

Content

Text with #[0], #[1]… placeholders.

Tags

  1. p Optional

    A mentioned user.

  2. e Optional

    A mentioned event.

Add tag

How this NIP works

Step 1 of 4

Use NIP-27 instead

Write nostr:npub… or nostr:nevent… in the content (NIP-27). Index placeholders break as soon as tags are reordered.

In the course

No course chapter covers this NIP yet. The editor above is the quickest way in.

Replaced by

See also

Specification

Specification text is quoted in English from the nostr-protocol/nips repository. Our explanations and the interface are translated. Source on GitHub at commit 0046368

Read the spec265 words, quoted from the repository at commit 0046368.

This document standardizes the treatment given by clients of inline mentions of other events and pubkeys inside the content of text_notes.

Clients that want to allow tagged mentions they MUST show an autocomplete component or something analogous to that whenever the user starts typing a special key (for example, "@") or presses some button to include a mention etc -- or these clients can come up with other ways to unambiguously differentiate between mentions and normal text.

Once a mention is identified, for example, the pubkey 27866e9d854c78ae625b867eefdfa9580434bc3e675be08d2acb526610d96fbe, the client MUST add that pubkey to the .tags with the tag p, then replace its textual reference (inside .content) with the notation #[index] in which "index" is equal to the 0-based index of the related tag in the tags array.

The same process applies for mentioning event IDs.

A client that receives a text_note event with such #[index] mentions in its .content CAN do a search-and-replace using the actual contents from the .tags array with the actual pubkey or event ID that is mentioned, doing any desired context augmentation (for example, linking to the pubkey or showing a preview of the mentioned event contents) it wants in the process.

Where #[index] has an index that is outside the range of the tags array or points to a tag that is not an e or p tag or a tag otherwise declared to support this notation, the client MUST NOT perform such replacement or augmentation, but instead display it as normal text.