Skip to main content
Posts are the foundation of content creation and sharing in social.plus. A post can include text, images, videos, files, polls, live streams, or custom content—enabling users to express themselves, share information, and connect with others in a network or community.

Text Posts

Simple text-based posts with formatting support

Image Posts

Photo sharing with multiple image support and filters

Video Posts

Video content with streaming and playback controls

Audio Posts

Share audio files, podcasts, and voice messages

Clip Posts

Short-form video content up to 15 minutes

File Posts

Document and file sharing capabilities

Poll Posts

Interactive polls and surveys for user engagement

Live Stream Posts

Real-time live streaming integration

Mixed Media Posts

Combine multiple media types in a single post

Custom Posts

Extend functionality with custom post types
Posts support real-time events and Live Object features. See Live Objects/Collections and Realtime Events for more.

Post Structure

Posts use a parent-child relationship:
  • The parent post acts as a container (e.g., for text or metadata)
  • Each image, video, or file is a separate child post
  • Both parent and child posts support reactions and comments
Example: An image post with three images will have one parent post (text container) and three child posts (each with an image).
Users can interact (react, comment) with both parent and child posts, enabling rich engagement.

Post Structure Types

Every post has a structureType field that automatically classifies its content composition. This enables precise filtering and querying of posts based on their media content.
Posts containing a single type of content or attachment:
Structure TypeDescriptionUse Case
textText-only content, no attachmentsAnnouncements, discussions, status updates
imageOnly image attachments (1-10 images)Photo galleries, visual content
videoOnly video attachmentsVideo tutorials, recordings
audioOnly audio attachmentsPodcasts, voice messages, audio content
fileOnly file attachmentsDocument sharing, PDFs, presentations
liveStreamLive streaming contentLive broadcasts, real-time events
pollPoll/survey contentVoting, feedback collection
clipShort-form video content (up to 15 min)Quick videos, highlights
Example Query: Get only photo posts (pure images)
const posts = await PostRepository.getPosts({
  dataTypes: ['image'],
  includeMixedStructure: false // Only pure image posts
});
Structure Type: mixedPosts that combine multiple media types in a single post. A post is classified as mixed when it contains 2 or more distinct attachment types (image, video, audio, file).Examples of Mixed Posts:
  • Tutorial with images + instructional video
  • Product showcase with photos + demo video + spec sheet PDF
  • Event coverage with photos + highlight video + audio interview
  • Educational content with diagrams + explanatory video + downloadable resources
Creation: Use createMixedMediaPost() or createMixedAttachmentPost() to combine different media types.Querying: Control whether mixed posts appear in filtered results using includeMixedStructure:
// Include mixed posts that contain images
const posts = await PostRepository.getPosts({
  dataTypes: ['image'],
  includeMixedStructure: true // Includes pure + mixed with images
});
Learn more: Mixed Media Posts
Automatic Classification
  • The structureType is automatically assigned based on post attachments
  • No manual specification needed
  • Updates automatically when post is edited
Query Filtering
  • By default, single-type queries return only pure structure posts
  • Use includeMixedStructure: true to include mixed posts containing that type
  • Multi-type queries automatically include mixed posts
See Query Posts for filtering details.

Post Data Model

NameData TypeDescription
postIdStringID of the post
parentPostIdStringID of the parent post (null if parent)
postedUserIdStringID of the user who posted
targetIDStringID of the target (e.g., community, user)
targetTypeStringType of target (e.g., community, user)
dataTypeStringData type of post (text, image, video, etc.)
structureTypeStringStructure classification (text, image, video, audio, file, liveStream, poll, clip, mixed). Automatically determined based on attachments.
dataObjectData of the post
metadataObjectMetadata of the post
flagCountIntegerNumber of times the post is flagged
editedAtDateDate/time the post was edited
createdAtDateDate/time the post was created
updatedAtDateDate/time the post was updated
reactionsObjectInformation about the post reactions
reactionsCountIntegerNumber of reactions to the post
myReactionsArray of stringsReactions by the current user
commentsCountIntegerNumber of comments to the post (server value)
localCommentCountIntegerLocally-computed comment count that updates in real time. See Live Comment Count below.
commentsArray of AmityCommentThe first three comments for previewing
childrenPostsObjectChild posts (e.g., images, videos)
isDeletedBooleanTrue if the post is deleted
hasFlaggedCommentBooleanTrue if the post has flagged comments
hasFlaggedChildrenBooleanTrue if the post has flagged children
tagsArray of stringsArbitrary tags for querying/filtering posts
feedIdStringID of the post’s feed

