🎉Social Follows

Learn how to use Airstack to get all social followers or following that have XMTP enabled.

Airstack provides easy-to-use APIs for enriching XMTP applications and integrating on-chain and off-chain data with XMTP.

Table Of Contents

In this guide, you will learn how to use Airstack to check if holders of a given NFT or POAP have XMTP enabled:

Pre-requisites

  • An Airstack account

  • Basic knowledge of GraphQL

  • Basic knowledge of XMTP

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 User(s) that have XMTP Enabled

You can all the followers of user(s) and see whether they have their XMTP enabled for messaging by providing , ENS, , or Farcaster:

Try Demo

Code

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

Get All Following of User(s) that have XMTP Enabled

You can all the following of user(s) and see whether they have their XMTP enabled for messaging by providing , ENS, , or Farcaster:

Try Demo

Code

query MyQuery {
  SocialFollowings(
    input: {
      filter: {
        identity: {
          _in: [
            "0xeaf55242a90bb3289dB8184772b0B98562053559"
            "vitalik.eth"
            "lens/@bradorbradley"
            "fc_fname:dwr.eth"
          ]
        }
      }
      blockchain: ALL
      limit: 200
    }
  ) {
    Following {
      followingAddress {
        addresses
        domains {
          name
          resolvedAddress
        }
        socials {
          profileName
          profileTokenId
          profileTokenIdHex
          userId
          userAssociatedAddresses
        }
        xmtp {
          isXMTPEnabled
        }
      }
      followingProfileId
      followerAddress {
        addresses
        domains {
          name
          resolvedAddress
        }
        socials {
          profileName
          profileTokenId
          profileTokenIdHex
          userId
          userAssociatedAddresses
        }
      }
      followerProfileId
      followerTokenId
    }
  }
}

Developer Support

If you have any questions or need help regarding checking XMTP for holders of a given NFT or POAP, please join our Airstack's Telegram group.

More Resources

Last updated

Was this helpful?