For-you feed w/ external providers
Retrieve a personalized For You feed for a user with other providers like OpenRank and MBD
To choose a different provider, simply pass in a different value in the provider
field. openrank
is set as the default. (karma3
is an older name for openrank
--kept here for backwards compatiblity--)
If you pick mbd
as provider, you can further customize your feed by passing in additional filter values in an optionalfilters
object inside the provider_metadata
field in the request e.g.
const provider_metadata = encodeURIComponent(JSON.stringify({
"filters": {
"channels": [
"https://warpcast.com/~/channel/neynar"
],
"languages": [
"en"
],
"author_ids": [
"194",
"191"
],
// remove_author_fids only works when author_ids isn't passed in
// "remove_author_ids": [
// "18949"
// ],
"frames_only": false,
"embed_domains": [
"neynar.com",
"frames.neynar.com"
],
"ai_labels": [
"science_technology"
],
"remove_ai_labels": [
"spam"
]
}
}));
The filters available for MBD that you can pass in that object are:
Name | Type | Description |
---|---|---|
start_timestamp | string | return only casts after this start_timestamp, specified as Epoch time (Unix timestamp) |
end_timestamp | string | return only casts before this end_timestamp, specified as Epoch time (Unix timestamp) |
channels | string[] | return only casts that belong to these channels, specified by channel urls (root_parent_url) |
languages | string[] | returns only casts that use these languages |
author_ids | string[] | returns only casts created by authors with these fids |
remove_author_ids | string[] | does not return casts created by authors with these fid's NOTE: this is ignored if author_ids is defined |
frames_only | boolean | whether to limit search to only frames |
embed_domains | string[] | return only casts with specific domains embedded |
ai_labels | string[] | Return only casts that have these AI labels. Available values below. Labels in topics category: - arts_culture - business_entrepreneurs - celebrity_pop_culture - diaries_daily_life - family - fashion_style - film_tv_video - fitness_health - food_dining - gaming - learning_educational - music - news_social_concern - other_hobbies - relationships - science_technology - sports - travel_adventure - youth_student_life Labels in sentiment category: - positive - neutral - negative Labels in emotion category: - anger - anticipation - disgust - fear - joy - love - optimism - pessimism - sadness - surprise - trust Labels in moderation category: - llm_generated - spam - sexual - hate - violence - harassment - self_harm - sexual_minors - hate_threatening - violencegraphic Labels in web3_topics category: - web3_nft - web3_defi - web3_infra - web3_industry - web3_consumer |
remove_ai_labels | string[] | do not return casts with these AI labels NOTE: this is ignored if ai_labels is defined |
A full request to the feed API with the custom mbd filters object looks like below
const fetch = require('node-fetch');
const provider_metadata = encodeURIComponent(JSON.stringify({
"filters": {
"channels": [
"https://warpcast.com/~/channel/neynar"
],
"languages": [
"en"
],
"author_ids": [
"194",
"191"
],
// Note: remove_author_ids only works when author_ids isn't passed in
// "remove_author_ids": [
// "18949"
// ],
"frames_only": false,
"embed_domains": [
"neynar.com",
"frames.neynar.com"
],
"ai_labels": [
"science_technology"
]
}
}));
const url = `https://api.neynar.com/v2/farcaster/feed/for_you?fid=3&viewer_fid=2&provider=mbd&limit=10&provider_metadata=${provider_metadata}`;
const options = {
method: 'GET',
headers: {
'accept': 'application/json',
'api_key': 'NEYNAR_API_DOCS'
}
};
// Fetch request with the metadata and options
fetch(url, options)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('error:', error));
Updated 3 months ago