List and Get Reactions
Explore how to use Slack's reactions.list and reactions.get API endpoints in JavaScript. Learn to list all reactions made by users or apps and retrieve reactions on specific messages. This lesson helps you understand query parameters and response structures essential for managing Slack reactions in your applications.
We'll cover the following...
Let’s look at the following endpoints in this lesson:
reactions.list: This endpoint lists reactions made by a user.reactions.get: This endpoint gets reactions for an item.
List of reactions
We access the https://slack.com/api/reactions.list endpoint to get a list of reactions. Using this endpoint, we can list all the reactions made by a user or an application.
Request parameters
Some important query parameters for the reactions.list endpoint are as follows:
Parameter | Type | Category | Description |
| token | required | Authentication tokens carry the required scopes that govern the usage of different Slack applications and APIs. We usually pass these tokens as an HTTP Authorization header or as a POST parameter. |
| string | optional | This parameter is a string of characters used to "point" to the next "page" of data. We paginate through collections of data by setting the |
| integer | optional | This is the maximum number of items to return. |
| string | optional | This shows us the reactions made by this user. It defaults to the authorized user. |
Let’s call the reactions.list endpoint. Click the “Run” button to receive the list of reactions we’ve used.
On line 17, we call the reactions.list endpoint to get a list of all the reactions that were used.
Response fields
A successful response includes an items list containing the details of every item (files, messages, etc.) on which the authed user has reacted.
Note: Visit this lesson to view the details of the different objects such as
fileandmessage.
Get a reaction
To get a reaction, we access the https://slack.com/api/reactions.get endpoint.
Request parameters
Here are some important query parameters for the reactions.get endpoint:
Parameter | Type | Category | Description |
| token | required | Authentication tokens carry the required scopes that govern the usage of different Slack applications and APIs. We usually pass these tokens as an HTTP Authorization header or as a POST parameter. |
| string | optional | This is the channel where the message to get reactions was posted. |
| string | optional | This is the timestamp of the message for which we have to get reactions. |
Let’s call the reactions.get endpoint. Click the “Run” button to get all the reactions to a specific message.
In the code above:
- Lines 10–13: We specify the channel and the timestamp of the message whose reactions we want to get.
- Lines 22–23: We provide the query parameters and call the
reactions.getendpoint.
Response fields
The response from this endpoint includes the list of all reactions added to the input message.
Note: Visit this lesson to view the details of the
messageobject.