To access the Airstack APIs in other languages, you can use https://api.airstack.xyz/gql as your GraphQL endpoint.
Gating Only User(s) That Follows A Given User
You can build a token-gating system that gates only users that follow a given user by checking if user A is following a given 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 socialFollowing.
If you need to check multiple users A simultaneously, then simply provide more identities into the identity input in the socialFollowings nested API.
queryisFollowing { # 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 given feature access.
Otherwise, betashop.eth will be considered an not be given any feature access.
Gating Only User(s) That Have Common Followers
You can build a token-gating system that gates only users that have common followers with a given user.
This can be done by fetching the intersection of following between two or more users providing either 0x addresses, ENS names, Lens profiles, or Farcasters.
{"data": {"SocialFollowings": {"Following": [ {"followingAddress": {"socialFollowings": {"Following": [ {"followingAddress": {"socials": [ {"fnames": ["nickcherry" ],"profileName":"nickcherry",// this is common following"userId":"145","userAssociatedAddresses": ["0x1692101d7b84bf8ed8d828e44e55a8ca9a242bc4","0x3a8a1f045cd4f7246c6b3a78861269cc6065433a" ] } ] } } ] } } }, {"followingAddress": {"socialFollowings": {"Following": [] // Followed by betashop.eth, but isn't followed by ipeciura } } } ] } }}
If betashop.eth has common following ipeciura.eth on either Lens or Farcaster, then it will appear as a response in the innermost Following array as shown in the sample response and thus should be given feature access.
Otherwise, betashop.eth will be considered an not be given any feature access.
Developer Support
If you have any questions or need help regarding fetching Lens Followings data, please join our Airstack's Telegram group.