Skip to main content

entity.presentComments method

Facts

DescriptionProvide comments for work objects. Apps call this endpoint to send per-user flexpane comment data to the client.
Method Access
POST https://slack.com/api/entity.presentComments
ScopesNo scopes required
Content types
application/x-www-form-urlencoded
application/json

Arguments

Required arguments

tokenstringRequired
Example: xxxx-xxxxxxxxx-xxxx
commentsarrayRequired

Array of comments to present to the user. See the comment schema for the full list of properties.

trigger_idstringRequired

A reference to the original user action that initiated the request

Optional arguments

cursorstringOptional

App supplied cursor used for pagination, will be sent in the next request for comments

can_post_commentbooleanOptional

Indicates whether the user has permissions to post comments

delete_action_idstringOptional

The block action id that will be sent when a delete request is initiated for a comment.

user_auth_requiredbooleanOptional

Set to true (or 1) to indicate that the user must authenticate to see the comments data.

Default: 0
user_auth_urlstringOptional

A custom URL to which users are directed for authentication if required.

Example: https://example.com/onboarding?user_id=xxx
errorOptional

Usage info

This method returns the comments to display in the comments tab of a Work Objects flexpane. Call it in response to the entity_comments_requested event.

Example:

{
"comments": [
// comment from an authenticated Slack user
{
"sender": {
"user_id": "U123456789"
},
"timestamp": 1741164235,
"id": "comment-unique-identifier-001",
"url": "your.app/item/1/comment/1",
"can_edit": true,
"can_delete": true,
"can_reply": true,
"reply_count": 2,
"reply_users": [
{ "user_id": "U234567890" },
{ "text": "External User", "icon": { "url": "..." } }
],
"latest_reply_ts": 1741165000,
"last_edit_ts": 1741164300,
// comment with blocks
"comment": {
"blocks": {
"type": "rich_text",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "text",
"text": "Check out these different block types with paragraph breaks between them:\n\n"
}
]
}
]
}
}
},
// example comment from a user who is not an authenticated Slack user
{
"sender": {
"text": "UserFirstName UserLastName",
"icon": {
"alt_text": "Summary of image's content",
"url": "..." // publicly-accessible URL to an image
},
"url": "your.app/user/userId",
"email": "firstname.lastname@domain.com"
},
"timestamp": 1741164358,
"id": "comment-unique-identifier-002",
"url": "your.app/item/1/comment/2",
"thread_root_id": "comment-unique-identifier-001", // this is a reply to comment-001
// comment with plain text
"comment": {
"value": "Plain text comment",
"format": "markdown"
}
}
],
"can_post_comment": true,
"delete_action_id": "your-delete-action-id",
"trigger_id": "1234567890123.1234567890123.abcdef01234567890abcdef012345689",
"error": ""
}

Comment schema

PropertyTypeDescriptionRequired?
commentsList<Comment>List of comments to be presented to the flexpane.Required
can_post_commentbooleanUsed to denote whether the user has posting permissions. Hides the composer if false.Required
trigger_idstringUsed to validate API interaction.Required
comments[].commentobjectThe comment content. Provide one of comment.blocks or comment.value.Required
comments[].idstringA unique ID sourced from your app and associated with the comment. It will be used if editing a comment.Required
comments[].senderUserSame User type used in a Work Object's fields.Required
comments[].timestampintegerEpoch timestamp in seconds.Required
delete_action_idstringA string identifier for the delete action ID that will be sent in the block_actions payload when the user clicks the delete button in the UI. This will send the comment.id as the value.Optional
user_auth_requiredbooleanSet to true to indicate that the user must authenticate with your service before comments can be loaded. When true, user_auth_url is required. Defaults to false. Refer to authenticating users.Optional
user_auth_urlstringThe URL to which the user is directed to authenticate. Required when user_auth_required is true.Optional
comments[].can_deletebooleanIf present and true, renders the delete button on that comment. When true, delete_action_id should also be present, otherwise the delete button will render but do nothing when clicked. Empty strings are not supported.Optional
comments[].can_editbooleanIf present and true, indicates that the comment is editable in the user's flexpane.Optional
comments[].can_replybooleanIf present and true, allows users to reply to this comment in a thread.Optional
comments[].comment.blocksRich text blockA rich text block containing the comment content.Optional
comments[].comment.formatstringIf set to "markdown", the comment.value will be formatted as markdown.Optional
comments[].comment.valuestringPlain or markdown string containing the comment content. This will be used if blocks is not present on the comment object.Optional
comments[].cursorstringPagination cursor associated with this comment's position in the list.Optional
comments[].last_edit_tsintegerEpoch timestamp in seconds of the last edit to this comment.Optional
comments[].latest_reply_tsintegerEpoch timestamp in seconds of the most recent reply in the thread.Optional
comments[].reply_countintegerNumber of replies in the thread under this comment.Optional
comments[].reply_usersList<User>Up to two users who have replied to this comment thread. Same User type as sender.Optional
comments[].thread_root_idstringThe id of the parent comment. If present, this comment is a threaded reply.Optional
comments[].urlstringURL which directs to the comment.Optional

