Update Post

You can update the post using the updatePost method. This method requires the following parameters:

  • postId (String) - ID of the post to update

  • data (Object) - data object of the post

Other optional parameters are:

  • metadata (Object) - the metadata object of the post

  • tags (Array.<String>) - strings used to query the post. Up to five tags can be added and each tag can be up to 24 characters long.

The updatePost method returns a Promise<boolean> - true if the post is successfully updated. Otherwise, it will throw an error.

Update video post

You can add new videos or remove existing ones from a video post. In adding new videos, you must first upload the videos that you will add to the post. Refer to Upload Video for the details on how to upload a video.

When updating a video post, provide the file ID of the video and the type FileType.Video in the attachments parameter. Modifying attachments array will overwrite the existing videos so it’s recommended to include original attachments if you want to retain the original videos in the post. Leave the attachments array empty to remove all videos.

import { PostRepository, FileType } from '@amityco/js-sdk';

const post = PostRepository.updatePost({
    postId: 'post123',
    tags: ['a','b'], //optional, max no. tags = 5, max length per tag = 24 chars
    data: { text: 'hello!'},
    mentionees: [
    {
      "type": "user",
      "userIds": [
        "user1", “user2”
      ]
    },
    attachments: [
      { fileId: ‘yourFileId’, type: FileType.Video },

    ]
  ]
});

The following are not yet supported:

  1. Adding videos to a non-video post (e.g. text post, image post)

  2. Adding different media types (e.g. image, custom files) in a single post

Last updated