âī¸Farcaster Data
Learn how you can integrate various Farcaster data into your Frames easily using the Airstack Frog Recipes.
The Airstack Frog Recipes are natively integrated into the Airstack Frames SDK, allowing you to easily fetch any Farcaster data in your Frames.
Here are some onchain data that you can integrate into your Frames:
Get Farcaster User's Details
Get Farcaster User's Followers and Followings
Get Farcaster Channels Participated and Hosted By Farcaster Users
Get Started
First, install the Airstack Frog Recipes:
npm install @airstack/frog hono
yarn add @airstack/frog hono
pnpm install @airstack/frog hono
bun install @airstack/frog hono
getFarcasterUserDetails
You can fetch the Farcaster user details, including profile name, fnames, profile image, user connected addresses, follower count, and following count by using the getFarcasterUserDetails
function:
import {
getFarcasterUserDetails,
FarcasterUserDetailsInput,
FarcasterUserDetailsOutput,
} from "@airstack/frog";
const input: FarcasterUserDetailsInput = {
fid: 602,
};
const { data, error }: FarcasterUserDetailsOutput =
await getFarcasterUserDetails(input);
if (error) throw new Error(error);
console.log(data);
const { getFarcasterUserDetails } = require("@airstack/frog");
const input = {
fid: 602,
};
const { data, error } = await getFarcasterUserDetails(input);
if (error) throw new Error(error);
console.log(data);
{
"profileName": "betashop.eth",
"fnames": ["betashop", "betashop.eth", "jasongoldberg.eth"],
"profileImage": {
"extraSmall": "https://assets.airstack.xyz/image/social/TQjjhuaajVkwqgzZVvgFQYU1qxNfVHQgSmZjTcXRrzQ=/extra_small.png",
"small": "https://assets.airstack.xyz/image/social/TQjjhuaajVkwqgzZVvgFQYU1qxNfVHQgSmZjTcXRrzQ=/small.png",
"medium": "https://assets.airstack.xyz/image/social/TQjjhuaajVkwqgzZVvgFQYU1qxNfVHQgSmZjTcXRrzQ=/medium.png",
"large": "https://assets.airstack.xyz/image/social/TQjjhuaajVkwqgzZVvgFQYU1qxNfVHQgSmZjTcXRrzQ=/large.png",
"original": "https://assets.airstack.xyz/image/social/TQjjhuaajVkwqgzZVvgFQYU1qxNfVHQgSmZjTcXRrzQ=/original_image.png"
},
"userAssociatedAddresses": [
"0x66bd69c7064d35d146ca78e6b186e57679fba249",
"0xeaf55242a90bb3289db8184772b0b98562053559"
],
"followerCount": 56141,
"followingCount": 2270
}
getFarcasterFollowers
You can fetch all the users following 0x address on Farcaster by using the getFarcasterFollowers
function:
import {
getFarcasterFollowers,
FarcasterFollowersInput,
FarcasterFollowersOutput,
} from "@airstack/frog";
const input: FarcasterFollowersInput = {
fid: 602,
limit: 100,
};
const {
data,
error,
hasNextPage,
hasPrevPage,
getNextPage,
getPrevPage,
}: FarcasterFollowersOutput = await getFarcasterFollowers(input);
if (error) throw new Error(error);
console.log(data);
const { getFarcasterFollowers } = require("@airstack/frog");
const input = {
fid: 602,
limit: 100,
};
const { data, error, hasNextPage, hasPrevPage, getNextPage, getPrevPage } =
await getFarcasterFollowers(input);
if (error) throw new Error(error);
console.log(data);
[
{
"profileName": "allison985",
"fnames": ["allison985"],
"fid": "220757",
"profileImage": {
"extraSmall": "https://assets.airstack.xyz/image/social/RS9r7sdCb5orXeB0+tLLRPxtnJo80la3zRRVAYc9gPR+ne8TitCLgEJ41Gp1LV6g/extra_small.jpg",
"small": "https://assets.airstack.xyz/image/social/RS9r7sdCb5orXeB0+tLLRPxtnJo80la3zRRVAYc9gPR+ne8TitCLgEJ41Gp1LV6g/small.jpg",
"medium": "https://assets.airstack.xyz/image/social/RS9r7sdCb5orXeB0+tLLRPxtnJo80la3zRRVAYc9gPR+ne8TitCLgEJ41Gp1LV6g/medium.jpg",
"large": "https://assets.airstack.xyz/image/social/RS9r7sdCb5orXeB0+tLLRPxtnJo80la3zRRVAYc9gPR+ne8TitCLgEJ41Gp1LV6g/large.jpg",
"original": "https://assets.airstack.xyz/image/social/RS9r7sdCb5orXeB0+tLLRPxtnJo80la3zRRVAYc9gPR+ne8TitCLgEJ41Gp1LV6g/original_image.jpg"
},
"userAssociatedAddresses": ["0x42fae5a53f0194f6f9587926e206a852c5c726bf"],
"followerCount": 1,
"followingCount": 74
}
// More followers
]
getFarcasterFollowings
You can fetch all the users being followed by 0x address on Farcaster by using the getFarcasterFollowings
function:
import {
getFarcasterFollowings,
FarcasterFollowingsInput,
FarcasterFollowingsOutput,
} from "@airstack/frog";
const input: FarcasterFollowingsInput = {
fid: 602,
limit: 100,
};
const {
data,
error,
hasNextPage,
hasPrevPage,
getNextPage,
getPrevPage,
}: FarcasterFollowingsOutput = await getFarcasterFollowings(input);
if (error) throw new Error(error);
console.log(data);
const { getFarcasterFollowings } = require("@airstack/frog");
const input = {
fid: 602,
limit: 100,
};
const { data, error, hasNextPage, hasPrevPage, getNextPage, getPrevPage } =
await getFarcasterFollowings(input);
if (error) throw new Error(error);
console.log(data);
[
{
"profileName": "jayhuq",
"fnames": ["jayhuq"],
"fid": "1775",
"profileImage": {
"extraSmall": "https://assets.airstack.xyz/image/social/HmDDiN8HQWR/6f6nrPI8+P6fwctlKaEu/dM8+QnZz/Y=/extra_small.png",
"small": "https://assets.airstack.xyz/image/social/HmDDiN8HQWR/6f6nrPI8+P6fwctlKaEu/dM8+QnZz/Y=/small.png",
"medium": "https://assets.airstack.xyz/image/social/HmDDiN8HQWR/6f6nrPI8+P6fwctlKaEu/dM8+QnZz/Y=/medium.png",
"large": "https://assets.airstack.xyz/image/social/HmDDiN8HQWR/6f6nrPI8+P6fwctlKaEu/dM8+QnZz/Y=/large.png",
"original": "https://assets.airstack.xyz/image/social/HmDDiN8HQWR/6f6nrPI8+P6fwctlKaEu/dM8+QnZz/Y=/original_image.png"
},
"userAssociatedAddresses": ["0xda52abca28fadeab9771ba45a2ff346c4db97d7f"],
"followerCount": 58,
"followingCount": 0
}
// More followings
]
getFarcasterChannelDetails
You can fetch a certain channel details by using the getFarcasterChannelDetails
function:
import {
getFarcasterChannelDetails,
FarcasterChannelDetailsInput,
FarcasterChannelDetailsOutput,
} from "@airstack/frog";
const input: FarcasterChannelDetailsInput = {
channel: "farcaster",
};
const { data, error }: FarcasterChannelDetailsOutput =
await getFarcasterChannelDetails(input);
if (error) throw new Error(error);
console.log(data);
const { getFarcasterChannelDetails } = require("@airstack/frog");
const input = {
channel: "farcaster",
};
const { data, error } = await getFarcasterChannelDetails(input);
if (error) throw new Error(error);
console.log(data);
{
"name": "Farcaster",
"description": "Discussions about Farcaster on Farcaster (meta!)",
"imageUrl": "https://ipfs.decentralized-content.com/ipfs/bafkreialf5usxssf2eu3e5ct37zzdd553d7lg7oywvdszmrg5p2zpkta7u",
"createdAtTimestamp": "2023-08-02T22:33:26Z",
"hosts": [
{
"profileName": "v",
"fnames": ["v", "varunsrin.eth"],
"fid": "2",
"profileImage": {
"extraSmall": "https://assets.airstack.xyz/image/social/XCPJH5EP49qftYc7+wAFfv5jzo3ddBWc9FMEERWezG8=/extra_small.png",
"small": "https://assets.airstack.xyz/image/social/XCPJH5EP49qftYc7+wAFfv5jzo3ddBWc9FMEERWezG8=/small.png",
"medium": "https://assets.airstack.xyz/image/social/XCPJH5EP49qftYc7+wAFfv5jzo3ddBWc9FMEERWezG8=/medium.png",
"large": "https://assets.airstack.xyz/image/social/XCPJH5EP49qftYc7+wAFfv5jzo3ddBWc9FMEERWezG8=/large.png",
"original": "https://assets.airstack.xyz/image/social/XCPJH5EP49qftYc7+wAFfv5jzo3ddBWc9FMEERWezG8=/original_image.png"
},
"userAssociatedAddresses": [
"0x4114e33eb831858649ea3702e1c9a2db3f626446",
"0x91031dcfdea024b4d51e775486111d2b2a715871",
"0x182327170fc284caaa5b1bc3e3878233f529d741",
"0xf86a7a5b7c703b1fd8d93c500ac4cc75b67477f0"
],
"followerCount": 142424,
"followingCount": 1127
}
],
"warpcastUrl": "https://warpcast.com/~/channel/farcaster"
}
getFarcasterChannelParticipants
You can fetch all the participants of a channel by using the getFarcasterChannelParticipants
function:
import {
getFarcasterChannelParticipants,
FarcasterChannelParticipantsInput,
FarcasterChannelParticipantsOutput,
FarcasterChannelActionType,
} from "@airstack/frog";
const input: FarcasterChannelParticipantsInput = {
channel: "farcaster",
actionType: [
FarcasterChannelActionType.Cast,
FarcasterChannelActionType.Reply,
],
lastActionTimestamp: {
after: "2024-02-01T00:00:00Z",
before: "2024-02-28T00:00:00Z",
},
limit: 100,
};
const { data, error }: FarcasterChannelParticipantsOutput =
await getFarcasterChannelParticipants(input);
if (error) throw new Error(error);
console.log(data);
const {
getFarcasterChannelParticipants,
FarcasterChannelActionType,
} = require("@airstack/frog");
const input = {
channel: "farcaster",
actionType: [
FarcasterChannelActionType.Cast,
FarcasterChannelActionType.Reply,
],
lastActionTimestamp: {
after: "2024-02-01T00:00:00Z",
before: "2024-02-28T00:00:00Z",
},
limit: 100,
};
const { data, error } = await getFarcasterChannelParticipants(input);
if (error) throw new Error(error);
console.log(data);
[
{
"profileName": "dawufi",
"fnames": ["dawufi"],
"fid": "6806",
"profileImage": {
"extraSmall": "https://assets.airstack.xyz/image/social/94uonfbLlRHZf6qh2LpPC6Fg4DNg3uCUrXkwlo+jA/I=/extra_small.gif",
"small": "https://assets.airstack.xyz/image/social/94uonfbLlRHZf6qh2LpPC6Fg4DNg3uCUrXkwlo+jA/I=/small.gif",
"medium": "https://assets.airstack.xyz/image/social/94uonfbLlRHZf6qh2LpPC6Fg4DNg3uCUrXkwlo+jA/I=/medium.gif",
"large": "https://assets.airstack.xyz/image/social/94uonfbLlRHZf6qh2LpPC6Fg4DNg3uCUrXkwlo+jA/I=/large.gif",
"original": "https://assets.airstack.xyz/image/social/94uonfbLlRHZf6qh2LpPC6Fg4DNg3uCUrXkwlo+jA/I=/original_image.gif"
},
"userAssociatedAddresses": [
"0xe1b1e3bbf4f29bd7253d6fc1e2ddc9cacb0a546a",
"0x0964256674e42d61f0ff84097e28f65311786ccb"
],
"followerCount": 14813,
"followingCount": 1551
}
]
getFarcasterChannelsByParticipant
You can fetch all the Farcaster channels of a given participants by using the getFarcasterChannelsByParticipant
function:
import {
getFarcasterChannelsByParticipant,
FarcasterChannelActionType,
FarcasterChannelsByParticipantInput,
FarcasterChannelsByParticipantOutput,
} from "@airstack/frog";
const input: FarcasterChannelsByParticipantInput = {
fid: 602,
actionType: [
FarcasterChannelActionType.Cast,
FarcasterChannelActionType.Reply,
],
lastActionTimestamp: {
after: "2024-02-01T00:00:00Z",
before: "2024-02-28T00:00:00Z",
},
limit: 100,
};
const { data, error }: FarcasterChannelsByParticipantOutput =
await getFarcasterChannelsByParticipant(input);
if (error) throw new Error(error);
console.log(data);
const {
getFarcasterChannelsByParticipant,
FarcasterChannelActionType,
} = require("@airstack/frog");
const input = {
fid: 602,
actionType: [
FarcasterChannelActionType.Cast,
FarcasterChannelActionType.Reply,
],
lastActionTimestamp: {
after: "2024-02-01T00:00:00Z",
before: "2024-02-28T00:00:00Z",
},
limit: 100,
};
const { data, error } = await getFarcasterChannelsByParticipant(input);
if (error) throw new Error(error);
console.log(data);
[
{
"name": "Based Management",
"description": "Things worth doing onchain.",
"imageUrl": "https://i.imgur.com/f0BFBfH.png",
"createdAtTimestamp": "2023-11-06T19:23:10Z",
"hosts": [
{
"profileName": "lght.eth",
"fnames": ["0xlght", "lght.eth"],
"fid": "13121",
"profileImage": {
"extraSmall": "https://assets.airstack.xyz/image/social/sxSmw/OjqyuT+uMDpHiSTmqOH5F76hwnx6Q35elGlUkt5nWRe8xrgnJemShOmjeN/extra_small.jpg",
"small": "https://assets.airstack.xyz/image/social/sxSmw/OjqyuT+uMDpHiSTmqOH5F76hwnx6Q35elGlUkt5nWRe8xrgnJemShOmjeN/small.jpg",
"medium": "https://assets.airstack.xyz/image/social/sxSmw/OjqyuT+uMDpHiSTmqOH5F76hwnx6Q35elGlUkt5nWRe8xrgnJemShOmjeN/medium.jpg",
"large": "https://assets.airstack.xyz/image/social/sxSmw/OjqyuT+uMDpHiSTmqOH5F76hwnx6Q35elGlUkt5nWRe8xrgnJemShOmjeN/large.jpg",
"original": "https://assets.airstack.xyz/image/social/sxSmw/OjqyuT+uMDpHiSTmqOH5F76hwnx6Q35elGlUkt5nWRe8xrgnJemShOmjeN/original_image.jpg"
},
"userAssociatedAddresses": [
"0x53667ed77b56d5a94d6df994ab4fd142b7585e68",
"0x547a2e8d97dc99be21e509fa93c4fa5dd76b8ed0"
],
"followerCount": 16127,
"followingCount": 345
}
],
"warpcastUrl": "https://warpcast.com/~/channel/based-management"
}
]
getFarcasterChannelsByHost
You can fetch all the Farcaster channels of a given hosts by using the getFarcasterChannelsByHost
function:
import {
getFarcasterChannelsByHost,
FarcasterChannelsByHostInput,
FarcasterChannelsByHostOutput,
} from "@airstack/frog";
const input: FarcasterChannelsByHostInput = {
fid: 602,
createdAtTimestamp: {
after: "2024-02-01T00:00:00Z",
before: "2024-02-28T00:00:00Z",
},
limit: 1,
};
const { data, error }: FarcasterChannelsByHostOutput =
await getFarcasterChannelsByHost(input);
if (error) throw new Error(error);
console.log(data);
const { getFarcasterChannelsByHost } = require("@airstack/frog");
const input = {
fid: 602,
createdAtTimestamp: {
after: "2024-02-01T00:00:00Z",
before: "2024-02-28T00:00:00Z",
},
limit: 1,
};
const { data, error } = await getFarcasterChannelsByHost(input);
if (error) throw new Error(error);
console.log(data);
[
{
"name": "airstack",
"description": "a place for updates about new airstack functionality, user requests, questions, and more!",
"imageUrl": "https://i.imgur.com/13jY9D4.png",
"createdAtTimestamp": "2023-12-21T17:30:38Z",
"warpcastUrl": "https://warpcast.com/~/channel/airstack"
}
]
Developer Support
If you have any questions or need help regarding integrating onchain data to your Farcaster Frames using the Airstack Frog Recipe, please join our Airstack's Telegram group.
More Resources
Last updated