Update (Patch) an Existing Mattermost Post
update_post.RdPartially updates a post by providing only the fields to change. Omitted
fields are left unchanged. Uses the PATCH endpoint
(PUT /api/v4/posts/{post_id}/patch).
Usage
update_post(
post_id,
message = NULL,
is_pinned = NULL,
props = NULL,
verbose = FALSE,
auth = get_default_auth()
)Arguments
- post_id
The ID of the post to update. Must be a non-empty string.
- message
Optional. The new message text (supports Markdown).
- is_pinned
Optional. Set to
TRUEto pin the post to the channel, orFALSEto unpin it.- props
Optional. A named list of properties to attach to the post.
- verbose
(Logical) If
TRUE, detailed information about the request and response will be printed.- auth
The authentication object created by
authenticate_mattermost(). Must be a validmattermost_authobject.
Details
At least one of message, is_pinned, or props must be
provided. The caller must have edit_post permission for the channel
the post is in.
Examples
if (FALSE) { # \dontrun{
auth <- authenticate_mattermost()
# Edit a message
update_post(post_id = "abc123", message = "Updated text", auth = auth)
# Pin a post
update_post(post_id = "abc123", is_pinned = TRUE, auth = auth)
# Edit message and pin in one call
update_post(
post_id = "abc123",
message = "Important update",
is_pinned = TRUE,
auth = auth
)
} # }