nips/22.md
2024-09-19 12:57:42 -03:00

1.7 KiB

NIP-22

Reactions v2

draft optional

This NIP should be used in place of NIP-25.

A reaction is a way to like/upvote or dislike/downvote an event or any entity external to nostr, such as an URL.

A like is a kind:31143 event. A dislike is a kind:31144 one.

The d tag is the address of the event being reacted to, if applicable, or the event's id or any other identifier from NIP-73's s tag possible values.

The .content field is one of: emoji, custom emoji (e.g.: ":emoji_shortcode_example:") or empty string. If a custom emoji, it must include a NIP-30 emoji tag.

One p tag must be included when reacting to an event, with the reacted to event's pubkey. It should include a relay url hint. Example: ["p", "<author-of-reacted-to-event>", "<relay-url>"].

One k tag must be added with the reacted to event's kind or any of the NIP-73's k tag possible values for external entities.

Example event:

{
  "kind": 31144, // dislike/downvote
  "content": "🤣️",
  "tags": [
    ["d", "isan:0000-0006-3347-0000-o-0000-0000-2"], // reacting to a movie
    ["k", "isan"]
  ]
  // other fields...
}

A Client Implementation Suggestion

A client should show two buttons, a like/upvote and a dislike/downvote. It may show just one if it only cares for e.g. bad reactions.

Both buttons upon clicking should show an emoji picker.

Both buttons' emoji picker may share the same emoji set, because the exact same emoji may be used as a positive or negative reaction depending on the associated context or culture.

Neutral Reactions

If a client wants to offer neutral reactions, it should send both a kind:31143 event and a kind:31144 one with the same d tag.