Trending Feed on Farcaster
Trending Feed on Farcaster
Fetch User Information
- User by Wallet Address
- Mutual Follows/Followers
- Username Search
- Mutes, Blocks, and Bans
Build Farcaster Mini Apps / Frames
- Create Farcaster Mini App (v2 frame) in < 60s
- Send Notifications to Frame Users
- Create Transaction Frames
- Cast Actions
- v1 Frames (Maintenance Mode)
Build Bots and Agents
- Create Farcaster Bot or Agent
- Listen for @bot Mentions
- Make Agents Prompt Transactions
Fetch Farcaster Feeds
- Trending Feed on Farcaster
- Fetch & Display Farcaster Feeds with Neynar API
- Feed of Given Farcaster FID
- Farcaster Feed of NFT Owners
- Casts by Embed in Farcaster
- How to Use the Neynar Feed API
Onboard New Users
- Create New Farcaster Account
- SIWN: Connect Farcaster Accounts
- Fetch Signers
Write Data to Farcaster
- Choose the Right Signer
- Write Data with Managed Signers
- Like & Recast
Filter Spam, Low Quality Data
Run Queries on FC Data
- Choose Among Data Products
- Ingest Farcaster Data
- Indexer Service
- Hosted SQL
Render Farcaster in React
Fetch Cast Information
Get Events Via Webhooks
Get Farcaster Data on Base
Fetch Notifications
Create Onchain Transactions
Intersect Onchain & Social Data
Write Direct Casts
Get Hypersub Subscriptions
Get Farcaster Storage Data
Publish Actions on FC Apps
Contribute To Development
Trending Feed on Farcaster
Trending Feed on Farcaster
Show casts trending on the Farcaster network through Neynar
This guide demonstrates how to use the Neynar SDK to get trending casts on Farcaster.
Check out this Getting started guide to learn how to set up your environment and get an API key.
First, initialize the client:
// npm i @neynar/nodejs-sdk
import { Configuration, NeynarAPIClient } from "@neynar/nodejs-sdk";
import { FeedType, FilterType } from "@neynar/nodejs-sdk/build/api";
// make sure to set your NEYNAR_API_KEY .env
// don't have an API key yet? get one at neynar.com
const config = new Configuration({
apiKey: process.env.NEYNAR_API_KEY,
});
const client = new NeynarAPIClient(config);
Then fetch the global trending Farcaster casts:
const feed = await client.fetchFeed({
feedType: FeedType.Filter,
filterType: FilterType.GlobalTrending,
limit: 1,
})
console.log(feed);
Example output:
{
"casts": [
{
"object": "cast",
"hash": "0x40b187be167c0134bc99c7e131aedd1da591f3fc",
"author": {
"object": "user",
"fid": 15983,
"username": "jacek",
"display_name": "Jacek.degen.eth 🎩",
"pfp_url": "https://imagedelivery.net/BXluQx4ige9GuW0Ia56BHw/85b47d38-7b53-46b0-7e6a-80ec1b9b3d00/original",
"custody_address": "0x4ae49f0aa762efebebff4bac4ea0847eb6af4ec9",
"profile": {
"bio": {
"text": "Lead $DEGEN | https://www.degen.tips/"
}
},
"follower_count": 77350,
"following_count": 983,
"verifications": [
"0x495d4d2203be7775d22ee8f84017544331300d09",
"0xf1e7dbedd9e06447e2f99b1310c09287b734addc",
"0x011c9a600fa4dcc460f9864e9c8b5498c2835e5a"
],
"verified_addresses": {
"eth_addresses": [
"0x495d4d2203be7775d22ee8f84017544331300d09",
"0xf1e7dbedd9e06447e2f99b1310c09287b734addc",
"0x011c9a600fa4dcc460f9864e9c8b5498c2835e5a"
],
"sol_addresses": []
},
"verified_accounts": [
{
"platform": "x",
"username": "degentokenbase"
}
],
"power_badge": true
},
"thread_hash": "0x40b187be167c0134bc99c7e131aedd1da591f3fc",
"parent_hash": null,
"parent_url": "chain://eip155:7777777/erc721:0x5d6a07d07354f8793d1ca06280c4adf04767ad7e",
"root_parent_url": "chain://eip155:7777777/erc721:0x5d6a07d07354f8793d1ca06280c4adf04767ad7e",
"parent_author": {
"fid": null
},
"text": "Daily Discussion Thread - /degen - February 12, 2025",
"timestamp": "2025-02-12T11:00:28.000Z",
"embeds": [
{
"url": "https://supercast.mypinata.cloud/ipfs/Qmd6kGygZGMvgXikYvMDZ6eBQAzFLYkx8CxAgkzq8wZrXT?filename=degen_is_the_ticker.jpg",
"metadata": {
"content_type": "image/jpeg",
"content_length": 218324,
"_status": "RESOLVED",
"image": {
"width_px": 720,
"height_px": 722
}
}
}
],
"channel": {
"object": "channel_dehydrated",
"id": "degen",
"name": "Degen",
"image_url": "https://imagedelivery.net/BXluQx4ige9GuW0Ia56BHw/4728a50a-1669-4334-1f57-9473c04a2500/original"
},
"reactions": {
"likes_count": 47,
"recasts_count": 6,
"likes": [
{
"fid": 406308,
"fname": "huncho.eth"
},
{
"fid": 545237,
"fname": "robert-ryce"
},
{
"fid": 345765,
"fname": "adexmakai.eth"
},
{
"fid": 562503,
"fname": "araizkyani"
},
{
"fid": 430462,
"fname": "yaza69759996"
}
],
"recasts": [
{
"fid": 279606,
"fname": "itsfarahnaz.eth"
},
{
"fid": 477126,
"fname": "mikadoe.eth"
},
{
"fid": 510796,
"fname": "drrrner"
},
{
"fid": 440352,
"fname": "thegoldenbright"
},
{
"fid": 526510,
"fname": "mariabazooka"
}
]
},
"replies": {
"count": 17
},
"mentioned_profiles": [],
"author_channel_context": {
"role": "moderator",
"following": true
}
}
],
"next": {
"cursor": "eyJ0aW1lc3RhbXAiOiIyMDI1LTAyLTEyIDExOjAwOjI4LjAwMDAwMDAiLCJwb2ludHMiOjAuNDg1NTY2NX0%3D"
}
}
To fetch the next page of the feed, use the cursor:
const nextFeed = await client.fetchFeed({
feedType: FeedType.Filter,
filterType: FilterType.GlobalTrending,
limit: 1,
cursor: feed.next.cursor,
})
It’s that easy to get trending casts in Farcaster!
Ready to start building?
Get your subscription at neynar.com and reach out to us on Telegram with any questions!
Was this page helpful?