Skip to content

Commit

Permalink
added reaction content type details
Browse files Browse the repository at this point in the history
  • Loading branch information
daria-github committed Jan 5, 2024
1 parent 6018f0a commit d5af5a8
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions XIPs/xip-reaction-content-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
title: Reactions content type
description: This XIP draft describes a way to add reactions in clients that support XMTP.
author: N/A
discussions-to: https://community.xmtp.org/t/proposal-for-emoji-reactions-content-type/499
status: Draft
type: Standards Track
category: XRC
created: 2024-01-05
---

## Abstract

This XIP introduces the reaction content type for XMTP clients, enabling users to react to messages with emojis. It defines an action field (values: 'added', 'removed') for reaction management, and a schema field (values: 'unicode', 'shortcode-\*', 'custom') for categorizing emoji types. This standardization aims to enhance communication efficiency and engagement across XMTP clients.

## Motivation

The goal of this content type is to bring a dynamic and expressive form of communication to the XMTP ecosystem. Reactions are integral in modern messaging, allowing for rapid, non-verbal responses in conversations. Implementing this standard promises to streamline communication, making it more effective and enjoyable as well as consistent with expectations of current messaging apps.

## Specification

The reaction content type includes:

- reference (string): The ID of the message being reacted to.
- emoji (string): The emoji used in the reaction.
- action (string): Indicates if the reaction is being 'added' or 'removed'.
- schema (string): Categorizes the emoji as ‘unicode’, ‘custom’, ‘shortcode-cldr’, ‘shortcode-cldr-native’, ‘shortcode-discord’, ‘shortcode-emojibase’, ‘shortcode-emojibase-native’, ‘shortcode-emojibase-legacy’, ‘shortcode-github’, ‘shortcode-iamcal’, ‘shortcode-joypixels’, or ‘shortcode-slack’ (shortcode schemas have been pulled from this list: https://emojibase.dev/docs/shortcodes/)

Example code snippet:

// Reacting with a thumbs-up emoji
const reaction: Reaction = {
reference: originalMessage.id,
emoji: "👍",
action: "added",
schema: "unicode"
};

await conversation.send(reaction, {
contentType: ContentTypeReaction
});

## Rationale

The action and schema fields provide necessary flexibility for reaction management. `action` addresses the dynamic nature of conversations, while `schema` ensures cross-client consistency. The choice of emoji as a reaction medium leverages its universal appeal and succinct expression capabilities.

## Backwards Compatibility

To maintain backward compatibility, a contentFallback is stored in the codec as text — ensuring that the intent of reactions is conveyed even in non-supporting clients.

## Test Cases

Test cases will validate the interpretation of schema types, handling of action, and effective use of contentFallback. These are essential for ensuring interoperability across XMTP platforms.

## Reference Implementation

The reference implementation in the XMTP SDKs demonstrates the integration of the reaction content type. The full implementation can be accessed in the React playground here: https://github.com/xmtp/xmtp-react-playground/pull/1/, and we also have a reference implementation in xmtp.chat.

## Security Considerations

Clients SHOULD account for situations when an emoji character is sent that isn’t yet supported by the client or OS. This may happen when an OS update includes new emoji characters, which are then made available to a sender, but may not be supported on the recipient’s client, OS, or device.

## Copyright

Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).

0 comments on commit d5af5a8

Please sign in to comment.