Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Amity SDK provides developers with a powerful set of tools for creating a wide range of post types with support for a broad range of content formats, users can create highly dynamic and engaging posts that help to drive user engagement and increase retention, including:
We provide a method for creating each type of post. To create a post, you must first select the target type. The target type is either a user or a community.
User: If you wish to create a post on someone else's feed, provide their user ID as the targetId and set the target type to the user. If you want to create a post on your own feed, leave the target ID empty.
Community: To make a post on a specific community, set the target type to community and provide the community ID.
Each post can have up to 20,000 characters, and custom posts should not have JSON data that is larger than 100KB.
Prior to creating an image post, it is crucial to upload the images that will be included in the post data to ensure that the necessary information is accessible and can be linked to the post. This requires uploading the image first, to obtain the image data that will be used in creating the image post. To upload an image, please refer to #upload-images.
Upon successful completion of the image upload process, you can include the image data as a parameter when creating an image post, as demonstrated in the code sample below.
Here's an explanation of the method's parameters:
text
: This is a required parameter of type String
, which represents the text content of the new post. You can pass in any text you want to include in the post, up to a maximum length of 20,000 characters.
images
: Which represents an array of images uploaded by the user on Android, iOS and Flutter and imageIds
for Typescript and Javascript to include in the new post. You can pass up to 10 images in a post.
targetType
- Type of the target, either a particular community or a user feed.
tags
- Arbitrary strings that can be used for defining and querying for the posts.
metaData
- Additional properties to support custom fields.
We can build the post first by using AmityImagePostBuilder
. Then use the createImagePost
method in AmityPostRepository
to create image post.
We can build the post first by using AmityImagePostCreator.Builder
. Then use the same createPost
method in AmityPostRepository
to create an image post.
An image post data structure is:
Updating image post in JS SDK is not yet supported.
Version 6
Beta (v0.0.1)
Updating images in image post is not yet supported.
Refer to Post target type for a more detailed explanation of the targetType
parameter.
A post can have a maximum of ten images.
Prior to creating a live stream post, it is crucial to create the live stream that will be included in the post data to ensure that the necessary information is accessible and can be linked to the post. This requires creating the live stream first, to obtain the data that will be used in creating the live stream post. For more information regarding live stream, please refer to
As demonstrated in the code sample below, here's a way to create a live stream.
Upon successful completion of the live stream process, you can include the stream ID as a parameter when creating a live stream post, as demonstrated in the code sample below.
Here's an explanation of the method's parameters:
text
: This is a required parameter of type String
, which represents the text content of the new post. You can pass in any text you want to include in the post, up to a maximum length of 20,000 characters.
streamId
: The ID of the created live stream to include in a post.
targetType
- Type of the target, either a particular community or a user feed.
tags
- Arbitrary strings that can be used for defining and querying for the posts.
metaData
- Additional properties to support custom fields.
You can create a livestream post via AmityLiveStreamPostBuilder
.
AmityLiveStreamPostBuilder
creates a text post and attaches a stream post as a first child. This builder requires the stream object id.
We can build the post first by using AmityLiveStreamPostCreator.Builder
. Then, use the same createPost
method in AmityPostRepository
and pass the streamId
from created AmityStream
to create a livestream post.
Version 6
Beta (v0.0.1)
If you'd like to display content on your app that cannot be represented by the available text, image, video, and file post types, you can create your own custom post type. Custom post types allow you to include the necessary data for rendering, such as additional metadata and custom data formatting. This is useful if you want to present specific types of content to your users.
To create a custom post type, you can query the user, community, or global feed using our SDK's APIs. Please refer to . For additional information on rendering custom posts with UIKit, please see .
dataType
- a string that defines the type of the post so you can distinguish your new post from others
data
- a free-form JSON object that can be customized based on your use cases.
attachments
- images and other files you want to include in your post. You can only attach one file type. This means that it must either be all images, all files, or all video files.
tags
- text that will be used in post query. You can add up to five tags. Each tag can have a maximum length of 24 characters.
The dataType
parameter should have the custom
prefix.
The functionality isn't currently supported by this SDK.
Please refer to the web API for custom post creation.
Version 6
Beta (v0.0.1)
The functionality isn't currently supported by this SDK.
Please refer to the web API for custom post creation.
Prior to creating a poll post, it is crucial to create the poll that will be included in the post data to ensure that the necessary information is accessible and can be linked to the post. This requires creating the poll first, to obtain the data that will be used in creating the poll post. For more information about polls including vote, close, or delete a poll, please refer to the page - .
text
: This is a required parameter of type String
, which represents the text content of the new post. You can pass in any text you want to include in the post, up to a maximum length of 20,000 characters.
pollId
: The ID of the created poll to include in a post.
targetType
- Type of the target, either a particular community or a user feed.
tags
- Arbitrary strings that can be used for defining and querying for the posts.
As demonstrated in the code sample below, here's a way to create a poll and poll post.
Version 6
Beta (v0.0.1)
metaData
- Additional properties to support custom fields.
Prior creating a video post, it is crucial to upload the videos that will be included in the post data to ensure that the necessary information is accessible and can be linked to the post. This requires uploading the video first, to obtain the video data that will be used in creating the video post. To upload a video, please refer to
Upon successful completion of the video upload process, you can include the video data as a parameter when creating a video post, as demonstrated in the code sample below.
Here's an explanation of the method's parameters:
text
: This is a required parameter of type String
, which represents the text content of the new post. You can pass in any text you want to include in the post, up to a maximum length of 20,000 characters.
videos
: Which represents an array of videos uploaded by the user on Android, iOS and Flutter and videoIds
for Typescript and Javascript to include in the new post. You can pass up to 10 videos in a post.
targetType
- Type of the target, either a particular community or a user feed.
tags
- Arbitrary strings that can be used for defining and querying for the posts.
metaData
- Additional properties to support custom fields.
Requirements for Video
Supported video types are 3gp
, avi
, f4v
, flv
, m4v
, mov
, mp4
, ogv
, 3g2
, wmv
, vob
, webm
, mkv
The maximum file size of the video is 1 GB
The maximum duration of the video is 2 hours
We can build the post first by using AmityVideoPostBuilder
. Then use the createVideoPost
method in AmityPostRepository
to create a video post.
We can build the post first by using AmityFilePostCreator.Builder
. Then use the same createPost
method in AmityPostRepository
to create an image post.
Version 6
Beta
A post can have a maximum of ten videos.
Uploading HDR video format is not supported on iOS.
Text posts are a simple yet powerful way to create and share text-based content with other users on our platform. With the Amity Social SDK, users can quickly and easily create text posts and add them to a user's or community's feed. As demonstrated in the code sample below, you can simply include the text data as a parameter when creating a text post.
Here's an explanation of the method's parameters:
text
: This is a required parameter of type String
, which represents the text content of the new post. You can pass in any text you want to include in the post, up to a maximum length of 20,000 characters.
targetType
- Type of the target, either a particular community or a user feed.
metaData
- Additional properties to support custom fields.
tags
- Arbitrary strings that can be used for defining and querying for the posts.
Use AmityTextPostBuilder
to create text post.
Version 6
Beta (v0.0.1)
Prior to creating a file post, it is crucial to upload the files that will be included in the post data to ensure that the necessary information is accessible and can be linked to the post. This requires uploading the file first, to obtain the file data that will be used in creating the file post. To upload a file, please refer to #upload-files
Upon successful completion of the file upload process, you can include the file data as a parameter when creating a file post, as demonstrated in the code sample below.
Here's an explanation of the method's parameters:
text
: This is a required parameter of type String
, which represents the text content of the new post. You can pass in any text you want to include in the post, up to a maximum length of 20,000 characters.
files
: Which represents an array of files uploaded by the user on Android, iOS and Flutter and fileIds
for Typescript and Javascript to include in the new post. You can pass up to 10 files in a post.
targetType
- Type of the target, either a particular community or a user feed.
tags
- Arbitrary strings that can be used for defining and querying for the posts.
metaData
- Additional properties to support custom fields.
We can build the post first by using AmityFilePostBuilder
. Then use the createFilePost
method in AmityPostRepository
to create a file post.
We can build the post first by using AmityFilePostCreator.Builder
. Then use the same createPost
method in AmityPostRepository
to create an image post.
Version 6
Beta
Refer to Post target type for a more detailed explanation of the targetType
parameter.
Updating files in a file post is not yet supported.
Refer to Post target type for a more detailed explanation of the targetType
parameter.
A post can have a maximum of ten files.