12NIP-253======45Reactions6---------78`draft` `optional`910A reaction is a `kind 7` event that is used to indicate user reactions to other events. A11reaction's `content` field MUST include user-generated-content indicating the value of the12reaction (conventionally `+`, `-`, or an emoji).1314A reaction with `content` set to `+` or an empty string MUST be interpreted as a "like" or "upvote".15A reaction with `content` set to `-` MUST be interpreted as a "dislike" or "downvote".1617A reaction with `content` set to an emoji or [NIP-30](30.md) custom emoji SHOULD NOT be interpreted18as a "like" or "dislike". Clients MAY instead display this emoji reaction on the post.1920Tags21----2223There MUST be always an `e` tag set to the `id` of the event that is being reacted to. The `e` tag SHOULD include a relay hint pointing to a relay where the event being reacted to can be found. If a client decides to include other `e`, which not recommended, the target event `id` should be last of the `e` tags.2425There SHOULD be a `p` tag set to the `pubkey` of the event being reacted to. If a client decides to include other `p` tags, which not recommended, the target event `pubkey` should be last the `p` tags.2627If the event being reacted to is an addressable event, an `a` SHOULD be included together with the `e` tag, it must be set to the coordinates (`kind:pubkey:d-tag`) of the event being reacted to.2829The `e` and `a` tags SHOULD include relay and pubkey hints. The `p` tags SHOULD include relay hints.3031The reaction event MAY include a `k` tag with the stringified kind number of the reacted event as its value.3233**Example code**3435```swift36func make_like_event(pubkey: String, privkey: String, liked: NostrEvent, hint: String) -> NostrEvent {37 var tags: [[String]] = []38 tags.append(["e", liked.id, hint, liked.pubkey])39 tags.append(["p", liked.pubkey, hint])40 tags.append(["k", String(liked.kind)])41 let ev = NostrEvent(content: "+", pubkey: pubkey, kind: 7, tags: tags)42 ev.calculate_id()43 ev.sign(privkey: privkey)44 return ev45}46```4748External Content Reactions49---------------------5051If the target of a reaction is not a native nostr event, the reaction MUST be a `kind 17` event and MUST include [NIP-73](73.md) external content `k` + `i` tags to properly reference the content.5253_Reacting to a website:_54```yaml55{56 "kind": 17,57 "content": "⭐",58 "tags": [59 ["k", "web"],60 ["i", "https://example.com"]61 ],62}63```6465_Reacting to a podcast episode:_66```yaml67{68 "kind": 17,69 "content": "+",70 "tags": [71 ["k", "podcast:guid"],72 ["i", "podcast:guid:917393e3-1b1e-5cef-ace4-edaa54e1f810", "https://fountain.fm/show/QRT0l2EfrKXNGDlRrmjL"],73 ["k", "podcast:item:guid"],74 ["i", "podcast:item:guid:PC20-229", "https://fountain.fm/episode/DQqBg5sD3qFGMCZoSuLF"]75 ],76}77```7879808182Custom Emoji Reaction83---------------------8485The client may specify a custom emoji ([NIP-30](30.md)) `:shortcode:` in the86reaction content. The client should refer to the emoji tag and render the87content as an emoji if shortcode is specified.8889```yaml90{91 "kind": 7,92 "content": ":soapbox:",93 "tags": [94 ["emoji", "soapbox", "https://gleasonator.com/emoji/Gleasonator/soapbox.png"]95 ],96 // other fields...97}98```99100The content can be set only one `:shortcode:`. And emoji tag should be one.