Response

Errors

This table lists the expected errors that this method could return. However, other errors can be returned in the case where the service is down or other unexpected factors affect processing. Callers should always check the value of the ok parameter in the response.

Error
Description
access_denied

Access to a resource specified in the request is denied.

accesslimited

Access to this method is limited on the current network

account_inactive

Authentication token is for a deleted user or workspace when using a bot token.

deprecated_endpoint

The endpoint has been deprecated.

ekm_access_denied

Administrators have suspended the ability to post a message.

enterprise_is_restricted

The method cannot be called from an Enterprise.

fatal_error

The server could not complete your operation(s) without encountering a catastrophic error. It's possible some aspect of the operation succeeded before the error was raised.

internal_error

The server could not complete your operation(s) without encountering an error, likely due to a transient issue on our end. It's possible some aspect of the operation succeeded before the error was raised.

invalid_app_id

App ID is not a valid format

invalid_arg_name

The method was passed an argument whose name falls outside the bounds of accepted or expected values. This includes very long names and names with non-alphanumeric characters other than _. If you get this error, it is typically an indication that you have made a very malformed API call.

invalid_arguments

The method was called with invalid arguments.

invalid_array_arg

The method was passed an array as an argument. Please only input valid strings.

invalid_auth

Invalid token provided

invalid_auth

Some aspect of authentication cannot be validated. Either the provided token is invalid or the request originates from an IP address disallowed from making the request.

invalid_charset

The method was called via a POST request, but the charset specified in the Content-Type header was invalid. Valid charset names are: utf-8 iso-8859-1.

invalid_form_data

The method was called via a POST request with Content-Type application/x-www-form-urlencoded or multipart/form-data, but the form data was either missing or syntactically invalid.

invalid_post_type

The method was called via a POST request, but the specified Content-Type was invalid. Valid types are: application/json application/x-www-form-urlencoded multipart/form-data text/plain.

invalid_trigger_id

Trigger id is not valid

method_deprecated

The method has been deprecated.

method_not_found

when the API isn't available to the caller

missing_delete_action_id

delete_action_id is required when any comment is marked can_delete

missing_post_type

The method was called via a POST request and included a data payload, but the request did not include a Content-Type header.

missing_scope

The token used is not granted the specific scope permissions required to complete this request.

no_permission

The workspace token used in this request does not have the permissions necessary to complete the request. Make sure your app is a member of the conversation it's attempting to post a message to.

not_allowed_token_type

The token type used in this request is not allowed.

not_authed

No authentication token provided.

org_login_required

The workspace is undergoing an enterprise migration and will not be available until migration is complete.

ratelimited

The request has been ratelimited. Refer to the Retry-After header for when to retry the request.

request_timeout

The method was called via a POST request, but the POST data was either missing or truncated.

service_unavailable

The service is temporarily unavailable

team_access_not_granted

The token used is not granted the specific workspace access required to complete this request.

team_added_to_org

The workspace associated with your request is currently undergoing migration to an Enterprise Organization. Web API and other platform operations will be intermittently unavailable until the transition is complete.

token_expired

Authentication token has expired

token_revoked

Authentication token is for a deleted user or workspace or the app has been removed when using a user token.

two_factor_setup_required

Two factor setup is required.

user_auth_url_missing

User auth url is required if user_auth_required is true