đŸĢ‚Followers

Learn how to fetch Web3 Social Followers 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

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>;
  }
};

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 Followers of 0x Address(es)

You can get the list of followers data of user(s) by inputting an array of :

Try Demo

Show me all followers of 0xeaf55242a90bb3289dB8184772b0B98562053559

Code

query MyQuery {
  SocialFollowers(
    input: {
      filter: {
        identity: { _in: ["0xeaf55242a90bb3289dB8184772b0B98562053559"] }
      }
      blockchain: ALL
      limit: 200
    }
  ) {
    Follower {
      followerAddress {
        addresses
        domains {
          name
        }
        socials {
          dappName
          profileName
          profileTokenId
          profileTokenIdHex
          userId
          userAssociatedAddresses
        }
      }
      followerProfileId
      followerTokenId
      followingAddress {
        addresses
      }
      followingProfileId
    }
  }
}

Get All Followers of ENS Domain(s)

You can get the list of all follower of ENS domains(s) by providing ENS domain name:

Try Demo

Show me all followers of vitalik.eth

Code

query MyQuery {
  SocialFollowers(
    input: {
      filter: { identity: { _in: ["vitalik.eth"] } }
      blockchain: ALL
      limit: 200
    }
  ) {
    Follower {
      followerAddress {
        addresses
        domains {
          name
        }
        socials {
          dappName
          profileName
          profileTokenId
          profileTokenIdHex
          userId
          userAssociatedAddresses
        }
      }
      followerProfileId
      followerTokenId
      followingAddress {
        domains {
          name
        }
      }
      followingProfileId
    }
  }
}

Get All Followers of Lens Profile(s)

You can get the list of all followers of Lens profile(s) by providing either or Lens profile ID:

Try Demo

Code

query MyQuery {
  SocialFollowers(
    input: {
      filter: { identity: { _in: ["lens/@vitalik"] } }
      blockchain: ALL
      limit: 200
    }
  ) {
    Follower {
      followerAddress {
        addresses
        domains {
          name
        }
        socials {
          dappName
          profileName
          profileTokenId
          profileTokenIdHex
          userId
          userAssociatedAddresses
        }
      }
      followerProfileId
      followerTokenId
      followingAddress {
        socials(input: { filter: { dappName: { _eq: lens } } }) {
          profileName
          profileTokenId
          profileTokenIdHex
        }
      }
      followingProfileId
    }
  }
}

Get All Followers of Farcaster User(s)

You can get the list of followers of Farcaster user(s) by either providing either or Farcaster ID:

Try Demo

Show me all followers of Farcaster user vitalik.eth

Code

query MyQuery {
  SocialFollowers(
    input: {
      filter: { identity: { _in: ["fc_fname:vitalik.eth"] } }
      blockchain: ALL
      limit: 200
    }
  ) {
    Follower {
      followerAddress {
        addresses
        domains {
          name
        }
        socials {
          dappName
          profileName
          profileTokenId
          profileTokenIdHex
          userId
          userAssociatedAddresses
        }
      }
      followerProfileId
      followerTokenId
      followingAddress {
        addresses
        socials(input: { filter: { dappName: { _eq: farcaster } } }) {
          profileName
          profileTokenId
          profileTokenIdHex
        }
      }
      followingProfileId
    }
  }
}

Check If User A Is Followed By User B

This can be done by providing the user B's identity 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 socialFollowers.

For example, check if betashop.eth (user A) is followed by ipeciura.eth (user B):

Try Demo

Show me if betashop.eth is being followed by ipeciura.eth

Code

If you need to check multiple users A simultaneously, then simply provide more identities into the identity input in the socialFollowers nested API.

query isFollowing { # Top-level is User B's Identity (ipeciura.eth)
  Wallet(input: {identity: "ipeciura.eth", blockchain: ethereum}) {
    socialFollowers( # Here is User A's Identity (betashop.eth)
      input: {filter: {identity: {_in: ["betashop.eth"]}}}
    ) {
      Follower {
        dappName
        dappSlug
        followingProfileId
        followerProfileId
        followingAddress {
          addresses
          socials {
            dappName
            profileName
          }
          domains {
            name
          }
        }
      }
    }
  }
}

If betashop.eth is followed by ipeciura.eth on either Lens or Farcaster, then it will appear as a response in the Follower 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 Followers of User(s)

You can get the list of most recent followers of users(s) by providing either 0x addresses, ENS names, Lens profiles, or Farcasters:

Try Demo

Show me the most recent followers of an array of users

Code

