How to Get Fans (people who clapped) of a Medium Article

Using Medium API JS Package

Introduction

Knowing who engages with your Medium articles can provide valuable insights into your audience. By fetching the fans (users who clapped for an article), you can understand your readers better and even tailor your content to align with their preferences.

Here’s a straightforward way to achieve this using the medium-api-js package. By the end of this guide, you’ll know how to retrieve the list of fans for any Medium article.

Prerequisites

To set up and execute the code:

Code Explanation

Below is a breakdown of the code used to fetch the fans of a Medium article.

Step 1: Import Necessary Modules

import Medium from 'medium-api-js';
import dotenv from 'dotenv';
dotenv.config();

Step 2: Initialize Medium API with API Key

const medium = new Medium(process.env.RAPIDAPI_KEY);

Step 3: Specify the Article ID

const articleId = '67fa62fc1971';

Step 4: Fetch Fans and Log the Response

medium.getArticleFans(articleId).then(data => {
    console.log('Article Fans:', data); // Output the fans of the article
});

Running the Code

Save the code in a file, e.g., getArticleFans.js, and run the following command in the terminal:

node getArticleFans.js

Ensure that the .env file is properly configured with your API key:

RAPIDAPI_KEY=your_rapidapi_key_here

Output and Explanation

When the code executes successfully, the output will display the details of the article’s fans:

In the sample output, the article has 143 fans, with the voters array listing their IDs.

Potential Use Cases

Summary

Fetching fans of a Medium article is an excellent way to gain insights into your readership and engagement levels. By using the medium-api-js package, this process is simplified and efficient. Implement this code to unlock deeper connections with your audience.

For any questions or clarifications, feel free to reach out at nishu@mediumapi.com.

nishu@mediumapi.com