Posts

class matterapi.endpoints.async_api.PostsApi(client: matterapi.client.base.BaseClient, skip_response_parsing: bool = False)

Endpoints for creating, getting and interacting with posts.

async create_post(*, json_body: Union[matterapi.models.CreatePostJsonBody, Dict], set_online: Optional[bool] = None) matterapi.models.Post

Create a post

Create a new post in a channel. To create the post as a comment on another post, provide root_id.

Permissions:

Must have create_post permission for the channel the post is being created in.

Api Reference:

CreatePost

async create_post_ephemeral(*, json_body: Union[matterapi.models.CreatePostEphemeralJsonBody, Dict]) matterapi.models.Post

Create a ephemeral post

Create a new ephemeral post in a channel.

Permissions:

Must have create_post_ephemeral permission (currently only given to system admin)

Api Reference:

CreatePostEphemeral

async delete_post(post_id: str) matterapi.models.StatusOK

Delete a post

Soft deletes a post, by marking the post as deleted in the database. Soft deleted posts will not be returned in post queries.

Permissions:

Must be logged in as the user or have delete_others_posts permission.

Api Reference:

DeletePost

async do_post_action(post_id: str, action_id: str) matterapi.models.StatusOK

Perform a post action

Perform a post action, which allows users to interact with integrations through posts.

Permissions:

Must be authenticated and have the read_channel permission to the channel the post is in.

Api Reference:

DoPostAction

async get_file_infos_for_post(post_id: str) List[matterapi.models.FileInfo]

Get file info for post

Gets a list of file information objects for the files attached to a post.

Permissions:

Must have read_channel permission for the channel the post is in.

Api Reference:

GetFileInfosForPost

async get_flagged_posts_for_user(user_id: str, *, team_id: Optional[str] = None, channel_id: Optional[str] = None, page: Optional[int] = 0, per_page: Optional[int] = 60) List[matterapi.models.PostList]

Get a list of flagged posts

Get a page of flagged posts of a user provided user id string. Selects from a channel, team, or all flagged posts by a user. Will only return posts from channels in which the user is member.

Permissions:

Must be user or have manage_system permission.

Api Reference:

GetFlaggedPostsForUser

async get_post(post_id: str) matterapi.models.Post

Get a post

Get a single post.

Permissions:

Must have read_channel permission for the channel the post is in or if the channel is public, have the read_public_channels permission for the team.

Api Reference:

GetPost

async get_post_thread(post_id: str) matterapi.models.PostList

Get a thread

Get a post and the rest of the posts in the same thread.

Permissions:

Must have read_channel permission for the channel the post is in or if the channel is public, have the read_public_channels permission for the team.

Api Reference:

GetPostThread

async get_posts_around_last_unread(user_id: str, channel_id: str, *, limit_before: Optional[int] = 60, limit_after: Optional[int] = 60, skipFetchThreads: Optional[bool] = False, collapsedThreads: Optional[bool] = False, collapsedThreadsExtended: Optional[bool] = False) matterapi.models.PostList

Get posts around oldest unread

Get the oldest unread post in the channel for the given user as well as the posts around it. The returned list is sorted in descending order (most recent post first).

Permissions:

Must be logged in as the user or have edit_other_users permission, and must have read_channel permission for the channel.

Minimum Server Version:

5.14

Api Reference:

GetPostsAroundLastUnread

async get_posts_by_ids(*, json_body: Union[List[str], Dict]) List[matterapi.models.Post]

Get posts by a list of ids

Fetch a list of posts based on the provided postIDs

Permissions:

Must have read_channel permission for the channel the post is in or if the channel is public, have the read_public_channels permission for the team.

Api Reference:

GetPostsByIds

async get_posts_for_channel(channel_id: str, *, page: Optional[int] = 0, per_page: Optional[int] = 60, since: Optional[int] = None, before: Optional[str] = None, after: Optional[str] = None) matterapi.models.PostList

Get posts for a channel

Get a page of posts in a channel. Use the query parameters to modify the behaviour of this endpoint. The parameter since must not be used with any of before, after, page, and per_page parameters. If since is used, it will always return all posts modified since that time, ordered by their create time limited till 1000. A caveat with this parameter is that there is no guarantee that the returned posts will be consecutive. It is left to the clients to maintain state and fill any missing holes in the post order.

Permissions:

Must have read_channel permission for the channel.

Api Reference:

GetPostsForChannel

async patch_post(post_id: str, *, json_body: Union[matterapi.models.PatchPostJsonBody, Dict]) matterapi.models.Post

Patch a post

Partially update a post by providing only the fields you want to update. Omitted fields will not be updated. The fields that can be updated are defined in the request body, all other provided fields will be ignored.

Permissions:

Must have the edit_post permission.

Api Reference:

PatchPost

async pin_post(post_id: str) matterapi.models.StatusOK

Pin a post to the channel

Pin a post to a channel it is in based from the provided post id string.

Permissions:

Must be authenticated and have the read_channel permission to the channel the post is in.

Api Reference:

PinPost

async search_posts(team_id: str, *, json_body: Union[matterapi.models.SearchPostsJsonBody, Dict]) matterapi.models.PostListWithSearchMatches

Search for team posts

Search posts in the team and from the provided terms string.

Permissions:

Must be authenticated and have the view_team permission.

Api Reference:

SearchPosts

async set_post_unread(user_id: str, post_id: str) matterapi.models.ChannelUnreadAt

Mark as unread from a post.

Mark a channel as being unread from a given post. Must have edit_other_users permission if the user is not the one marking the post for himself.

Permissions:

Must have read_channel permission for the channel the post is in or if the channel is public, have the read_public_channels permission for the team.

Minimum Server Version:

5.18

Api Reference:

SetPostUnread

async unpin_post(post_id: str) matterapi.models.StatusOK

Unpin a post to the channel

Unpin a post to a channel it is in based from the provided post id string.

Permissions:

Must be authenticated and have the read_channel permission to the channel the post is in.

Api Reference:

UnpinPost

async update_post(post_id: str, *, json_body: Union[matterapi.models.UpdatePostJsonBody, Dict]) matterapi.models.Post

Update a post

Update a post. Only the fields listed below are updatable, omitted fields will be treated as blank.

Permissions:

Must have edit_post permission for the channel the post is in.

Api Reference:

UpdatePost