query MyQuery {
  SocialFollowers(
    input: {
      filter: {
        identity: {
          _in: [
            "lens/@stani"
            "lens_id:0x024"
            "fc_fname:dwr.eth"
            "fc_fid:3"
            "vitalik.eth"
            "0xeaf55242a90bb3289dB8184772b0B98562053559"
          ]
        }
      }
      blockchain: ALL
      limit: 200
      order: { followerSince: DESC }
    }
  ) {
    Follower {
      followerAddress {
        addresses
        domains {
          name
        }
        socials {
          dappName
          profileName
          profileTokenId
          profileTokenIdHex
          userId
          userAssociatedAddresses
        }
      }
      followerProfileId
      followerTokenId
      followingAddress {
        addresses
        domains {
          name
        }
        socials {
          dappName
          profileName
          profileTokenId
          profileTokenIdHex
          userId
          userAssociatedAddresses
        }
      }
      followingProfileId
    }
  }
}

Get The Earliest Followers of User(s)

You can get the list of the earliest followers of user(s) by providing either 0x addresses, ENS names, Lens profiles, or Farcasters:

Try Demo

Show me the earliest followers of an array of users

Code

query MyQuery {
  SocialFollowers(
    input: {
      filter: {
        identity: {
          _in: [
            "lens/@stani"
            "lens_id:0x024"
            "fc_fname:dwr.eth"
            "fc_fid:3"
            "vitalik.eth"
            "0xeaf55242a90bb3289dB8184772b0B98562053559"
          ]
        }
      }
      blockchain: ALL
      limit: 200
      order: { followerSince: ASC }
    }
  ) {
    Follower {
      followerAddress {
        addresses
        domains {
          name
        }
        socials {
          dappName
          profileName
          profileTokenId
          profileTokenIdHex
          userId
          userAssociatedAddresses
        }
      }
      followerProfileId
      followerTokenId
      followingAddress {
        addresses
        domains {
          name
        }
        socials {
          dappName
          profileName
          profileTokenId
          profileTokenIdHex
          userId
          userAssociatedAddresses
        }
      }
      followingProfileId
    }
  }
}

Get All Followers of User(s) that has ENS Domain

You can get the list of all followers of user(s) and check if they have any ENS domain:

Try Demo

Show me all followers of users that have ENS domain

Code

query MyQuery {
  SocialFollowers(
    input: {filter: {identity: {_in: ["lens/@stani", "lens_id:0x024", "fc_fname:dwr.eth", "fc_fid:3", "vitalik.eth", "0xeaf55242a90bb3289dB8184772b0B98562053559"]}}, blockchain: ALL, limit: 200}
  ) {
    Follower {
      followerAddress {
        addresses
        domains { # Show all domains owned by followers
          name
          isPrimary
        }
        socials {
          dappName
          profileName
          profileTokenId
          profileTokenIdHex
          userId
          userAssociatedAddresses
        }
      }
      followerProfileId
      followerTokenId
      followingAddress {
        addresses
        domains {
          name
        }
        socials {
          dappName
          profileName
          profileTokenId
          profileTokenIdHex
          userId
          userAssociatedAddresses
        }
      }
      followingProfileId
    }
  }
}

You can use the followerAddress.domains that will return an array to see if there's any domain owned by the follower.

If the length of the followerAddress.domains array is non-zero, then the follower has at least one ENS domain. Otherwise, it does not have any ENS domain.

Get All Followers of User(s) that has XMTP Enabled

You can get the list of all followers of user(s) and check if they have XMTP enabled:

Try Demo

Code

query MyQuery {
  SocialFollowers(
    input: {
      filter: {
        identity: {
          _in: [
            "lens/@stani"
            "lens_id:0x024"
            "fc_fname:dwr.eth"
            "fc_fid:3"
            "vitalik.eth"
            "0xeaf55242a90bb3289dB8184772b0B98562053559"
          ]
        }
      }
      blockchain: ALL
      limit: 200
    }
  ) {
    Follower {
      followerAddress {
        addresses
        domains {
          name
        }
        socials {
          dappName
          profileName
          profileTokenId
          profileTokenIdHex
          userId
          userAssociatedAddresses
        }
        xmtp {
          isXMTPEnabled
        }
      }
      followerProfileId
      followerTokenId
      followingAddress {
        addresses
        domains {
          name
        }
        socials {
          dappName
          profileName
          profileTokenId
          profileTokenIdHex
          userId
          userAssociatedAddresses
        }
      }
      followingProfileId
    }
  }
}

Get Users that have a certain amount of Followers

You can get the list of all users of that have a certain amount of followers, e.g. at least 1000 followers:

Try Demo

Show me all users that have at least 1000 followers

Code

query MyQuery {
  Socials(
    input: {
      filter: { followerCount: { _gte: 1000 } }
      blockchain: ethereum
      limit: 200
    }
  ) {
    Social {
      dappName
      profileName
      profileTokenId
      profileTokenIdHex
      userId
      userAssociatedAddresses
      followerCount
    }
  }
}

Get All Followers of User(s) that Hold ERC20 Token(s)

You can get the list of all followers of user(s) and check if they hold any ERC20 token(s), e.g. USDC:

Try Demo

Code