Live Comment Count

The localCommentCount property provides a real-time comment count on a post. It updates instantly when comments are created or deleted — both from the current user’s own actions and from real-time events received from other users — so your UI always reflects the latest activity without refetching the entire post. To receive these updates, you must observe the post through a Live Object (via getPost()) or a Live Collection (via queryPosts()). The SDK delivers localCommentCount changes through the same observation callback you already use for other post property updates. See Live Objects & Collections for details.

How It Works

localCommentCount starts with the server’s commentsCount value when a post is loaded. From that point on, the SDK adjusts the count locally as comment events arrive:
  • Local actions: When the current user creates or deletes a comment, the count updates immediately after the server confirms the action.
  • Remote events: When another user creates or deletes a comment, the SDK receives a real-time event and adjusts the count.
  • Re-calibration: Every time the post object is refreshed from the server (e.g., via a query or pagination), localCommentCount resets to the server’s commentsCount, ensuring eventual consistency.
localCommentCount includes all comment levels — both top-level comments and replies. It matches how commentsCount works on the server.

When to Use localCommentCount vs commentsCount

PropertyUpdates from real-time events?Best for
commentsCountNo — reflects the server value at the time the post was last fetchedStatic displays or cases where you always re-fetch the post before showing the count
localCommentCountYes — updates instantly via local actions and real-time eventsDisplaying live counters in feeds, post detail views, and active discussions
For most UI use cases, prefer localCommentCount to give users an immediate sense of activity. The value will re-calibrate to the server count automatically whenever the post is refreshed.

Prerequisites

Two things must be in place for localCommentCount to deliver live updates:
1

Observe the post via Live Object or Live Collection

You must be observing the post through getPost() (Live Object) or queryPosts() (Live Collection). The SDK delivers localCommentCount changes through the observation callback — if you’re not observing, you won’t receive updates.
2

Subscribe to real-time events

To receive other users’ comment activity, subscribe to the relevant post and comment topic. Without a subscription, localCommentCount will only reflect the current user’s own actions.
Choose the subscription scope that matches your UI:
Subscribe to all post and comment events in a community — ideal for community feeds where you want live counters on every post.
import { getCommunityTopic, SubscriptionLevels } from '@amityco/ts-sdk';

// Subscribe to all post + comment events in this community
const topic = getCommunityTopic(community, SubscriptionLevels.POST_AND_COMMENT);
Real-time events are not available for global feed queries. Use community-level or post-level subscriptions instead. See Social Real-time Events for the full list of subscription topics.

Limitations

Because the count is computed locally from a stream of events, it may temporarily diverge from the true server count in high-traffic scenarios (e.g., hundreds of comments per second). The SDK automatically re-calibrates whenever fresh post data is fetched from the server, so any drift is short-lived.
Updates are delivered through the Live Object or Live Collection observation callback. If you fetch a post without observing it, you won’t receive localCommentCount changes. Additionally, without subscribing to the relevant post/comment real-time topic, the count will only reflect the current user’s own create/delete actions.
Real-time events are scoped to communities, individual posts, or user feeds. If you display posts from a global feed query, localCommentCount will still work for the current user’s own actions but won’t receive remote events until you subscribe at a tighter scope (community or post level).

Quick Start Guide

1

Choose Post Type

Select the appropriate post type based on your content:
  • Text: For discussions and announcements
  • Image: For photo sharing and visual content
  • Video: For video content and tutorials
  • Audio: For podcasts, voice messages, and audio content
  • Clip: For short-form video content up to 15 minutes
  • Poll: For community engagement and feedback
  • File: For document sharing
  • Live Stream: For real-time broadcasts
  • Mixed Media: For combining multiple media types (images + videos + audio + files)
  • Custom: For advanced or app-specific content
2

Create Content

Use the creation guides for your chosen post type:
// Example: Creating a text post
const post = await PostRepository.createPost({
  type: 'text',
  data: {
  text: 'hello!',
  },
  targetType: 'community',
  targetId: 'community-id'
});
3

Manage Post

Use management tools to edit, delete, or moderate your posts
4

Track Performance

Monitor engagement through analytics and impression tracking

Comments

Enable discussions and conversations on your posts

Moderation

Keep content quality high with automated and manual moderation

Reactions

Let users express themselves with likes, loves, and custom reactions