Create Post

When creating a post, you can select the target type or which feed you want the post to exist, It can be any of the following:

  • User feed - collection of posts for a user's timeline

  • Community feed - collection of posts from members of the community

In creating a post, these are the following parameters:

ParameterDescriptionAttributes

targetId

ID of the user, community, or content. If you want the post to exist in a user feed, you need to provide the userID, etc..

userId or communityId

targetType

Where you want the post to exist

targetUser - post will exist in the user feed

targetCommunity - post will exist in the community feed

text

Post content (for text post)

Post target type

The targetType parameter can be any of the following:

  • UserFeed

  • CommunityFeed

If you want the post to belong to a user feed, targetType should be targetUser(String userId) and userId is the ID of the user. Otherwise, if you want it to belong to a community, targetCommunity(String communityId) and communityId should be the ID of the community respectively.

Post type

A single post can have up to 20,000 characters. For custom post, the size of the JSON data must not exceed 100KB.

For a successful creation of the post, the reply will be the post model. Otherwise, it will return an error.

Amity SDK supports the creation of the following post types:

File Upload

Before you can create an image, video, file, or custom post, you must first upload the image, video, or the file that you will add to your post. The SDK provides a convenient FileRepository class to handle the uploading of these files.

The model that you will receive from the live object used to upload file via FileRepository

Model Description

Name

Data Type

Description

fileId

String

Root file key on cloud storage

fileUrl

String

Http link for file download

mimeType

String

MimeType of a file

fileSize

String

Actual file size

Last updated