query MyQuery {
  SocialFollowers(
    input: {
      filter: {
        identity: {
          _in: [
            "lens/@stani"
            "lens_id:0x024"
            "fc_fname:dwr.eth"
            "fc_fid:3"
            "vitalik.eth"
            "0xeaf55242a90bb3289dB8184772b0B98562053559"
          ]
        }
      }
      blockchain: ALL
      limit: 200
    }
  ) {
    Follower {
      followerAddress {
        addresses
        domains {
          name
        }
        socials {
          dappName
          profileName
          profileTokenId
          profileTokenIdHex
          userId
          userAssociatedAddresses
        }
        tokenBalances(
          input: {
            filter: {
              tokenAddress: {
                _in: ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]
              }
              tokenType: { _eq: ERC20 }
            }
          }
        ) {
          formattedAmount
        }
      }
      followerProfileId
      followerTokenId
      followingAddress {
        addresses
        domains {
          name
        }
        socials {
          dappName
          profileName
          profileTokenId
          profileTokenIdHex
          userId
          userAssociatedAddresses
        }
      }
      followingProfileId
    }
  }
}

Get All Followers of User(s) that Hold ERC721/1155 NFT(s)

You can get the list of all followers of user(s) and check if they hold any ERC721/1155 NFT(s), e.g. BAYC:

Try Demo

Code

query MyQuery {
  SocialFollowers(
    input: {
      filter: {
        identity: {
          _in: [
            "lens/@stani"
            "lens_id:0x024"
            "fc_fname:dwr.eth"
            "fc_fid:3"
            "vitalik.eth"
            "0xeaf55242a90bb3289dB8184772b0B98562053559"
          ]
        }
      }
      blockchain: ALL
      limit: 200
    }
  ) {
    Follower {
      followerAddress {
        addresses
        domains {
          name
        }
        socials {
          dappName
          profileName
          profileTokenId
          profileTokenIdHex
          userId
          userAssociatedAddresses
        }
        tokenBalances(
          input: {
            filter: {
              tokenAddress: {
                _in: ["0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D"]
              }
              tokenType: { _in: [ERC721, ERC1155] }
            }
          }
        ) {
          formattedAmount
        }
      }
      followerProfileId
      followerTokenId
      followingAddress {
        addresses
        domains {
          name
        }
        socials {
          dappName
          profileName
          profileTokenId
          profileTokenIdHex
          userId
          userAssociatedAddresses
        }
      }
      followingProfileId
    }
  }
}

Get All Followers of User(s) that Hold POAP(s)

You can get the list of all followers of user(s) and check if they hold any POAP(s), e.g. EthCC[6] – Attendee POAP:

Try Demo

Code

query MyQuery {
  SocialFollowers(
    input: {
      filter: {
        identity: {
          _in: [
            "lens/@stani"
            "lens_id:0x024"
            "fc_fname:dwr.eth"
            "fc_fid:3"
            "vitalik.eth"
            "0xeaf55242a90bb3289dB8184772b0B98562053559"
          ]
        }
      }
      blockchain: ALL
      limit: 200
    }
  ) {
    Follower {
      followerAddress {
        addresses
        domains {
          name
        }
        socials {
          dappName
          profileName
          profileTokenId
          profileTokenIdHex
          userId
          userAssociatedAddresses
        }
        poaps(input: { filter: { eventId: { _eq: "141910" } } }) {
          mintHash
          mintOrder
        }
      }
      followerProfileId
      followerTokenId
      followingAddress {
        addresses
        domains {
          name
        }
        socials {
          dappName
          profileName
          profileTokenId
          profileTokenIdHex
          userId
          userAssociatedAddresses
        }
      }
      followingProfileId
    }
  }
}

Get All Followers of User(s) that Hold Certain Amount of ERC20 Token(s)

You can get the list of all followers 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 {
  SocialFollowers(
    input: {
      filter: {
        identity: {
          _in: [
            "lens/@stani"
            "lens_id:0x024"
            "fc_fname:dwr.eth"
            "fc_fid:3"
            "vitalik.eth"
            "0xeaf55242a90bb3289dB8184772b0B98562053559"
          ]
        }
      }
      blockchain: ALL
      limit: 200
    }
  ) {
    Follower {
      followerAddress {
        addresses
        domains {
          name
        }
        socials {
          dappName
          profileName
          profileTokenId
          profileTokenIdHex
          userId
          userAssociatedAddresses
        }
        tokenBalances(
          input: {
            filter: {
              tokenAddress: {
                _in: ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]
              }
              tokenType: { _eq: ERC20 }
              formattedAmount: { _gte: 1000 }
            }
          }
        ) {
          formattedAmount
        }
      }
      followerProfileId
      followerTokenId
      followingAddress {
        addresses
        domains {
          name
        }
        socials {
          dappName
          profileName
          profileTokenId
          profileTokenIdHex
          userId
          userAssociatedAddresses
        }
      }
      followingProfileId
    }
  }
}

Developer Support

If you have any questions or need help regarding fetching followers data, please join our Airstack's Telegram group.

More Resources

Last updated

Was this helpful?

#946:

Change request updated