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
Users can interact (react, comment) with both parent and child posts, enabling
rich engagement.
Post Structure Types
Every post has astructureType field that automatically classifies its content composition. This enables precise filtering and querying of posts based on their media content.
Pure Structure Types
Pure Structure Types
Posts containing a single type of content or attachment:
Example Query: Get only photo posts (pure images)
| Structure Type | Description | Use Case |
|---|---|---|
text | Text-only content, no attachments | Announcements, discussions, status updates |
image | Only image attachments (1-10 images) | Photo galleries, visual content |
video | Only video attachments | Video tutorials, recordings |
audio | Only audio attachments | Podcasts, voice messages, audio content |
file | Only file attachments | Document sharing, PDFs, presentations |
liveStream | Live streaming content | Live broadcasts, real-time events |
poll | Poll/survey content | Voting, feedback collection |
clip | Short-form video content (up to 15 min) | Quick videos, highlights |
Mixed Structure Type
Mixed Structure Type
Structure Type: Learn more: Mixed Media Posts
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
createMixedMediaPost() or createMixedAttachmentPost() to combine different media types.Querying: Control whether mixed posts appear in filtered results using includeMixedStructure:Structure Type Behavior
Structure Type Behavior
Automatic Classification
- The
structureTypeis automatically assigned based on post attachments - No manual specification needed
- Updates automatically when post is edited
- By default, single-type queries return only pure structure posts
- Use
includeMixedStructure: trueto include mixed posts containing that type - Multi-type queries automatically include mixed posts
Post Data Model
| Name | Data Type | Description |
|---|---|---|
postId | String | ID of the post |
parentPostId | String | ID of the parent post (null if parent) |
postedUserId | String | ID of the user who posted |
targetID | String | ID of the target (e.g., community, user) |
targetType | String | Type of target (e.g., community, user) |
dataType | String | Data type of post (text, image, video, etc.) |
structureType | String | Structure classification (text, image, video, audio, file, liveStream, poll, clip, mixed). Automatically determined based on attachments. |
data | Object | Data of the post |
metadata | Object | Metadata of the post |
flagCount | Integer | Number of times the post is flagged |
editedAt | Date | Date/time the post was edited |
createdAt | Date | Date/time the post was created |
updatedAt | Date | Date/time the post was updated |
reactions | Object | Information about the post reactions |
reactionsCount | Integer | Number of reactions to the post |
myReactions | Array of strings | Reactions by the current user |
commentsCount | Integer | Number of comments to the post (server value) |
localCommentCount | Integer | Locally-computed comment count that updates in real time. See Live Comment Count below. |
comments | Array of AmityComment | The first three comments for previewing |
childrenPosts | Object | Child posts (e.g., images, videos) |
isDeleted | Boolean | True if the post is deleted |
hasFlaggedComment | Boolean | True if the post has flagged comments |
hasFlaggedChildren | Boolean | True if the post has flagged children |
tags | Array of strings | Arbitrary tags for querying/filtering posts |
feedId | String | ID of the post’s feed |
Live Comment Count
ThelocalCommentCount 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),
localCommentCountresets to the server’scommentsCount, 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
| Property | Updates from real-time events? | Best for |
|---|---|---|
commentsCount | No — reflects the server value at the time the post was last fetched | Static displays or cases where you always re-fetch the post before showing the count |
localCommentCount | Yes — updates instantly via local actions and real-time events | Displaying live counters in feeds, post detail views, and active discussions |
Prerequisites
Two things must be in place forlocalCommentCount to deliver live updates:
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.- Community Feed
- Single Post
Subscribe to all post and comment events in a community — ideal for community feeds where you want live counters on every post.
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
Eventual consistency, not absolute accuracy
Eventual consistency, not absolute accuracy
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.
Requires Live Object/Collection observation and real-time subscription
Requires Live Object/Collection observation and real-time subscription
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.Not supported on global feed
Not supported on global feed
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
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
Related Topics
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