đFollowing
Learn how to fetch Web3 Social Following data and its various use cases and combinations.
Airstack provides easy-to-use APIs for enriching Web3 social applications with and integrating on-chain and off-chain data with Lens and Farcaster.
Table Of Contents
In this guide you will learn how to use Airstack to:
Pre-requisites
An Airstack account
Basic knowledge of GraphQL
Get Started
JavaScript/TypeScript/Python
If you are using JavaScript/TypeScript or Python, Install the Airstack SDK:
React
npm install @airstack/airstack-react
Node
npm install @airstack/node
React
yarn add @airstack/airstack-react
Node
yarn add @airstack/node
React
pnpm install @airstack/airstack-react
Node
pnpm install @airstack/node
pip install airstack
Then, add the following snippets to your code:
import { init, useQuery } from "@airstack/airstack-react";
init("YOUR_AIRSTACK_API_KEY");
const query = `YOUR_QUERY`; // Replace with GraphQL Query
const Component = () => {
const { data, loading, error } = useQuery(query);
if (data) {
return <p>Data: {JSON.stringify(data)}</p>;
}
if (loading) {
return <p>Loading...</p>;
}
if (error) {
return <p>Error: {error.message}</p>;
}
};
import { init, fetchQuery } from "@airstack/node";
init("YOUR_AIRSTACK_API_KEY");
const query = `YOUR_QUERY`; // Replace with GraphQL Query
const { data, error } = await fetchQuery(query);
console.log("data:", data);
console.log("error:", error);
import asyncio
from airstack.execute_query import AirstackClient
api_client = AirstackClient(api_key="YOUR_AIRSTACK_API_KEY")
query = """YOUR_QUERY""" # Replace with GraphQL Query
async def main():
execute_query_client = api_client.create_execute_query_object(
query=query)
query_response = await execute_query_client.execute_query()
print(query_response.data)
asyncio.run(main())
Other Programming Languages
To access the Airstack APIs in other languages, you can use https://api.airstack.xyz/gql as your GraphQL endpoint.
đ¤ AI Natural Languageâ
Airstack provides an AI solution for you to build GraphQL queries to fulfill your use case easily. You can find the AI prompt of each query in the demo's caption or title for yourself to try.
Get All Following of 0x Address(es)
You can get the list of following data of user(s) by inputting an array of 0x address(es):
Try Demo
Code
query MyQuery {
SocialFollowings(
input: {
filter: {
identity: { _in: ["0xeaf55242a90bb3289dB8184772b0B98562053559"] }
}
blockchain: ALL
limit: 200
}
) {
Following {
followingAddress {
addresses
domains {
name
}
socials {
dappName
profileName
profileTokenId
profileTokenIdHex
userId
userAssociatedAddresses
}
}
followingProfileId
followerAddress {
addresses
}
followerProfileId
followerTokenId
}
}
}
{
"data": {
"SocialFollowings": {
"Following": [
{
"followingAddress": {
"addresses": ["0xce8e9f29525e566db4d98fb22e156607b9b8109a"],
"domains": [],
"socials": [
{
"dappName": "farcaster",
"profileName": "nitesh",
"profileTokenId": "240",
"profileTokenIdHex": "0x0f0",
"userId": "240",
"userAssociatedAddresses": [
"0xce8e9f29525e566db4d98fb22e156607b9b8109a"
]
}
]
},
"followingProfileId": "240",
"followerAddress": {
"addresses": [
"0x66bd69c7064d35d146ca78e6b186e57679fba249",
"0xeaf55242a90bb3289db8184772b0b98562053559"
]
},
"followerProfileId": "602",
"followerTokenId": ""
}
// more following of 0xeaf55242a90bb3289dB8184772b0B98562053559
]
}
}
}
Get All Following of ENS Domain(s)
You can get the list of following data of user(s) by inputting an array of ENS domain(s):
Try Demo
Code
query MyQuery {
SocialFollowings(
input: {
filter: { identity: { _in: ["vitalik.eth"] } }
blockchain: ALL
limit: 200
}
) {
Following {
followingAddress {
addresses
domains {
name
}
socials {
dappName
profileName
profileTokenId
profileTokenIdHex
userId
userAssociatedAddresses
}
}
followingProfileId
followerAddress {
domains {
name
}
}
followerProfileId
followerTokenId
}
}
}
{
"data": {
"SocialFollowings": {
"Following": [
{
"followingAddress": {
"addresses": [
"0xf6fd7deec77d7b1061435585df1d7fdfd4682577",
"0x18b7511938fbe2ee08adf3d4a24edb00a5c9b783",
"0x925afeb19355e289ed1346ede709633ca8788b25",
"0x1040259f6fe4f1c6ed1044b9df6a8a4ebd2d3511"
],
"domains": [
{
"name": "cryptovenetian.eth"
},
{
"name": "phil.brightmoments.eth"
},
{
"name": "mohun.eth"
},
{
"name": "purple.philm.eth"
},
{
"name": "surrogatemint.eth"
},
{
"name": "cryptonewyorkers.eth"
},
{
"name": "lorensbags.eth"
},
{
"name": "pay.philmohun.eth"
}
],
"socials": [
{
"dappName": "farcaster",
"profileName": "phil",
"profileTokenId": "129",
"profileTokenIdHex": "0x081",
"userId": "129",
"userAssociatedAddresses": [
"0xf6fd7deec77d7b1061435585df1d7fdfd4682577",
"0x18b7511938fbe2ee08adf3d4a24edb00a5c9b783",
"0x925afeb19355e289ed1346ede709633ca8788b25",
"0x1040259f6fe4f1c6ed1044b9df6a8a4ebd2d3511"
]
}
]
},
"followingProfileId": "129",
"followerAddress": {
"domains": [
{
"name": "quantumexchange.eth"
},
{
"name": "7860000.eth"
},
{
"name": "offchainexample.eth"
},
{
"name": "brianshaw.eth"
},
{
"name": "vbuterin.stateofus.eth"
},
{
"name": "quantumsmartcontracts.eth"
},
{
"name": "Vitalik.eth"
},
{
"name": "openegp.eth"
},
{
"name": "vitalik.cannafam.eth"
},
{
"name": "VITALIK.eth"
},
{
"name": "quantumdapps.eth"
},
{
"name": "vitalik.soy.eth"
},
{
"name": "satoshinart.eth"
},
{
"name": "vitalik.eth"
},
{
"name": "eth.soy.eth"
},
{
"name": "vitalik.thepeople.eth"
},
{
"name": "vitalik.dev.eth"
},
{
"name": "vitalik.takoyaki.eth"
}
]
},
"followerProfileId": "5650",
"followerTokenId": ""
}
// more followers of vitalik.eth
]
}
}
}
Get All Following of Lens Profile(s)
You can get the list of following data of user(s) by inputting an array of either Lens profile handle or Lens profile ID (decimal or ):
Try Demo
Code
query MyQuery {
SocialFollowings(
input: {
filter: { identity: { _in: ["lens/@vitalik"] } }
blockchain: ALL
limit: 200
}
) {
Following {
followingAddress {
addresses
domains {
name
}
socials {
dappName
profileName
profileTokenId
profileTokenIdHex
userId
userAssociatedAddresses
}
}
followingProfileId
followerAddress {
socials(input: { filter: { dappName: { _eq: lens } } }) {
profileName
profileTokenId
profileTokenIdHex
}
}
followerProfileId
followerTokenId
}
}
}
{
"data": {
"SocialFollowings": {
"Following": [
{
"followingAddress": {
"addresses": [
"0xf6fd7deec77d7b1061435585df1d7fdfd4682577",
"0x18b7511938fbe2ee08adf3d4a24edb00a5c9b783",
"0x925afeb19355e289ed1346ede709633ca8788b25",
"0x1040259f6fe4f1c6ed1044b9df6a8a4ebd2d3511"
],
"domains": [
{
"name": "cryptovenetian.eth"
},
{
"name": "phil.brightmoments.eth"
},
{
"name": "mohun.eth"
},
{
"name": "purple.philm.eth"
},
{
"name": "surrogatemint.eth"
},
{
"name": "cryptonewyorkers.eth"
},
{
"name": "lorensbags.eth"
},
{
"name": "pay.philmohun.eth"
}
],
"socials": [
{
"dappName": "farcaster",
"profileName": "phil",
"profileTokenId": "129",
"profileTokenIdHex": "0x081",
"userId": "129",
"userAssociatedAddresses": [
"0xf6fd7deec77d7b1061435585df1d7fdfd4682577",
"0x18b7511938fbe2ee08adf3d4a24edb00a5c9b783",
"0x925afeb19355e289ed1346ede709633ca8788b25",
"0x1040259f6fe4f1c6ed1044b9df6a8a4ebd2d3511"
]
}
]
},
"followingProfileId": "129",
"followerAddress": {
"socials": [
{
"profileName": "lens/@vitalik",
"profileTokenId": "100275",
"profileTokenIdHex": "0x0187b3"
}
]
},
"followerProfileId": "5650",
"followerTokenId": ""
}
// more followers of lens/@vitalik
]
}
}
}
Get All Following of Farcaster User(s)
You can get the list of following data of user(s) by inputting an array of either Farcaster name or :
Try Demo
Code
query MyQuery {
SocialFollowings(
input: {
filter: { identity: { _in: ["fc_fname:vitalik.eth"] } }
blockchain: ALL
limit: 200
}
) {
Following {
followingAddress {
addresses
domains {
name
}
socials {
dappName
profileName
profileTokenId
profileTokenIdHex
userId
userAssociatedAddresses
}
}
followingProfileId
followerAddress {
addresses
socials(input: { filter: { dappName: { _eq: farcaster } } }) {
profileName
profileTokenId
profileTokenIdHex
}
}
followerProfileId
followerTokenId
}
}
}
{
"data": {
"SocialFollowings": {
"Following": [
{
"followingAddress": {
"addresses": [
"0xf6fd7deec77d7b1061435585df1d7fdfd4682577",
"0x18b7511938fbe2ee08adf3d4a24edb00a5c9b783",
"0x925afeb19355e289ed1346ede709633ca8788b25",
"0x1040259f6fe4f1c6ed1044b9df6a8a4ebd2d3511"
],
"domains": [
{
"name": "cryptovenetian.eth"
},
{
"name": "phil.brightmoments.eth"
},
{
"name": "mohun.eth"
},
{
"name": "purple.philm.eth"
},
{
"name": "surrogatemint.eth"
},
{
"name": "cryptonewyorkers.eth"
},
{
"name": "lorensbags.eth"
},
{
"name": "pay.philmohun.eth"
}
],
"socials": [
{
"dappName": "farcaster",
"profileName": "phil",
"profileTokenId": "129",
"profileTokenIdHex": "0x081",
"userId": "129",
"userAssociatedAddresses": [
"0xf6fd7deec77d7b1061435585df1d7fdfd4682577",
"0x18b7511938fbe2ee08adf3d4a24edb00a5c9b783",
"0x925afeb19355e289ed1346ede709633ca8788b25",
"0x1040259f6fe4f1c6ed1044b9df6a8a4ebd2d3511"
]
}
]
},
"followingProfileId": "129",
"followerAddress": {
"addresses": [
"0xadd746be46ff36f10c81d6e3ba282537f4c68077",
"0xd8da6bf26964af9d7eed9e03e53415d37aa96045"
],
"socials": [
{
"profileName": "vitalik.eth",
"profileTokenId": "5650",
"profileTokenIdHex": "0x01612"
}
]
},
"followerProfileId": "5650",
"followerTokenId": ""
}
// more followers of Farcaster user vitalik.eth
]
}
}
}
Check If User A Is Following User B
This can be done by providing the user B's identiy either a 0x address, ENS, cb.id, Lens, or Farcaster on the Wallet
top-level query's identity
input and the user A's identities in the socialFollowings
.
For example, check if betashop.eth
(user A) is following ipeciura.eth
(user B):
Try Demo
Code
If you need to check multiple users A simultaneously, then simply provide more identities into the identity
input in the socialFollowings
nested API.
query isFollowing { # Top-level is User B's Identity (ipeciura.eth)
Wallet(input: {identity: "ipeciura.eth", blockchain: ethereum}) {
socialFollowings( # Here is User A's Identity (betashop.eth)
input: {filter: {identity: {_in: ["betashop.eth"]}}}
) {
Following {
dappName
dappSlug
followingProfileId
followerProfileId
followerAddress {
addresses
socials {
dappName
profileName
}
domains {
name
}
}
}
}
}
}
{
"data": {
"Wallet": {
"socialFollowings": {
"Following": [
{
"dappName": "farcaster", // following on Farcaster
"dappSlug": "farcaster_optimism",
"followingProfileId": "2602",
"followerProfileId": "602",
"followerAddress": {
"addresses": [
"0x66bd69c7064d35d146ca78e6b186e57679fba249",
"0xeaf55242a90bb3289db8184772b0b98562053559"
],
"socials": [
{
"dappName": "farcaster",
"profileName": "betashop.eth" // betashop.eth is following ipeciura.eth
},
{
"dappName": "lens",
"profileName": "lens/@betashop9"
}
],
"domains": [
{
"name": "jasongoldberg.eth"
},
{
"name": "betashop.eth"
}
]
}
}
]
}
}
}
}
If betashop.eth
is following ipeciura.eth
on either Lens or Farcaster, then it will appear as a response in the Following
array as shown in the sample response and thus should be classified as a known sender.
Otherwise, betashop.eth
will be considered an unknown sender and should be classified as one in the UI.
Get The Most Recent Following of User(s)
You can get the list of most recent following of user(s):
Try Demo
Code
query MyQuery {
SocialFollowings(
input: {
filter: {
identity: {
_in: [
"lens/@stani"
"lens_id:0x024"
"fc_fname:dwr.eth"
"fc_fid:3"
"vitalik.eth"
"0xeaf55242a90bb3289dB8184772b0B98562053559"
]
}
}
blockchain: ALL
limit: 200
order: { followingSince: DESC }
}
) {
Following {
followingAddress {
addresses
domains {
name
}
socials {
dappName
profileName
profileTokenId
profileTokenIdHex
userId
userAssociatedAddresses
}
}
followingProfileId
followerAddress {
addresses
domains {
name
}
socials {
dappName
profileName
profileTokenId
profileTokenIdHex
userId
userAssociatedAddresses
}
}
followerProfileId
followerTokenId
}
}
}
{
"data": {
"SocialFollowings": {
"Following": [
{
"followingAddress": {
"addresses": [
"0xba88168abd7e9d53a03be6ec63f6ed30d466c451",
"0xbbd8f1ca6688e06bf19ad10067a14bbef9881753"
],
"domains": [
{
"name": "hirsh.eth"
}
],
"socials": [
{
"dappName": "lens",
"profileName": "lens/@hirsh",
"profileTokenId": "15280",
"profileTokenIdHex": "0x03bb0",
"userId": "0xba88168abd7e9d53a03be6ec63f6ed30d466c451",
"userAssociatedAddresses": [
"0xba88168abd7e9d53a03be6ec63f6ed30d466c451"
]
},
{
"dappName": "farcaster",
"profileName": "hirsh",
"profileTokenId": "989",
"profileTokenIdHex": "0x03dd",
"userId": "989",
"userAssociatedAddresses": [
"0xba88168abd7e9d53a03be6ec63f6ed30d466c451",
"0xbbd8f1ca6688e06bf19ad10067a14bbef9881753"
]
}
]
},
"followingProfileId": "989",
"followerAddress": {
"addresses": [
"0x66bd69c7064d35d146ca78e6b186e57679fba249",
"0xeaf55242a90bb3289db8184772b0b98562053559"
],
"domains": [
{
"name": "jasongoldberg.eth"
},
{
"name": "betashop.eth"
}
],
"socials": [
{
"dappName": "farcaster",
"profileName": "betashop.eth",
"profileTokenId": "602",
"profileTokenIdHex": "0x025a",
"userId": "602",
"userAssociatedAddresses": [
"0x66bd69c7064d35d146ca78e6b186e57679fba249",
"0xeaf55242a90bb3289db8184772b0b98562053559"
]
},
{
"dappName": "lens",
"profileName": "lens/@betashop9",
"profileTokenId": "94472",
"profileTokenIdHex": "0x017108",
"userId": "0xeaf55242a90bb3289db8184772b0b98562053559",
"userAssociatedAddresses": [
"0xeaf55242a90bb3289db8184772b0b98562053559"
]
}
]
},
"followerProfileId": "602",
"followerTokenId": ""
}
// more following
]
}
}
}
Get The Earliest Following of User(s)
You can get the list of the earliest following of user(s):
Try Demo
Code
query MyQuery {
SocialFollowings(
input: {
filter: {
identity: {
_in: [
"lens/@stani"
"lens_id:0x024"
"fc_fname:dwr.eth"
"fc_fid:3"
"vitalik.eth"
"0xeaf55242a90bb3289dB8184772b0B98562053559"
]
}
}
blockchain: ALL
limit: 200
order: { followingSince: ASC }
}
) {
Following {
followingAddress {
addresses
domains {
name
}
socials {
dappName
profileName
profileTokenId
profileTokenIdHex
userId
userAssociatedAddresses
}
}
followingProfileId
followerAddress {
addresses
domains {
name
}
socials {
dappName
profileName
profileTokenId
profileTokenIdHex
userId
userAssociatedAddresses
}
}
followerProfileId
followerTokenId
}
}
}
{
"data": {
"SocialFollowings": {
"Following": [
{
"followingAddress": {
"addresses": [
"0xe978bdbc3347feb6ed10c9845bbdc298604f80ca",
"0x71503b1309d6797bc4c4fbfde973adc2c191834b",
"0xe0f35f554937d21ddb9e0f83b1436053e33634b9"
],
"domains": [],
"socials": [
{
"dappName": "farcaster",
"profileName": "ace",
"profileTokenId": "539",
"profileTokenIdHex": "0x021b",
"userId": "539",
"userAssociatedAddresses": [
"0xe978bdbc3347feb6ed10c9845bbdc298604f80ca",
"0x71503b1309d6797bc4c4fbfde973adc2c191834b",
"0xe0f35f554937d21ddb9e0f83b1436053e33634b9"
]
},
{
"dappName": "lens",
"profileName": "lens/@alexkwon",
"profileTokenId": "105611",
"profileTokenIdHex": "0x019c8b",
"userId": "0xe978bdbc3347feb6ed10c9845bbdc298604f80ca",
"userAssociatedAddresses": [
"0xe978bdbc3347feb6ed10c9845bbdc298604f80ca"
]
}
]
},
"followingProfileId": "539",
"followerAddress": {
"addresses": [
"0x66bd69c7064d35d146ca78e6b186e57679fba249",
"0xeaf55242a90bb3289db8184772b0b98562053559"
],
"domains": [
{
"name": "jasongoldberg.eth"
},
{
"name": "betashop.eth"
}
],
"socials": [
{
"dappName": "farcaster",
"profileName": "betashop.eth",
"profileTokenId": "602",
"profileTokenIdHex": "0x025a",
"userId": "602",
"userAssociatedAddresses": [
"0x66bd69c7064d35d146ca78e6b186e57679fba249",
"0xeaf55242a90bb3289db8184772b0b98562053559"
]
},
{
"dappName": "lens",
"profileName": "lens/@betashop9",
"profileTokenId": "94472",
"profileTokenIdHex": "0x017108",
"userId": "0xeaf55242a90bb3289db8184772b0b98562053559",
"userAssociatedAddresses": [
"0xeaf55242a90bb3289db8184772b0b98562053559"
]
}
]
},
"followerProfileId": "602",
"followerTokenId": ""
}
// more following
]
}
}
}
Get Following of User(s) that has ENS Domain
You can get the list of all following of user(s) and check if they have any ENS domain:
Try Demo
Code
query MyQuery {
SocialFollowings(
input: {filter: {identity: {_in: ["lens/@stani", "lens_id:0x024", "fc_fname:dwr.eth", "fc_fid:3", "vitalik.eth", "0xeaf55242a90bb3289dB8184772b0B98562053559"]}}, blockchain: ALL, limit: 200}
) {
Following {
followingAddress {
addresses
domains { # Show all domains owned by followers
name
isPrimary
}
socials {
dappName
profileName
profileTokenId
profileTokenIdHex
userId
userAssociatedAddresses
}
}
followingProfileId
followerAddress {
addresses
domains {
name
}
socials {
dappName
profileName
profileTokenId
profileTokenIdHex
userId
userAssociatedAddresses
}
}
followerProfileId
followerTokenId
}
}
}
{
"data": {
"SocialFollowings": {
"Following": [
{
"followingAddress": {
"addresses": [
"0x5beaf49e8ee203ef1023e9b1b716c07016f399a1",
"0x223f2db258234f7fa164a9e4c0929318feb3b550"
],
"domains": [
{
"name": "victorma.eth", // Indicate that following have ENS domain
"isPrimary": true
}
],
"socials": [
{
"dappName": "farcaster",
"profileName": "vm",
"profileTokenId": "325",
"profileTokenIdHex": "0x0145",
"userId": "325",
"userAssociatedAddresses": [
"0x5beaf49e8ee203ef1023e9b1b716c07016f399a1",
"0x223f2db258234f7fa164a9e4c0929318feb3b550"
]
},
{
"dappName": "lens",
"profileName": "lens/@victorma",
"profileTokenId": "118319",
"profileTokenIdHex": "0x01ce2f",
"userId": "0x223f2db258234f7fa164a9e4c0929318feb3b550",
"userAssociatedAddresses": [
"0x223f2db258234f7fa164a9e4c0929318feb3b550"
]
}
]
},
"followingProfileId": "325",
"followerAddress": {
"addresses": [
"0xb877f7bb52d28f06e60f557c00a56225124b357f",
"0xa14b4c95b5247199d74c5578531b4887ca5e4909",
"0xd7029bdea1c17493893aafe29aad69ef892b8ff2",
"0x74232bf61e994655592747e20bdf6fa9b9476f79"
],
"domains": [
{
"name": "dwr.eth"
},
{
"name": "noun124.eth"
},
{
"name": "dwr.mirror.xyz"
},
{
"name": "danromero.eth"
}
],
"socials": [
{
"dappName": "lens",
"profileName": "lens/@danromero",
"profileTokenId": "46189",
"profileTokenIdHex": "0x0b46d",
"userId": "0xd7029bdea1c17493893aafe29aad69ef892b8ff2",
"userAssociatedAddresses": [
"0xd7029bdea1c17493893aafe29aad69ef892b8ff2"
]
},
{
"dappName": "farcaster",
"profileName": "dwr.eth",
"profileTokenId": "3",
"profileTokenIdHex": "0x03",
"userId": "3",
"userAssociatedAddresses": [
"0xb877f7bb52d28f06e60f557c00a56225124b357f",
"0xa14b4c95b5247199d74c5578531b4887ca5e4909",
"0xd7029bdea1c17493893aafe29aad69ef892b8ff2",
"0x74232bf61e994655592747e20bdf6fa9b9476f79"
]
}
]
},
"followerProfileId": "3",
"followerTokenId": ""
},
// more following
]
}
}
}
You can use the followingAddress.domains
that will return an array to see if there's any domain owned by the following.
If the length of the followingAddress.domains
array is non-zero, then the following has at least one ENS domain. Otherwise, it does not have any ENS domain.
Get Following of User(s) that has XMTP Enabled
You can get the list of all following of user(s) and check if they have XMTP enabled:
Try Demo
Code
query MyQuery {
SocialFollowings(
input: {filter: {identity: {_in: ["lens/@stani", "lens_id:0x024", "fc_fname:dwr.eth", "fc_fid:3", "vitalik.eth", "0xeaf55242a90bb3289dB8184772b0B98562053559"]}}, blockchain: ALL, limit: 200}
) {
Following {
followingAddress {
addresses
domains {
name
}
socials {
dappName
profileName
profileTokenId
profileTokenIdHex
userId
userAssociatedAddresses
}
xmtp {
isXMTPEnabled # Indicate if following have XMTP enabled
}
}
followingProfileId
followerAddress {
addresses
domains {
name
}
socials {
dappName
profileName
profileTokenId
profileTokenIdHex
userId
userAssociatedAddresses
}
}
followerProfileId
followerTokenId
}
}
}
{
"data": {
"SocialFollowings": {
"Following": [
{
"followingAddress": {
"addresses": [
"0x5beaf49e8ee203ef1023e9b1b716c07016f399a1",
"0x223f2db258234f7fa164a9e4c0929318feb3b550"
],
"domains": [
{
"name": "victorma.eth"
}
],
"socials": [
{
"dappName": "farcaster",
"profileName": "vm",
"profileTokenId": "325",
"profileTokenIdHex": "0x0145",
"userId": "325",
"userAssociatedAddresses": [
"0x5beaf49e8ee203ef1023e9b1b716c07016f399a1",
"0x223f2db258234f7fa164a9e4c0929318feb3b550"
]
},
{
"dappName": "lens",
"profileName": "lens/@victorma",
"profileTokenId": "118319",
"profileTokenIdHex": "0x01ce2f",
"userId": "0x223f2db258234f7fa164a9e4c0929318feb3b550",
"userAssociatedAddresses": [
"0x223f2db258234f7fa164a9e4c0929318feb3b550"
]
}
],
"xmtp": [
{
"isXMTPEnabled": true // Indicate that XMTP is enabled
}
]
},
"followingProfileId": "325",
"followerAddress": {
"addresses": [
"0xb877f7bb52d28f06e60f557c00a56225124b357f",
"0xa14b4c95b5247199d74c5578531b4887ca5e4909",
"0xd7029bdea1c17493893aafe29aad69ef892b8ff2",
"0x74232bf61e994655592747e20bdf6fa9b9476f79"
],
"domains": [
{
"name": "dwr.eth"
},
{
"name": "noun124.eth"
},
{
"name": "dwr.mirror.xyz"
},
{
"name": "danromero.eth"
}
],
"socials": [
{
"dappName": "lens",
"profileName": "lens/@danromero",
"profileTokenId": "46189",
"profileTokenIdHex": "0x0b46d",
"userId": "0xd7029bdea1c17493893aafe29aad69ef892b8ff2",
"userAssociatedAddresses": [
"0xd7029bdea1c17493893aafe29aad69ef892b8ff2"
]
},
{
"dappName": "farcaster",
"profileName": "dwr.eth",
"profileTokenId": "3",
"profileTokenIdHex": "0x03",
"userId": "3",
"userAssociatedAddresses": [
"0xb877f7bb52d28f06e60f557c00a56225124b357f",
"0xa14b4c95b5247199d74c5578531b4887ca5e4909",
"0xd7029bdea1c17493893aafe29aad69ef892b8ff2",
"0x74232bf61e994655592747e20bdf6fa9b9476f79"
]
}
]
},
"followerProfileId": "3",
"followerTokenId": ""
},
// more following
]
}
}
}JSON
Get Users that have a certain amount of Following
You can get the list of all users that have certain amount of following, e.g. at least 1000 following:
Try Demo
Code
query MyQuery {
Socials(
input: {
filter: { followingCount: { _gte: 1000 } }
blockchain: ethereum
limit: 200
}
) {
Social {
dappName
profileName
profileTokenId
profileTokenIdHex
userId
userAssociatedAddresses
followingCount
}
}
}
{
"data": {
"Socials": {
"Social": [
{
"dappName": "farcaster",
"profileName": "jayme",
"profileTokenId": "373",
"profileTokenIdHex": "0x0175",
"userId": "373",
"userAssociatedAddresses": [
"0x9eab9d856a3a667dc4cd10001d59c679c64756e7",
"0x1ca66c990e86b750ea6b2180d17fff89273a5c0d"
],
"followingCount": 1445
},
{
"dappName": "farcaster",
"profileName": "aydasayer",
"profileTokenId": "14993",
"profileTokenIdHex": "0x03a91",
"userId": "14993",
"userAssociatedAddresses": [
"0x022fe87e83f3d6662862ed51ef74de33ed16ff25",
"0xf009162e2495dd1dd54b5470e03004010f931a9f"
],
"followingCount": 1245
},
{
"dappName": "farcaster",
"profileName": "reiri",
"profileTokenId": "17626",
"profileTokenIdHex": "0x044da",
"userId": "17626",
"userAssociatedAddresses": [
"0x5f948ad313f280eb71d038f72d932f3b335458de",
"0x688d0cef9d2ad572e2b889ea595a042a1821e5ff"
],
"followingCount": 1054
}
]
}
}
}
Get All Following of User(s) that Hold ERC20 Token(s)
You can get the list of all following of user(s) and check if they hold ERC20 token(s), e.g. USDC:
Try Demo
Code
query MyQuery {
SocialFollowings(
input: {
filter: {
identity: {
_in: [
"lens/@stani"
"lens_id:0x024"
"fc_fname:dwr.eth"
"fc_fid:3"
"vitalik.eth"
"0xeaf55242a90bb3289dB8184772b0B98562053559"
]
}
}
blockchain: ALL
limit: 200
}
) {
Following {
followingAddress {
addresses
domains {
name
}
socials {
dappName
profileName
profileTokenId
profileTokenIdHex
userId
userAssociatedAddresses
}
tokenBalances(
input: {
filter: {
tokenAddress: {
_in: ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]
}
tokenType: { _eq: ERC20 }
}
}
) {
formattedAmount
}
}
followingProfileId
followerAddress {
addresses
domains {
name
}
socials {
dappName
profileName
profileTokenId
profileTokenIdHex
userId
userAssociatedAddresses
}
}
followerProfileId
followerTokenId
}
}
}
{
"data": {
"SocialFollowings": {
"Following": [
{
"followingAddress": {
"addresses": [
"0x5beaf49e8ee203ef1023e9b1b716c07016f399a1",
"0x223f2db258234f7fa164a9e4c0929318feb3b550"
],
"domains": [
{
"name": "victorma.eth"
}
],
"socials": [
{
"dappName": "farcaster",
"profileName": "vm",
"profileTokenId": "325",
"profileTokenIdHex": "0x0145",
"userId": "325",
"userAssociatedAddresses": [
"0x5beaf49e8ee203ef1023e9b1b716c07016f399a1",
"0x223f2db258234f7fa164a9e4c0929318feb3b550"
]
},
{
"dappName": "lens",
"profileName": "lens/@victorma",
"profileTokenId": "118319",
"profileTokenIdHex": "0x01ce2f",
"userId": "0x223f2db258234f7fa164a9e4c0929318feb3b550",
"userAssociatedAddresses": [
"0x223f2db258234f7fa164a9e4c0929318feb3b550"
]
}
],
"tokenBalances": [
{
"formattedAmount": 12 // Indicate following has 12 USDC
}
]
},
"followingProfileId": "325",
"followerAddress": {
"addresses": [
"0xb877f7bb52d28f06e60f557c00a56225124b357f",
"0xa14b4c95b5247199d74c5578531b4887ca5e4909",
"0xd7029bdea1c17493893aafe29aad69ef892b8ff2",
"0x74232bf61e994655592747e20bdf6fa9b9476f79"
],
"domains": [
{
"name": "dwr.eth"
},
{
"name": "noun124.eth"
},
{
"name": "dwr.mirror.xyz"
},
{
"name": "danromero.eth"
}
],
"socials": [
{
"dappName": "lens",
"profileName": "lens/@danromero",
"profileTokenId": "46189",
"profileTokenIdHex": "0x0b46d",
"userId": "0xd7029bdea1c17493893aafe29aad69ef892b8ff2",
"userAssociatedAddresses": [
"0xd7029bdea1c17493893aafe29aad69ef892b8ff2"
]
},
{
"dappName": "farcaster",
"profileName": "dwr.eth",
"profileTokenId": "3",
"profileTokenIdHex": "0x03",
"userId": "3",
"userAssociatedAddresses": [
"0xb877f7bb52d28f06e60f557c00a56225124b357f",
"0xa14b4c95b5247199d74c5578531b4887ca5e4909",
"0xd7029bdea1c17493893aafe29aad69ef892b8ff2",
"0x74232bf61e994655592747e20bdf6fa9b9476f79"
]
}
]
},
"followerProfileId": "3",
"followerTokenId": ""
},
// more following
]
}
}
}
Get All Following of User(s) that Hold ERC721/1155 NFT(s)
You can get the list of all following of user(s) and check if they hold ERC721/1155 NFT(s), BAYC:
Try Demo
Code
query MyQuery {
SocialFollowings(
input: {
filter: {
identity: {
_in: [
"lens/@stani"
"lens_id:0x024"
"fc_fname:dwr.eth"
"fc_fid:3"
"vitalik.eth"
"0xeaf55242a90bb3289dB8184772b0B98562053559"
]
}
}
blockchain: ALL
limit: 200
}
) {
Following {
followingAddress {
addresses
domains {
name
}
socials {
dappName
profileName
profileTokenId
profileTokenIdHex
userId
userAssociatedAddresses
}
tokenBalances(
input: {
filter: {
tokenAddress: {
_in: ["0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D"]
}
tokenType: { _in: [ERC721, ERC1155] }
}
}
) {
formattedAmount
}
}
followingProfileId
followerAddress {
addresses
domains {
name
}
socials {
dappName
profileName
profileTokenId
profileTokenIdHex
userId
userAssociatedAddresses
}
}
followerProfileId
followerTokenId
}
}
}
{
"data": {
"SocialFollowings": {
"Following": [
{
"followingAddress": {
"addresses": [
"0xb5b2da92350efdc6250b74bccf24f4ec9e5bb0ce",
"0x695626a661831a618ae846482fe8abf6c8d4529c"
],
"domains": [
{
"name": "ivanhodl.eth"
}
],
"socials": [
{
"dappName": "farcaster",
"profileName": "ivanhodl",
"profileTokenId": "14240",
"profileTokenIdHex": "0x037a0",
"userId": "14240",
"userAssociatedAddresses": [
"0xb5b2da92350efdc6250b74bccf24f4ec9e5bb0ce",
"0x695626a661831a618ae846482fe8abf6c8d4529c"
]
}
],
"tokenBalances": [
{
"formattedAmount": 1
},
{
"formattedAmount": 1
}
]
},
"followingProfileId": "14240",
"followerAddress": {
"addresses": [
"0x66bd69c7064d35d146ca78e6b186e57679fba249",
"0xeaf55242a90bb3289db8184772b0b98562053559"
],
"domains": [
{
"name": "jasongoldberg.eth"
},
{
"name": "betashop.eth"
}
],
"socials": [
{
"dappName": "farcaster",
"profileName": "betashop.eth",
"profileTokenId": "602",
"profileTokenIdHex": "0x025a",
"userId": "602",
"userAssociatedAddresses": [
"0x66bd69c7064d35d146ca78e6b186e57679fba249",
"0xeaf55242a90bb3289db8184772b0b98562053559"
]
},
{
"dappName": "lens",
"profileName": "lens/@betashop9",
"profileTokenId": "94472",
"profileTokenIdHex": "0x017108",
"userId": "0xeaf55242a90bb3289db8184772b0b98562053559",
"userAssociatedAddresses": [
"0xeaf55242a90bb3289db8184772b0b98562053559"
]
}
]
},
"followerProfileId": "602",
"followerTokenId": ""
}
// more following
]
}
}
}
Get All Following of User(s) that Hold POAP(s)
You can get the list of all following of user(s) and check if they hold POAP(s), e.g. EthCC[6] â Attendee:
Try Demo
Code
query MyQuery {
SocialFollowings(
input: {
filter: {
identity: {
_in: [
"lens/@stani"
"lens_id:0x024"
"fc_fname:dwr.eth"
"fc_fid:3"
"vitalik.eth"
"0xeaf55242a90bb3289dB8184772b0B98562053559"
]
}
}
blockchain: ALL
limit: 200
}
) {
Following {
followingAddress {
addresses
domains {
name
}
socials {
dappName
profileName
profileTokenId
profileTokenIdHex
userId
userAssociatedAddresses
}
poaps(input: { filter: { eventId: { _eq: "141910" } } }) {
mintHash
mintOrder
}
}
followingProfileId
followerAddress {
addresses
domains {
name
}
socials {
dappName
profileName
profileTokenId
profileTokenIdHex
userId
userAssociatedAddresses
}
}
followerProfileId
followerTokenId
}
}
}
{
"data": {
"SocialFollowings": {
"Following": [
{
"followingAddress": {
"addresses": [
"0xe241fedafe4938a6e0381c792d5abc7703de3062",
"0x915aa445720020eb1a59151e831111369b08e118"
],
"domains": [
{
"name": "barnabe.eth"
},
{
"name": "monnot.eth"
},
{
"name": "barnabemonnot.eth"
}
],
"socials": [
{
"dappName": "farcaster",
"profileName": "barnabe",
"profileTokenId": "5451",
"profileTokenIdHex": "0x0154b",
"userId": "5451",
"userAssociatedAddresses": [
"0xe241fedafe4938a6e0381c792d5abc7703de3062",
"0x915aa445720020eb1a59151e831111369b08e118"
]
}
],
"poaps": [
// Indicate that follower attended EthCC[6]
{
"mintHash": "0xd4d5edd4c98d8f9dacf09b2a248e9851a7da794a1c3ee71fec22e0b35135b6ea",
"mintOrder": 1225
}
]
},
"followingProfileId": "5451",
"followerAddress": {
"addresses": [
"0xb877f7bb52d28f06e60f557c00a56225124b357f",
"0xa14b4c95b5247199d74c5578531b4887ca5e4909",
"0xd7029bdea1c17493893aafe29aad69ef892b8ff2",
"0x74232bf61e994655592747e20bdf6fa9b9476f79"
],
"domains": [
{
"name": "dwr.eth"
},
{
"name": "noun124.eth"
},
{
"name": "dwr.mirror.xyz"
},
{
"name": "danromero.eth"
}
],
"socials": [
{
"dappName": "lens",
"profileName": "lens/@danromero",
"profileTokenId": "46189",
"profileTokenIdHex": "0x0b46d",
"userId": "0xd7029bdea1c17493893aafe29aad69ef892b8ff2",
"userAssociatedAddresses": [
"0xd7029bdea1c17493893aafe29aad69ef892b8ff2"
]
},
{
"dappName": "farcaster",
"profileName": "dwr.eth",
"profileTokenId": "3",
"profileTokenIdHex": "0x03",
"userId": "3",
"userAssociatedAddresses": [
"0xb877f7bb52d28f06e60f557c00a56225124b357f",
"0xa14b4c95b5247199d74c5578531b4887ca5e4909",
"0xd7029bdea1c17493893aafe29aad69ef892b8ff2",
"0x74232bf61e994655592747e20bdf6fa9b9476f79"
]
}
]
},
"followerProfileId": "3",
"followerTokenId": ""
},
// more following
]
}
}
}
Get All Following of User(s) that Hold Certain Amount of ERC20 Token(s)
You can get the list of all following of user(s) and check if they hold a certain amount of ERC20 token(s), e.g. hold at least 1000 USDC:
Try Demo
Code
query MyQuery {
SocialFollowings(
input: {
filter: {
identity: {
_in: [
"lens/@stani"
"lens_id:0x024"
"fc_fname:dwr.eth"
"fc_fid:3"
"vitalik.eth"
"0xeaf55242a90bb3289dB8184772b0B98562053559"
]
}
}
blockchain: ALL
limit: 200
}
) {
Following {
followingAddress {
addresses
domains {
name
}
socials {
dappName
profileName
profileTokenId
profileTokenIdHex
userId
userAssociatedAddresses
}
tokenBalances(
input: {
filter: {
tokenAddress: {
_in: ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]
}
tokenType: { _eq: ERC20 }
formattedAmount: { _gte: 1000 }
}
}
) {
formattedAmount
}
}
followingProfileId
followerAddress {
addresses
domains {
name
}
socials {
dappName
profileName
profileTokenId
profileTokenIdHex
userId
userAssociatedAddresses
}
}
followerProfileId
followerTokenId
}
}
}
{
"data": {
"SocialFollowings": {
"Following": [
{
"followingAddress": {
"addresses": [
"0x30a838dfc03968b5e0a64796547db42f64aa4de5",
"0xf0fbaaa7ece80ac41508e442929b81a4c8c8543b"
],
"domains": [
{
"name": "joycelai.eth"
},
{
"name": "joyce.9dcc.eth"
},
{
"name": "mycharisma.eth"
}
],
"socials": [
{
"dappName": "farcaster",
"profileName": "0xjoyce",
"profileTokenId": "1660",
"profileTokenIdHex": "0x067c",
"userId": "1660",
"userAssociatedAddresses": [
"0x30a838dfc03968b5e0a64796547db42f64aa4de5",
"0xf0fbaaa7ece80ac41508e442929b81a4c8c8543b"
]
},
{
"dappName": "lens",
"profileName": "lens/@joycelai",
"profileTokenId": "893",
"profileTokenIdHex": "0x037d",
"userId": "0xf0fbaaa7ece80ac41508e442929b81a4c8c8543b",
"userAssociatedAddresses": [
"0xf0fbaaa7ece80ac41508e442929b81a4c8c8543b"
]
}
],
"tokenBalances": [
{
"formattedAmount": 3283.180666
}
]
},
"followingProfileId": "1660",
"followerAddress": {
"addresses": [
"0xb877f7bb52d28f06e60f557c00a56225124b357f",
"0xa14b4c95b5247199d74c5578531b4887ca5e4909",
"0xd7029bdea1c17493893aafe29aad69ef892b8ff2",
"0x74232bf61e994655592747e20bdf6fa9b9476f79"
],
"domains": [
{
"name": "dwr.eth"
},
{
"name": "noun124.eth"
},
{
"name": "dwr.mirror.xyz"
},
{
"name": "danromero.eth"
}
],
"socials": [
{
"dappName": "lens",
"profileName": "lens/@danromero",
"profileTokenId": "46189",
"profileTokenIdHex": "0x0b46d",
"userId": "0xd7029bdea1c17493893aafe29aad69ef892b8ff2",
"userAssociatedAddresses": [
"0xd7029bdea1c17493893aafe29aad69ef892b8ff2"
]
},
{
"dappName": "farcaster",
"profileName": "dwr.eth",
"profileTokenId": "3",
"profileTokenIdHex": "0x03",
"userId": "3",
"userAssociatedAddresses": [
"0xb877f7bb52d28f06e60f557c00a56225124b357f",
"0xa14b4c95b5247199d74c5578531b4887ca5e4909",
"0xd7029bdea1c17493893aafe29aad69ef892b8ff2",
"0x74232bf61e994655592747e20bdf6fa9b9476f79"
]
}
]
},
"followerProfileId": "3",
"followerTokenId": ""
}
// more following
]
}
}
}
Developer Support
If you have any questions or need help regarding fetching Lens Followings data, please join our Airstack's Telegram group.
More Resources
Last updated
Was this helpful?