> ## Documentation Index
> Fetch the complete documentation index at: https://docs.neynar.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Create a Feed Based on an Array of Farcaster Users

> Create a feed based on a given input of Farcaster users

<Info>
  ### API endpoint

  This tutorial uses the [GET v2/feed](/reference/fetch-user-following-feed) endpoint
</Info>

Imagine you want to create a custom list of users in your app and show a feed of casts based on users in the list, similar to Twitter lists.

<Frame>
  <img src="https://mintcdn.com/neynar/aGwjtKmNewHJXSzO/images/docs/007fd1a-image.png?fit=max&auto=format&n=aGwjtKmNewHJXSzO&q=85&s=8bfc18dc93af2e987d3ccbcc5b47fe11" alt="feed" width="2494" height="2062" data-path="images/docs/007fd1a-image.png" />
</Frame>

## Create a feed given a list of users

In this example, we will try to feed for fids 1, 2 and 3. If you know someone's username, you can find their fid from our [user endpoint](/reference/search-user).

#### Ensure you have the right environment setup

Make sure to have node.js, typescript (ts) and yarn installed on your machine

* Install [node.js and npm](https://nodejs.org/en/download/)
* Install [yarn](https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable)
* Install [ts-node](https://www.npmjs.com/package/ts-node#installation) globally

#### Create a new typescript file with the right imports

```js theme={"system"}
import { NeynarAPIClient, isApiErrorResponse } from "@neynar/nodejs-sdk";
import { AxiosError } from "axios";

import {
  FeedType, FilterType,
} from "@neynar/nodejs-sdk/build/neynar-api/neynar-v2-api";
```

#### Initialize the client

```js theme={"system"}
const client = new NeynarAPIClient("API_KEY");
```

#### Call `fetchFeedPage` function to get feed

```js theme={"system"}
(async () => {
  try {
    const cast =
      await client.fetchFeedPage(FeedType.Filter, {
        filterType: FilterType.Fids,
        fids: "1,2,3",
        limit: 1, // change to however many casts you want to fetch at once (max 100)
        withRecasts: true,
      });
    console.log(JSON.stringify(cast));
  } catch (error) {
    // isApiErrorResponse can be used to check for Neynar API errors
    // handle errors accordingly
    if (isApiErrorResponse(error)) {
      console.log("API Error", error.response.data);
    } else {
      console.log("Generic Error", error);
    }
  }
})();
```

#### Run your new .ts file

* Navigate to the right folder in your terminal e.g. `cd ./test-sdk`
* Run script by typing `yarn start` into the terminal

#### You should now see an output like this

```json theme={"system"}
{
  "casts": [
    {
      "hash": "0x46db48a011698758bfb9b1f77c07596249e277ef",
      "thread_hash": "0x46db48a011698758bfb9b1f77c07596249e277ef",
      "parent_hash": null,
      "parent_url": "chain://eip155:7777777/erc721:0xe96c21b136a477a6a97332694f0caae9fbb05634",
      "parent_author": {
        "fid": null
      },
      "author": {
        "object": "user",
        "fid": 3647,
        "custody_address": "0x54faa8c0c270093fcd0f0c4b29ace4d5426113b7",
        "username": "iamnick.eth",
        "display_name": "Nick Smith",
        "pfp_url": "https://i.seadn.io/gcs/files/8583feea8a3465788d84367a92d80512.png?w=500&auto=format",
        "profile": {
          "bio": {
            "text": "Building withfam.xyz Prev. Co-founder @ talisman.xyz ✴︎ Member @ FWB, Builder DAO, The Park ✷",
            "mentioned_profiles": []
          }
        },
        "follower_count": 482,
        "following_count": 149,
        "verifications": [
          "0x0f9b1b68f848cb65f532bc12825357201726d3d2"
        ],
        "active_status": "active"
      },
      "text": "https://x.com/iamnickdoteth/status/1724238126884024629?s=20\n\nBoiler Room, but make it onchain\n\nwe're forming a squad. HMU if you're interested",
      "timestamp": "2023-11-17T01:22:25.000Z",
      "embeds": [
        {
          "url": "https://x.com/iamnickdoteth/status/1724238126884024629?s=20"
        }
      ],
      "reactions": {
        "likes": [
          {
            "fid": 191213,
            "fname": "stringtheory69"
          },
          {
            "fid": 13870,
            "fname": "0xsatori.eth"
          },
          {
            "fid": 8,
            "fname": "jacob"
          },
          {
            "fid": 195091,
            "fname": "greyseymour"
          },
          {
            "fid": 7715,
            "fname": "royalaid"
          },
          {
            "fid": 1407,
            "fname": "zinger"
          },
          {
            "fid": 3115,
            "fname": "ghostlinkz"
          },
          {
            "fid": 2,
            "fname": "varunsrin.eth"
          }
        ],
        "recasts": [
          {
            "fid": 191213,
            "fname": "stringtheory69"
          },
          {
            "fid": 7715,
            "fname": "royalaid"
          },
          {
            "fid": 2,
            "fname": "varunsrin.eth"
          }
        ]
      },
      "replies": {
        "count": 3
      },
      "mentioned_profiles": []
    }
  ],
  "next": {
    "cursor": "eyJ0aW1lc3RhbXAiOiIyMDIzLTExLTE3IDAxOjIyOjI1LjAwMDAwMDAifQ=="
  }
}
```

**You get all the data in one request, making it easy to display or use in your next operation.** If you want to try getting a live response, head over to our API page for [v2/feed](/reference/fetch-user-following-feed).

You can take the cursor from the output and pass it in the next request to the SDK to page to the next set of results.

<Info>
  ### Ready to start building?

  Get your subscription at [neynar.com](https://neynar.com) and reach out to us on [Slack](https://neynar.com/slack) with any questions!
</Info>
