### Quick Start: Get Channel and Mark as Read
Source: https://github.com/amityco/social-plus-docs/blob/main/use-cases/chat/unread-counts-and-read-receipts.mdx
Quick start example showing how to fetch a channel, log its unread count and mention status, and mark it as read. Includes error handling for failed channel status reads.
```typescript
import { ChannelRepository } from '@amityco/ts-sdk';
try {
const channel = await ChannelRepository.getChannel(channelId);
console.log(`${channel.unreadCount} unread, mentioned: ${channel.isMentioned}`);
// After the user opens the channel view
await channel.markAsRead();
} catch (error) {
console.error('Failed to read channel status:', error);
}
```
--------------------------------
### Enable presence and subscribe to real-time events
Source: https://github.com/amityco/social-plus-docs/blob/main/llms-full.txt
TypeScript example showing how to enable presence, start a heartbeat, observe online channel members, and subscribe to real-time topic events. Requires SDK installed and authenticated, and presence features enabled in the Admin Console.
```typescript
// 1. Enable presence for the current user
await PresenceManager.enable();
// 2. Start heartbeat to stay online
PresenceManager.startHeartbeat({ intervalMs: 10000 });
// 3. Observe a channel's online members
ChannelRepository.Membership.getMembers(
{ channelId: 'ch-123', filter: 'online' },
({ data }) => { renderOnlineUsers(data); }
);
// 4. Subscribe to real-time topic events
```
--------------------------------
### Install pre-commit and configure pre-push hook
Source: https://github.com/amityco/social-plus-docs/blob/main/README.md
One-time setup for contributors after cloning the repository. Installs the pre-commit tool and configures the pre-push hook that runs the full check suite on every git push.
```bash
pip install pre-commit
pre-commit install --hook-type pre-push
```
--------------------------------
### Setup SDK with Encryption in Application Class
Source: https://github.com/amityco/social-plus-docs/blob/main/social-plus-sdk/getting-started/platform-setup/mobile/android-quick-start.mdx
Example Application class that retrieves the encryption key and sets up the SDK with AUTH encryption mode. Uses AmityEndpoint.SG as the endpoint.
```kotlin
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
// Get or generate encryption key
val encryptionKey = getEncryptionKey(this)
// Setup SDK with encryption
AmityCoreClient.setup(
apiKey = "your-api-key",
endpoint = AmityEndpoint.SG,
dbEncryption = AmityDBEncryption.AUTH(encryptionKey.toByteArray())
)
}
}
```
--------------------------------
### Create and Join a Channel
Source: https://github.com/amityco/social-plus-docs/blob/main/use-cases/chat/channels-and-conversations.mdx
Quick start example that creates a public community channel and joins it, with error handling.
```typescript
import { ChannelRepository } from '@amityco/ts-sdk';
try {
// Create a public Community channel
const { data: channel } = await ChannelRepository.createChannel({
type: 'community',
displayName: 'General',
isPublic: true,
});
// Join it
await ChannelRepository.joinChannel(channel.channelId);
} catch (error) {
console.error('Channel operation failed:', error);
}
```
--------------------------------
### setup-validator SKILL.md content
Source: https://github.com/amityco/social-plus-docs/blob/main/docs/superpowers/plans/2026-04-29-diagnostic-skills.md
Markdown skill file for validating social.plus setup. It guides the assistant to ask about SDK vs UIKit, platform, and initialization code, then fetch canonical setup pages and compare. Includes checklists for SDK and UIKit paths, and common mistakes to check.
```markdown
---
name: setup-validator
description: Use when a developer asks "is my setup correct?", "why isn't the SDK initializing?", or is setting up social.plus for the first time on any platform.
license: MIT
metadata:
author: social.plus
version: "1.0"
display-name: social.plus Setup Validator
---
# social.plus Setup Validator
## When to Use
Reach for this skill when a developer:
- Says "I just added the SDK" or "is my setup right?"
- Reports the SDK not initializing or failing on first call
- Asks about installation or configuration for the first time
- Gets a blank or auth-failure response from the very first API call
## How to Run This Workflow
1. Ask: are you using the **SDK directly** (Chat, Social, Video — building your own UI) or **UIKit** (pre-built components)?
2. Ask: which platform (iOS, Android, Web, Flutter, React Native)?
3. Ask the developer to share their initialization code snippet
4. Fetch the canonical setup page for their product + platform using `get_page_social_plus` (URLs below)
5. Compare their code against the canonical pattern from the fetched page
6. Flag any deviations using the checklists below
7. If `validate_api_key` MCP tool is available, call it with the developer's API key to confirm it is active and check which products it grants access to
---
## SDK Path (Chat / Social / Video — custom UI)
Fetch the canonical initialization code for the developer's platform:
| Platform | URL for `get_page_social_plus` |
|----------|-------------------------------|
| iOS | `https://learn.social.plus/social-plus-sdk/getting-started/platform-setup/mobile/ios-quick-start` |
| Android | `https://learn.social.plus/social-plus-sdk/getting-started/platform-setup/mobile/android-quick-start` |
| Flutter | `https://learn.social.plus/social-plus-sdk/getting-started/platform-setup/mobile/flutter-quick-start` |
| Web / TypeScript | `https://learn.social.plus/social-plus-sdk/getting-started/platform-setup/web/web-quick-start` |
| Auth (all platforms) | `https://learn.social.plus/social-plus-sdk/getting-started/authentication` |
**Shared checklist:**
- API key and App ID are both present and sourced from the social.plus console (not placeholder values)
- Region/endpoint is set explicitly — US, EU, or SG. Default is US; wrong region = silent auth failure
- `setup()` is called before any other SDK method
- `register()` / auth is called after user login, not at app start
**Common mistakes not documented — check these explicitly:**
- `setup()` called inside a component that can remount → duplicate init + session conflict
- `register()` not awaited before subscribing to live collections → race condition
- API key used in the App ID field or vice versa (they are two separate values)
- Android: `setup()` in `Activity.onCreate()` instead of `Application.onCreate()` → re-inits on every screen rotation
---
## UIKit Path (pre-built components)
Fetch the canonical setup pages:
| Page | URL for `get_page_social_plus` |
|------|-------------------------------|
| Installation | `https://learn.social.plus/uikit/getting-started/installation` |
| Authentication | `https://learn.social.plus/uikit/getting-started/authentication` |
| Quick Start | `https://learn.social.plus/uikit/getting-started/quick-start` |
**Critical check first:** Does the developer's code call both `AmityUIKitManager.setup()` AND `AmityClient.setup()`? UIKit manages the SDK internally — calling both causes a conflict. Flag this immediately if present.
**Shared checklist:**
- Only `AmityUIKitManager` is used — no direct `AmityClient.setup()` call
- API key and region/endpoint passed to `AmityUIKitManager.setup()`
- `registerDevice()` called after user login, not at app start (device binds permanently to userId until explicitly unregistered)
- `unregisterDevice()` called on logout — skipping this leaves the old user session on the device
**Common mistakes not documented — check these explicitly:**
- Double init: `AmityClient.setup()` called alongside `AmityUIKitManager.setup()` → conflict
- User switching without `unregisterDevice()` first → new user inherits old user's notifications
- `setup()` placed inside a component render cycle → reinitializes on every render
- Flutter: missing `WidgetsFlutterBinding.ensureInitialized()` before `setup()`
```
--------------------------------
### Install dependencies for visitor auth signature
Source: https://github.com/amityco/social-plus-docs/blob/main/social-plus-sdk/getting-started/visitor-mode.mdx
Installs the required dependencies for the Express.js backend example: express and dotenv.
```bash
npm install express dotenv
```
--------------------------------
### Setup Amity SDK with encryption in Application class
Source: https://github.com/amityco/social-plus-docs/blob/main/llms-full.txt
Example of setting up the Amity SDK with database encryption in your Application class. It retrieves the encryption key and passes it to AmityCoreClient.setup with AUTH mode.
```kotlin
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
// Get or generate encryption key
val encryptionKey = getEncryptionKey(this)
// Setup SDK with encryption
AmityCoreClient.setup(
apiKey = "your-api-key",
endpoint = AmityEndpoint.SG,
dbEncryption = AmityDBEncryption.AUTH(encryptionKey.toByteArray())
)
}
}
```
--------------------------------
### Install dependencies with flutter pub get
Source: https://github.com/amityco/social-plus-docs/blob/main/social-plus-sdk/getting-started/platform-setup/mobile/flutter-quick-start.mdx
Run this command after adding the SDK to pubspec.yaml to install dependencies. Rerun it after changing native project configuration and rebuild the app so generated platform projects pick up updated settings.
```bash
flutter pub get
```
--------------------------------
### Initialize SDK, Register User, and Launch UIKit (Kotlin)
Source: https://github.com/amityco/social-plus-docs/blob/main/uikit/getting-started/authentication.mdx
Steps to initialize the SDK, register a user, and launch UIKit activities in an Android app. The setup uses AmityCoreClient.setup with an API key and region, then AmityCoreClient.login to authenticate, and finally AmityUIKit.openSocialHome or openChatHome to start features.
```kotlin
import com.amity.socialcloud.sdk.AmityCoreClient
import com.amity.socialcloud.uikit.AmityUIKit
// In Application class or MainActivity
AmityCoreClient.setup(
apiKey = "YOUR_API_KEY",
region = AmityRegionalEndpoint.US // or EU, SG
)
```
```kotlin
AmityCoreClient.login("unique_user_id")
.displayName("User Display Name")
.build()
.submit()
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ user ->
// User registered successfully
Log.d("Auth", "User registered: ${user.displayName}")
}, { error ->
// Handle registration error
Log.e("Auth", "Registration failed", error)
})
```
```kotlin
import com.amity.socialcloud.uikit.AmityUIKit
// Launch social features
AmityUIKit.openSocialHome(this)
// Or launch specific features
AmityUIKit.openChatHome(this)
```
--------------------------------
### Setup React Native sample app
Source: https://github.com/amityco/social-plus-docs/blob/main/uikit/getting-started/installation.mdx
Sets up the built-in sample app in the React Native UIKit repository.
```bash
cd example
yarn install
```
--------------------------------
### Start the Current User Heartbeat
Source: https://github.com/amityco/social-plus-docs/blob/main/llms-full.txt
Code examples for starting the current user heartbeat on iOS and Android.
```APIDOC
## [iOS] Start the Current User Heartbeat
### Description
Starts the current user's network presence heartbeat so the user appears online in user and channel presence. The heartbeat must be enabled before starting, and can be stopped when the user should no longer appear online.
### Method
`client.presence.startHeartbeat()`
### Parameters
None
### Request Example
```swift
let isEnabled = try await client.presence.isEnabled()
if !isEnabled {
try await client.presence.enable()
}
try await client.presence.startHeartbeat()
// Call when the user should no longer appear online.
client.presence.stopHeartbeat()
```
### Response
No response body is documented.
```
```APIDOC
## [Android] Start the Current User Heartbeat
### Description
Starts the current user's network presence heartbeat so the user appears online in user and channel presence. The heartbeat must be enabled before starting, and can be stopped when the user should no longer appear online.
### Method
`AmityCoreClient.presence().startHeartbeat()`
### Parameters
None
### Request Example
```kotlin
AmityCoreClient.presence().isEnabled()
.flatMapCompletable { isEnabled ->
val enableIfNeeded = if (isEnabled) {
Completable.complete()
} else {
AmityCoreClient.presence().enable()
}
enableIfNeeded.andThen(AmityCoreClient.presence().startHeartbeat())
}
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
showSuccessMessage("Presence heartbeat started")
}, { error ->
showErrorMessage(error = error)
})
// Call when the user should no longer appear online.
AmityCoreClient.presence().stopHeartbeat()
```
### Response
No response body is documented.
```
--------------------------------
### Quick Start Example (iOS, Android, React, React Native)
Source: https://github.com/amityco/social-plus-docs/blob/main/uikit/components/chat/overview.mdx
Shows how to initialize and render the chat UI in four platforms. For iOS, wrap AmityChatPage in a hosting controller. For Android, launch AmityChatPageActivity with an Intent. For React, use AmityUiKitProvider with AmityUiKitChatV4. For React Native, use AmityUiKitProvider with AmityUiKitChat, requiring v4.3.0 or later.
```swift
import AmityUIKit4
// AmityChatPage is a SwiftUI view. Wrap it to present it from a UIKit stack.
let chatPage = AmityChatPage(channelId: "your_channel_id")
let hostingController = AmitySwiftUIHostingController(rootView: chatPage)
navigationController?.pushViewController(hostingController, animated: true)
```
```kotlin
import com.amity.socialcloud.uikit.chat.compose.conversation.AmityChatPageActivity
// The chat page is an Activity. Launch it with its Intent factory.
startActivity(
AmityChatPageActivity.newIntent(context, channelId = "your_channel_id")
)
```
```tsx
import { AmityUiKitProvider, AmityUiKitChatV4 } from '@amityco/ui-kit';
import config from './uikit.config.json';
function MyChatApp() {
return (
);
}
```
```jsx
import { AmityUiKitProvider, AmityUiKitChat } from '@amityco/react-native-social-uikit';
// Requires @amityco/react-native-social-uikit v4.3.0 or later.
function MyChatApp() {
return (
);
}
```
--------------------------------
### Create Room and Go Live (Quick Start)
Source: https://github.com/amityco/social-plus-docs/blob/main/use-cases/social/livestream/go-live-and-room-management.mdx
Creates a room with a live chat channel enabled. The room status is initially IDLE.
```typescript
const room = await RoomRepository.createRoom({
title: 'Product Launch Event',
description: 'Join us for the unveiling',
channelEnabled: true, // auto-creates a live chat channel
});
console.log('Room created:', room.roomId, '— status:', room.status); // IDLE
```
--------------------------------
### Get Followers
Source: https://github.com/amityco/social-plus-docs/blob/main/llms-full.txt
Documentation for the Get Followers operation, including parameters and code examples for iOS, Android, TypeScript, and Flutter.
```APIDOC
## Get Followers
### Description
Query followers when your UI needs a paginated people list for a user. The iOS and Android snippets use the current-user builders because those SDKs expose status filters there.
### Method
SDK method call
### Parameters
- `userId` / `targetUserId` (string) - Platform-dependent - Target user whose followers should be queried. iOS and Android status-filter snippets use current-user builders.
- `status` / status filter (enum) - Optional - Relationship status filter such as accepted, pending, or all where exposed.
- `limit` / page size (number) - Optional - Page size for paginated follower or following lists.
### Code Examples
#### iOS (Swift)
```swift
let relationship = AmityUserRelationship()
let followers = relationship.getMyFollowers(with: .accepted)
_ = followers.observe { collection, error in
if let error {
handleError(error)
return
}
let relationships = collection.snapshots
_ = relationships.first?.sourceUser
}
followers.nextPage()
```
#### Android (Kotlin)
```kotlin
val disposable = AmityCoreClient.newUserRepository()
.relationship()
.getMyFollowers()
.status(AmityFollowStatusFilter.ACCEPTED)
.build()
.query()
.subscribe(
{ pagingData: PagingData ->
showSuccessMessage(pagingData)
},
{ error ->
handleGeneralError(error)
},
)
```
#### TypeScript
```typescript
import { UserRepository } from '@amityco/ts-sdk';
let loadMoreFollowers: (() => void) | undefined;
const unsubscribe = UserRepository.Relationship.getFollowers(
{ userId, status: 'accepted' },
({ data: followers, onNextPage, hasNextPage, loading, error }) => {
if (error) {
handleError(error);
return;
}
if (!loading && followers) {
renderResults(followers);
}
loadMoreFollowers = hasNextPage ? onNextPage : undefined;
},
);
```
#### Flutter (Dart)
```dart
final page = await AmityCoreClient.newUserRepository()
.relationship()
.getFollowers(targetUserId)
.status(AmityFollowStatusFilter.ACCEPTED)
.getPagingData(limit: 20);
final relationships = page.data;
```
```
--------------------------------
### Get Broadcaster Credentials and Connect to LiveKit (Step 3)
Source: https://github.com/amityco/social-plus-docs/blob/main/use-cases/social/livestream/go-live-and-room-management.mdx
Fetches the LiveKit URL and token, then connects the host's camera and microphone. The room status becomes LIVE after connection.
```typescript
import { Room as LiveKitRoom, RoomEvent } from 'livekit-client';
const broadcastData = await RoomRepository.getBroadcasterData(room.roomId);
const liveKitRoom = new LiveKitRoom();
liveKitRoom.on(RoomEvent.Connected, () => console.log('Connected!'));
liveKitRoom.on(RoomEvent.Disconnected, (reason) => console.log('Disconnected:', reason));
await liveKitRoom.connect(broadcastData.coHostUrl, broadcastData.coHostToken);
await liveKitRoom.localParticipant.setCameraEnabled(true);
await liveKitRoom.localParticipant.setMicrophoneEnabled(true);
// Room status is now LIVE
```
--------------------------------
### Generate shareable links and handle deep links
Source: https://github.com/amityco/social-plus-docs/blob/main/use-cases/social/content-sharing-and-deep-links.mdx
Quick-start example showing how to get the shareable link configuration, generate a share URL for a post, and handle an incoming deep link. Requires the SDK to be installed and authenticated, and shareable links configured in the Admin Console. The deep link routing is app-layer responsibility and not part of the TS SDK.
```typescript
import { AmitySharableContentType, Client } from '@amityco/ts-sdk';
// 1. Get share link configuration
const config = await Client.getShareableLinkConfiguration();
// 2. Generate a share URL for a post (null if the post pattern is not configured)
const shareUrl = config.generateLink(AmitySharableContentType.POST, postId);
// 3. Handle incoming deep link
// (deep link routing is app-layer responsibility — not part of the TS SDK)
handleDeepLink(incomingUrl, (resolved) => {
if (resolved.type === 'post') navigateToPost(resolved.postId);
if (resolved.type === 'community') navigateToCommunity(resolved.communityId);
});
```
--------------------------------
### Android: AmityLivestreamInviteCoHostPageActivity
Source: https://github.com/amityco/social-plus-docs/blob/main/llms-full.txt
Android code example for starting the co-host invitation page as an Activity.
```APIDOC
## [Android] AmityLivestreamInviteCoHostPageActivity
### Description
Starts the co-host invitation page as an Activity.
### Method
Static method
### Endpoint
AmityLivestreamInviteCoHostPageActivity.newIntent(context:roomId:)
### Parameters
#### Required Properties
- **context** (Context) - Required - The context to start the activity
- **roomId** (String) - Required - The ID of the livestream room
### Request Example
```kotlin
fun startInviteCoHostActivity(context: Context, roomId: String) {
val intent = AmityLivestreamInviteCoHostPageActivity.newIntent(
context = context,
roomId = roomId
)
context.startActivity(intent)
}
```
### Response
#### Success Response
Starts the activity and returns an Intent.
```
--------------------------------
### Initialize Amity SDK with AmityCoreClient.setup
Source: https://github.com/amityco/social-plus-docs/blob/main/llms-full.txt
Initializes the Amity SDK and UIKit in the Application class or main activity. Requires a valid API key and region (US, EU, or SG).
```kotlin
import com.amity.socialcloud.sdk.AmityCoreClient
import com.amity.socialcloud.uikit.AmityUIKit
// In Application class or MainActivity
AmityCoreClient.setup(
apiKey = "YOUR_API_KEY",
region = AmityRegionalEndpoint.US // or EU, SG
)
```
--------------------------------
### Get Member Invitations
Source: https://github.com/amityco/social-plus-docs/blob/main/llms-full.txt
Code examples for the getMemberInvitations method in Swift, Kotlin, and TypeScript.
```APIDOC
## getMemberInvitations
### Description
Retrieves the list of invitations sent for a community. Moderators can observe these invitations.
### Method
SDK method
### Endpoint
`community.getMemberInvitations()`
### Parameters
- **community** (AmityCommunity) - Required - The community object for which to fetch member invitations.
### Request Example
```swift
var community: AmityCommunity! // Fetched community
let liveCollection = community.getMemberInvitations()
```
### Response
#### Success Response
- **collection** (LiveCollection) - A live collection of invitations.
- **error** (Error) - An error object if the request fails.
#### Response Example
```swift
token = liveCollection.observe { collection, error in
if let error = error {
handleError(error)
return
}
let invitations = collection.snapshots
// Render community invitations
}
```
```
```APIDOC
## getMemberInvitations
### Description
Retrieves the list of invitations sent for a community. Moderators can observe these invitations.
### Method
SDK method
### Endpoint
`community.getMemberInvitations()`
### Parameters
- **community** (AmityCommunity) - Required - The community object for which to fetch member invitations.
### Request Example
```kotlin
fun getMemberInvitations(community: AmityCommunity) {
community.getMemberInvitations()
.doOnNext { invitations: PagingData ->
// Render community invitations
}
.subscribe()
}
```
### Response
#### Success Response
- **invitations** (PagingData) - A paged list of invitations.
#### Response Example
```kotlin
community.getMemberInvitations()
.doOnNext { invitations: PagingData ->
// Render community invitations
}
.subscribe()
```
```
```APIDOC
## getMemberInvitations
### Description
Retrieves the list of invitations sent for a community. Moderators can observe these invitations.
### Method
SDK method
### Endpoint
`community.getMemberInvitations()`
### Parameters
- **community** (Amity.Community) - Required - The community object for which to fetch member invitations.
- **options** (object) - Optional - An object containing query parameters.
- **statuses** (InvitationStatusEnum[]) - Optional - Filter by invitation statuses.
- **limit** (number) - Optional - Maximum number of invitations to return.
### Request Example
```typescript
import { InvitationStatusEnum } from '@amityco/ts-sdk';
function getMemberInvitations(community: Amity.Community) {
return community.getMemberInvitations(
{
statuses: [InvitationStatusEnum.Pending],
limit: 20,
},
({ data: invitations, loading, error }) => {
if (error) {
// Handle error
return;
}
if (!loading && invitations) {
// Render community invitations
}
},
);
}
```
### Response
#### Success Response
- **data** (AmityInvitation[]) - The list of invitations.
- **loading** (boolean) - Indicates if the request is in progress.
- **error** (Error) - An error object if the request fails.
#### Response Example
```typescript
community.getMemberInvitations(
{
statuses: [InvitationStatusEnum.Pending],
limit: 20,
},
({ data: invitations, loading, error }) => {
if (error) {
// Handle error
return;
}
if (!loading && invitations) {
// Render community invitations
}
},
);
```
```
--------------------------------
### Initialize AmityUIKitManager in Swift
Source: https://github.com/amityco/social-plus-docs/blob/main/uikit/getting-started/installation.mdx
Sets up the UIKit with your API key and endpoint, registers a user, and presents the social home. Replace YOUR_API_KEY and user details with your own.
```swift
// In your AppDelegate or SceneDelegate
import AmityUIKit
AmityUIKitManager.setup(
apiKey: "YOUR_API_KEY",
endpoint: .US // .US, .EU, or .SG
)
// Register user and present social home
AmityUIKitManager.registerDevice(
withUserId: "user123",
displayName: "John Doe"
) { success, error in
if success {
AmityUIKitManager.presentSocialHome()
}
}
```
--------------------------------
### Setup AmityUIKitProvider in React
Source: https://github.com/amityco/social-plus-docs/blob/main/uikit/getting-started/installation.mdx
Import the AmityUIKitProvider component and its CSS to start using the UIKit in your React app.
```typescript
import React from 'react';
import { AmityUIKitProvider } from '@amityco/ui-kit-react';
import '@amityco/ui-kit-react/dist/index.css';
```
--------------------------------
### Visitor login, upgrade, and profile update (TypeScript)
Source: https://github.com/amityco/social-plus-docs/blob/main/use-cases/social/user-onboarding-and-visitor-mode.mdx
Core onboarding steps: login as visitor, upgrade to authenticated user, and update user profile. Requires SDK installed and API key. Production apps need a backend server for auth tokens.
```typescript
// 1. Visitor login (anonymous, read-only)
await Client.loginAsVisitor();
// 2. Upgrade to authenticated user
await Client.login({ userId: 'user-123', displayName: 'Jane' });
// 3. Update the user profile
await UserRepository.updateUser('user-123', {
displayName: 'Jane Doe',
description: 'Hello world!',
avatarFileId: 'uploaded-avatar-id',
});
```
--------------------------------
### Run React Native sample app
Source: https://github.com/amityco/social-plus-docs/blob/main/uikit/getting-started/installation.mdx
Installs dependencies and runs the sample app on iOS or Android.
```bash
# From root directory
yarn install
# Run iOS
yarn example ios
# Run Android
yarn example android
```
--------------------------------
### Initialize SDK with AmityCoreClient.setup
Source: https://github.com/amityco/social-plus-docs/blob/main/social-plus-sdk/getting-started/platform-setup/mobile/android-quick-start.mdx
Initializes the Amity Social Cloud SDK client with your API key. Recommended to call on the application class. This does not authenticate a user; see the Authentication section for the next step.
```kotlin
AmityCoreClient.setup(apiKey = "YOUR_API_KEY")
```
--------------------------------
### Display Past Events Page (iOS, Android, React)
Source: https://github.com/amityco/social-plus-docs/blob/main/uikit/components/social/event.mdx
Shows how to display the past events page on iOS, Android, and React. The iOS example uses AmityPastEventsPage() and pushes it via AmitySwiftUIHostingController. The Android example uses AmityPastEventsPageActivity.newIntent(context) to start the activity. The React example wraps AmityPastEventsPage in AmityUiKitProvider.
```swift
// Show past events page
let pastEventsPage = AmityPastEventsPage()
let viewController = AmitySwiftUIHostingController(rootView: pastEventsPage)
navigationController?.pushViewController(viewController, animated: true)
```
```kotlin
// Using Activity - All events
fun startPastEventsActivityAllEvents(context: Context) {
val intent = AmityPastEventsPageActivity.newIntent(context)
context.startActivity(intent)
}
// Using Activity - My events only
fun startPastEventsActivityMyEvents(context: Context) {
val intent = AmityPastEventsPageActivity.newIntent(context)
context.startActivity(intent)
}
```
```typescript
import { AmityUiKitProvider, AmityPastEventsPage } from '@amityco/ui-kit';
const SampleAmityPastEventsPageActivityPage = () => {
return (
);
};
```
--------------------------------
### Get a single story by storyId (TypeScript, iOS, Android, Flutter)
Source: https://github.com/amityco/social-plus-docs/blob/main/social-plus-sdk/social/content-management/stories/retrieval/get-stories.mdx
Retrieve a single story by its storyId as a live object or stream. The TypeScript example uses StoryRepository.getStoryByStoryId and returns an unsubscribe function; the iOS example uses storyRepository.getStory(storyId:) and observes the result; the Android example uses AmityStoryRepository.getStory and subscribes with RxJava; the Flutter example uses AmitySocialClient.newStoryRepository().live.getStory and listens to the stream.
```typescript
import { StoryRepository } from '@amityco/ts-sdk';
const unsubscribe = StoryRepository.getStoryByStoryId(storyId, ({ data, loading, error }) => {
if (error) {
handleError(error);
return;
}
if (!loading && data) {
updateUI(data);
}
});
unsubscribe();
```
```swift
token = storyRepository.getStory(storyId: "story-id").observe { object, error in
if let error {
handleError(error)
return
}
if let story = object.snapshot {
showSuccessMessage(story.storyId)
}
}
```
```kotlin
fun observeStory(
storyRepository: AmityStoryRepository,
storyId: String
) {
storyRepository.getStory(storyId = storyId)
.doOnNext { story: AmityStory ->
showSuccessMessage(story.getStoryId())
}
.doOnError { error -> showErrorMessage(error = error) }
.subscribe()
}
```
```dart
void observeStory(String storyId) {
final stream = AmitySocialClient.newStoryRepository().live.getStory(storyId);
stream.listen((story) {
final currentStoryId = story.storyId;
showError(currentStoryId ?? '');
});
}
```
--------------------------------
### Set Up User Profile
Source: https://github.com/amityco/social-plus-docs/blob/main/use-cases/social/user-onboarding-and-visitor-mode.mdx
Set up the user profile after first login. The SDK auto-creates the user record on first login; this step updates it.
```typescript
import { UserRepository } from '@amityco/ts-sdk';
const { data: updatedUser } = await UserRepository.updateUser('userId', {
displayName: 'Jane Smith',
description: 'Loves hiking and photography',
});
```
--------------------------------
### Get Blocked Users (paginated) - Swift, Kotlin, TypeScript, Flutter
Source: https://github.com/amityco/social-plus-docs/blob/main/social-plus-sdk/social/user-relationship/blocking/manage-blocked-users.mdx
Paginated retrieval of the current user's blocked-user list. The Swift example observes a live collection and calls nextPage() to load more. The Kotlin example subscribes to PagingData. The TypeScript example passes a limit of 25 and uses onNextPage when hasNextPage is true. The Flutter example uses getPagingData(limit: 20).
```swift
let repository = AmityUserRepository()
let blockedUsers = repository.getBlockedUsers()
_ = blockedUsers.observe { collection, error in
if let error {
handleError(error)
return
}
let users = collection.snapshots
_ = users.first?.userId
}
blockedUsers.nextPage()
```
```kotlin
val disposable = AmityCoreClient.newUserRepository()
.getBlockedUsers()
.subscribe(
{ pagingData: PagingData ->
showSuccessMessage(pagingData)
},
{ error ->
handleGeneralError(error)
},
)
```
```typescript
import { UserRepository } from '@amityco/ts-sdk';
let loadMoreBlockedUsers: (() => void) | undefined;
const unsubscribe = UserRepository.getBlockedUsers(
{ limit: 25 },
({ data: users, onNextPage, hasNextPage, loading, error }) => {
if (error) {
handleError(error);
return;
}
if (!loading && users) {
renderResults(users);
}
loadMoreBlockedUsers = hasNextPage ? onNextPage : undefined;
},
);
```
```dart
final page = await AmityCoreClient.newUserRepository()
.getBlockedUsers()
.getPagingData(limit: 20);
final blockedUsers = page.data;
```
--------------------------------
### Start Vise MCP server
Source: https://github.com/amityco/social-plus-docs/blob/main/ai/vise/mcp-server.mdx
Starts the local stdio MCP server for Vise. Normally you don't run it by hand; you register the command in your host's MCP configuration and the host launches it for you.
```sh
vise mcp
```
--------------------------------
### Query My RSVP Events (TypeScript, iOS, Android)
Source: https://github.com/amityco/social-plus-docs/blob/main/social-plus-sdk/social/events/manage-events.mdx
Query events where the current user is an attendee (RSVP status 'Going'). The TypeScript example uses EventRepository.getMyEvents with AmityEventResponseStatus.Going; the iOS and Android examples use query options with onlyAttendee(true) and sorting by start time. Each example includes error handling and a success callback.
```typescript
import { AmityEventResponseStatus, EventRepository } from '@amityco/ts-sdk';
const unsubscribe = EventRepository.getMyEvents(
{ status: AmityEventResponseStatus.Going },
({ data: events, loading, error }) => {
if (loading) return;
if (error) {
handleError(error);
return;
}
renderResults(events);
},
);
unsubscribe();
```
```swift
let options = AmityEventQueryOptions(
userId: "user-123",
onlyAttendee: true,
sortBy: .startTime,
orderBy: .ascending
)
token = AmityEventRepository().getEvents(options: options).observe { collection, error in
if let error {
handleError(error)
return
}
showSuccessMessage(collection.snapshots.count)
}
```
```kotlin
AmitySocialClient.newEventRepository()
.getEvents()
.userId(userId)
.onlyAttendee(true)
.sortBy(AmityEventSortOption.START_TIME)
.orderBy(AmityEventOrderOption.ASCENDING)
.build()
.query()
.subscribe(
{ pagingData: PagingData -> showSuccessMessage(pagingData) },
{ error -> handleGeneralError(error) }
)
```
--------------------------------
### Get a Single User
Source: https://github.com/amityco/social-plus-docs/blob/main/social-plus-sdk/core-concepts/user-management/user-operations/get-user-information.mdx
Code examples for retrieving a single user profile across TypeScript, iOS, Android, and Flutter SDKs.
```APIDOC
## UserRepository.getUser(userId, callback)
### Description
Retrieves a single user profile by user ID. Starts a live observer and returns an unsubscriber.
### Method
TypeScript SDK method
### Endpoint
`UserRepository.getUser(userId, callback)`
### Parameters
- **userId** (string) - Required - The ID of the user to retrieve.
- **callback** (function) - Required - Callback function receiving `{ data, loading, error }`.
### Request Example
```typescript
import { UserRepository } from '@amityco/ts-sdk';
const unsubscribe = UserRepository.getUser('user_123', ({ data: user, loading, error }) => {
if (loading) return;
if (error || !user) {
console.error('Failed to get user', error);
return;
}
console.log(user.userId, user.displayName);
});
```
### Response
#### Success Response
- **data** (AmityUser) - The user object.
- **loading** (boolean) - Indicates if the request is in progress.
- **error** (Error) - Error object if the request failed.
#### Response Example
```typescript
// Callback receives:
{ data: { userId: 'user_123', displayName: 'John Doe' }, loading: false, error: null }
```
```
```APIDOC
## userRepository.getUser(userId) (iOS)
### Description
Retrieves a single user profile by user ID. Returns a live object observed with an `AmityNotificationToken`.
### Method
iOS SDK method
### Endpoint
`userRepository.getUser(userId)`
### Parameters
- **userId** (string) - Required - The ID of the user to retrieve.
### Request Example
```swift
var token: AmityNotificationToken?
func observeUser() {
let liveObject = userRepository.getUser("user_123")
token = liveObject.observe { liveObject, error in
guard let user = liveObject.snapshot else {
print("error: \(String(describing: error))")
return
}
print("userId: \(user.userId), displayName: \(String(describing: user.displayName))")
}
}
```
### Response
#### Success Response
- **liveObject** (AmityLiveObject) - The live user object.
- **snapshot** (AmityUser) - The user snapshot.
- **error** (Error) - Error object if the request failed.
```
```APIDOC
## userRepository.getUser(userId) (Android)
### Description
Retrieves a single user profile by user ID. Returns `Flowable`.
### Method
Android SDK method
### Endpoint
`userRepository.getUser(userId)`
### Parameters
- **userId** (string) - Required - The ID of the user to retrieve.
### Request Example
```kotlin
fun getUser(userRepository: AmityUserRepository) {
userRepository.getUser(userId = "user_123")
.doOnNext { user: AmityUser ->
val displayName = user.getDisplayName()
val userId = user.getUserId()
Log.d("UserRepo", "User: $displayName ($userId)")
}
.doOnError { error ->
Log.e("UserRepo", "Failed to get user", error)
}
.subscribe()
}
```
### Response
#### Success Response
- **AmityUser** - The user object with methods `getDisplayName()` and `getUserId()`.
```
```APIDOC
## AmityCoreClient.newUserRepository().getUser(userId) (Flutter)
### Description
Retrieves a single user profile by user ID. Returns `Future`.
### Method
Flutter SDK method
### Endpoint
`AmityCoreClient.newUserRepository().getUser(userId)`
### Parameters
- **userId** (string) - Required - The ID of the user to retrieve.
### Request Example
```dart
Future getUser() async {
try {
final user = await AmityCoreClient.newUserRepository().getUser('user_123');
print('User: ${user.displayName}');
} on AmityException catch (error) {
print('Failed to get user: $error');
}
}
```
### Response
#### Success Response
- **AmityUser** - The user object with `displayName` property.
```
--------------------------------
### Install and configure Amity UIKit with API credentials
Source: https://github.com/amityco/social-plus-docs/blob/main/llms-full.txt
Setup and user registration for each UIKit platform. For iOS, add to AppDelegate or SceneDelegate; for Android, in the Application class; for React, wrap the app with AmityUiKitProvider; for React Native, use the provider with apiKey, apiRegion, userId, and displayName; for Flutter, initialize the SDK before showing any UIKit screen and register the user with a BuildContext below AmityUIKitProvider.
```swift
// Add to your AppDelegate or SceneDelegate
import AmityUIKit
AmityUIKitManager.setup(
apiKey: "your-api-key",
region: .US // .US, .EU, or .SG
)
// Register user when the user accesses the feature
AmityUIKitManager.registerDevice(
withUserId: "USER_ID",
displayName: "Ali Connors",
authToken: "AUTH_TOKEN"
)
```
```kotlin
// In your Application class
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
AmityUIKit4Manager.setup(
apiKey = "your-api-key",
endpoint = AmityEndpoint.US
)
}
}
// Register user when the user accesses the feature
fun login(userId: String, authToken: String) {
AmityCoreClient.login(
userId = userId,
sessionHandler = object : SessionHandler {
override fun sessionWillRenewAccessToken(renewal: AccessTokenRenewal) {
renewal.renew()
}
}
).authToken(authToken)
.build()
.submit()
.subscribeOn(Schedulers.io())
.doOnError {
// Exception
}
.subscribe()
}
```
```typescript
import { AmityUIKitProvider } from '@amityco/ui-kit';
import '@amityco/ui-kit/dist/index.css';
const isGoogleBotOrInspectionTool: boolean = false // can add condition to check if user agent is google bot will be true
function App() {
return (
{
console.log("Route changed to:", page); // integrate with your analytics service
}}
seoOptimizationEnabled={isGoogleBotOrInspectionTool} // default value is false, if pass true MQTT will be disabled.
>
);
}
```
```jsx
import {
AmityUiKitProvider,
AmityUiKitSocial,
} from '@amityco/react-native-social-uikit';
export default function App() {
return (
{/* Render instead to mount chat (v4.3.0+) */}
);
}
```
```dart
import 'package:flutter/material.dart';
import 'package:amity_uikit_beta_service/amity_uikit.dart';
Future main() async {
WidgetsFlutterBinding.ensureInitialized();
// 1. Initialize the SDK before showing any UIKit screen.
await AmityUIKit().setup(
apikey: 'YOUR_API_KEY',
region: AmityEndpointRegion.sg, // .us, .eu, or .sg
);
runApp(const MyApp());
}
// 2. Register (log in) the user. registerDevice needs a BuildContext that
// sits BELOW AmityUIKitProvider — see the next step for how AuthGate calls it.
void login(BuildContext context) {
AmityUIKit().registerDevice(
context: context,
userId: 'USER_ID',
displayName: 'DISPLAY_NAME', // optional
// authToken: 'AUTH_TOKEN', // only when secure mode is enabled
callback: (isSuccess, error) {
if (!isSuccess) {
debugPrint('Login failed: $error');
}
},
);
}
```
--------------------------------
### Get My Community Invitations (Swift, Kotlin, TypeScript)
Source: https://github.com/amityco/social-plus-docs/blob/main/social-plus-sdk/social/communities-spaces/organization/community-invitation.mdx
List the current user's pending community invitations. The Swift example uses `AmityInvitationRepository().getMyCommunityInvitations()` and observes a live collection; the Kotlin example uses `AmityCoreClient.newInvitationRepository().getMyCommunityInvitations()` with RxJava; the TypeScript example uses `InvitationRepository.getMyCommunityInvitations` with a limit of 20 and a callback that receives `data`, `loading`, and `error`.
```swift
let invitationRepository = AmityInvitationRepository()
let liveCollection = invitationRepository.getMyCommunityInvitations()
token = liveCollection.observe { collection, error in
if let error = error {
handleError(error)
return
}
let invitations = collection.snapshots
// Render pending invitations
}
```
```kotlin
fun getMyCommunityInvitations() {
AmityCoreClient.newInvitationRepository()
.getMyCommunityInvitations()
.doOnNext { invitations: PagingData ->
// Render pending invitations
}
.doOnError { throwable ->
// Handle error
}
.subscribe()
}
```
```typescript
import { InvitationRepository } from '@amityco/ts-sdk';
function getMyCommunityInvitations() {
return InvitationRepository.getMyCommunityInvitations(
{ limit: 20 },
({ data: invitations, loading, error }) => {
if (error) {
// Handle error
return;
}
if (!loading && invitations) {
// Render pending invitations
}
},
);
}
```
--------------------------------
### Navigate to Your Application
Source: https://github.com/amityco/social-plus-docs/blob/main/uikit/getting-started/installation.mdx
Navigates to your application directory where you will link the UIKit package.
```bash
cd
```
--------------------------------
### Enable presence and start heartbeat
Source: https://github.com/amityco/social-plus-docs/blob/main/use-cases/social/realtime-presence-and-activity.mdx
Quick-start snippet showing the core presence API calls: enabling presence, starting a heartbeat, and observing online channel members. Use this to get presence working immediately; the full walkthrough below explains each step in detail.
```typescript
// 1. Enable presence for the current user
await PresenceManager.enable();
// 2. Start heartbeat to stay online
PresenceManager.startHeartbeat({ intervalMs: 10000 });
// 3. Observe a channel's online members
ChannelRepository.Membership.getMembers(
{ channelId: 'ch-123', filter: 'online' },
({ data }) => { renderOnlineUsers(data); }
);
// 4. Subscribe to real-time topic events
```
--------------------------------
### Install Vise and run doctor
Source: https://github.com/amityco/social-plus-docs/blob/main/ai/vise/mcp-server.mdx
Installs Vise globally so the `vise` command is on your PATH, then runs `vise doctor` to verify the installation. If you prefer not to install globally, replace the command with `npx` and args `["-y", "-p", "@amityco/social-plus-vise", "vise", "mcp"]`.
```sh
npm install -g @amityco/social-plus-vise
vise doctor
```
--------------------------------
### Verify frontmatter of SKILL.md
Source: https://github.com/amityco/social-plus-docs/blob/main/docs/superpowers/plans/2026-04-29-diagnostic-skills.md
Command to check the first three lines of the skill file, expecting the frontmatter with name: setup-validator.
```bash
head -3 .mintlify/skills/setup-validator/SKILL.md
```