> ## Documentation Index
> Fetch the complete documentation index at: /llms.txt
> Use this file to discover all available pages before exploring further.

# Reactions

> Query, add, and remove reactions on posts, comments, stories, and messages with the social.plus SDKs.

Reactions let signed-in users attach a named reaction such as `like` to content. The SDKs expose the same core shape on every platform: choose a reference type, pass the content ID, and pass the reaction name.

## Platform Surface

| Platform | Query reactions | Add reaction | Remove reaction |
| - | - | - | - |
| TypeScript | `ReactionRepository.getReactions()` | `ReactionRepository.addReaction()` | `ReactionRepository.removeReaction()` |
| iOS | `AmityReactionRepository.getReactions()` | `AmityReactionRepository.addReaction()` | `AmityReactionRepository.removeReaction()` |
| Android | `AmityCoreClient.newReactionRepository().getReactions()` | `addReaction()` | `removeReaction()` |
| Flutter | `AmitySocialClient.newReactionRepository().getReactions()` | `addReaction()` | `removeReaction()` |

## Parameters

| Parameter | Required | Platforms | Description |
| - | - | - | - |
| `referenceType` | Yes | TypeScript, iOS, Android, Flutter | Content type being reacted to. Supported values are post, comment, story, and message. |
| `referenceId` | Yes | TypeScript, iOS, Android, Flutter | ID of the post, comment, story, or message. |
| `reactionName` | Yes for add/remove, optional for query | TypeScript, iOS, Android, Flutter | Reaction key such as `like`. Query APIs can use it as a filter. |
| `callback` / live collection observer | Query only | TypeScript, iOS, Android, Flutter | Used by live collection APIs to receive reaction updates. |

## Query Reactions

Use `reactionName` when the UI only needs one reaction type. Omit it to read all reaction types for the content.

```typescript TypeScript theme={null}
import { ReactionRepository } from "@amityco/ts-sdk";

const unsubscribe = ReactionRepository.getReactions(
  {
    referenceType: "post",
    referenceId: postId,
    reactionName: "like",
  },
  ({ data }) => {
    renderResults(data);
  }
);
```

```swift iOS theme={null}
let reactionRepository = AmityReactionRepository()
let reactions = reactionRepository.getReactions(
    postId,
    referenceType: .post,
    reactionName: "like"
)

token = reactions.observe { collection, error in
    guard error == nil else { return }
    let currentReactions = collection.snapshots
    showSuccessMessage(currentReactions.count)
}
```

```kotlin Android theme={null}
import com.amity.socialcloud.sdk.model.core.reaction.AmityReactionReferenceType

AmityCoreClient.newReactionRepository()
    .getReactions(
        referenceType = AmityReactionReferenceType.POST,
        referenceId = postId,
        reactionName = "like"
    )
    .subscribe(
        { reactions -> showSuccessMessage(reactions) },
        { error -> handleGeneralError(error) }
    )
```

```dart Flutter theme={null}
final reactions = AmitySocialClient.newReactionRepository()
    .getReactions(AmityPostReactionReference(referenceId: postId))
    .reactionName('like')
    .getLiveCollection();
```

## Add And Remove Reactions

Adding or removing a reaction returns completion or success from the SDK call. Keep UI counts synced from the content model or the reaction live collection.

```typescript TypeScript theme={null}
import { ReactionRepository } from "@amityco/ts-sdk";

await ReactionRepository.addReaction("post", postId, "like");
await ReactionRepository.removeReaction("post", postId, "like");
```

```swift iOS theme={null}
let reactionRepository = AmityReactionRepository()

try await reactionRepository.addReaction(
    "like",
    referenceId: postId,
    referenceType: .post
)

try await reactionRepository.removeReaction(
    "like",
    referenceId: postId,
    referenceType: .post
)
```

```kotlin Android theme={null}
import com.amity.socialcloud.sdk.model.core.reaction.AmityReactionReferenceType

val reactionRepository = AmityCoreClient.newReactionRepository()

reactionRepository.addReaction(
    referenceType = AmityReactionReferenceType.POST,
    referenceId = postId,
    reactionName = "like"
)
    .subscribe(
        { showSuccessMessage("Reaction added") },
        { error -> handleGeneralError(error) }
    )

reactionRepository.removeReaction(
    referenceType = AmityReactionReferenceType.POST,
    referenceId = postId,
    reactionName = "like"
)
    .subscribe(
        { showSuccessMessage("Reaction removed") },
        { error -> handleGeneralError(error) }
    )
```

```dart Flutter theme={null}
final reactionRepository = AmitySocialClient.newReactionRepository();
final reference = AmityPostReactionReference(referenceId: postId);

await reactionRepository.addReaction(reference, 'like');
await reactionRepository.removeReaction(reference, 'like');
```

## Notes

* TypeScript accepts `post`, `comment`, `story`, and `message` as reaction reference types.
* iOS, Android, and Flutter expose equivalent enum or reference classes for post, comment, story, and message.
* Message reactions use the message reaction path in the SDKs. Do not use post or comment reference types for messages.
* Reaction names are application-defined strings. Use the same values when adding, removing, and filtering.

## Related Topics

> **[Comments](/social-plus-sdk/social/content-management/comments/overview.md)**
>
> React to comments and keep comment threads interactive

> **[Stories](/social-plus-sdk/social/content-management/stories/overview.md)**
>
> Use the same reaction concept with story content

> **[Messages](/social-plus-sdk/chat/messaging-features/messages/get-and-view-a-message.md)**
>
> Add and remove reactions on chat messages


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.