Create Post
A post can exist in the following:
User feed - collection of posts for a user's timeline
Community feed - collection of posts from members of the community
Content - external content
In creating a post, these are the following parameters:
Parameter | Description | Attributes |
---|---|---|
| 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.. | |
| Where you want the post to exist |
|
| Keywords you want to associate with your post. This is optional. Up to five tags can be added and each tag can be up to 24 characters long |
Post target type
The targetType
parameter can be any of the following:
user
community
content
If you want the post to belong to a user feed, targetType
should be user
and targetId
is the ID of the user. Otherwise, if you want it to belong to a community, targetType
and targetId
should be community
and the ID of the community respectively.
For an external content post or a post in which the targetType
is content
, it can stand on its own without belonging to a user or community. You can create a post object of this type if you want to associate the post to a content (e.g. a news article) in your app which is external to Amity Social Cloud.
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.
Below are sample codes in creating different post types. 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:
Text post
Image post
File post
Video post
Custom post
Last updated