πŸŽ–οΈFarcaster Power Badge

Learn how to fetch Farcaster power badge data and its various use cases to check if a user is a power user on 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.

Check If Farcaster User(s) Have A Power Badge

You can check if Farcaster user(s) have a power badge by using the Socials API:

Try Demo

Check if Farcaster user(s) have power badge

Code

query MyQuery {
  Socials(
    input: {
      filter: {
        profileName: {
          _in: ["betashop.eth"] # provide FC user profile name(s)
        },
        dappName: {_eq: farcaster}
      },
      blockchain: ethereum
    }
  ) {
    Social {
      isFarcasterPowerUser
      profileName
    }
  }
}

Get All Farcaster Followers That Also Have A Power Badge

You can fetch all Farcaster followers of a Farcaster user and check if they have a power badge by using the SocialFollowers API:

Try Demo

Show me all the followers of betashop.eth that also have power badge

Code

query MyQuery {
  SocialFollowers(
    input: {
      filter: {
        identity: {_eq: "betashop.eth"},
        dappName: {_eq: farcaster}
      },
      blockchain: ALL,
      order: {followerSince: DESC}
    }
  ) {
    Follower {
      followerProfileId
      followerAddress {
        addresses
        socials {
          profileName
          isFarcasterPowerUser
        }
      }
    }
  }
}

Get All Farcaster Followings That Also Have A Power Badge

You can fetch all Farcaster followings of a Farcaster user and check if they have a power badge by using the SocialFollowings API:

Try Demo

Show me all the followings of betashop.eth that also have power badge

Code

query MyQuery {
  SocialFollowings(
    input: {
      filter: {
        identity: {_eq: "betashop.eth"},
        dappName: {_eq: farcaster}
      },
      blockchain: ALL,
      order: {followingSince: DESC}
    }
  ) {
    Following {
      followingProfileId
      followingAddress {
        addresses
        socials {
          profileName
          isFarcasterPowerUser
        }
      }
    }
  }
}

Get All Farcaster Channel Participants That Also Have A Power Badge

You can fetch all the channel participants of a Farcaster channel and check if they have a power badge by using the FarcasterChannelParticipants API:

Try Demo

Show me all participants of /airstack channel that also have power badge

Code

query MyQuery {
  FarcasterChannelParticipants(
    input: {
      filter: {
        channelId: {_eq: "airstack"}
      },
      blockchain: ALL
    }
  ) {
    FarcasterChannelParticipant {
      participantId
      participant {
        profileName
        isFarcasterPowerUser
      }
    }
  }
}

Developer Support

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

More Resources

Last updated

Was this helpful?