Links
🎉

Social Follows

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

🎉 Social Follows

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 (free)
  • 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:
npm
yarn
pnpm
pip
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:
React
Node
Python
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.
Airstack AI (Demo)

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 0x address, ENS, Lens profile, or Farcaster:

Try Demo

https://app.airstack.xyz/query/RRiQCiLfbC
Show all followers of vitalik.eth and 0xeaf55242a90bb3289dB8184772b0B98562053559 if they have XMTP enabled

Code

Query
Response
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
}
}
}
{
"data": {
"SocialFollowers": {
"Follower": [
{
"followerAddress": {
"addresses": [
"0xac7a709f09eac9769c567a24a858fe65b44850af",
"0x3a497a2a8b35b934bf271938502ca24e444e689e"
],
"domains": [
{
"name": "pfizergang.eth",
"resolvedAddress": "0x3a497a2a8b35b934bf271938502ca24e444e689e"
}
],
"socials": [
{
"profileName": "lens/@pfizergang",
"profileTokenId": "66242",
"profileTokenIdHex": "0x0102c2",
"userId": "0x3a497a2a8b35b934bf271938502ca24e444e689e",
"userAssociatedAddresses": [
"0x3a497a2a8b35b934bf271938502ca24e444e689e"
]
},
{
"profileName": "pfizergang",
"profileTokenId": "16250",
"profileTokenIdHex": "0x03f7a",
"userId": "16250",
"userAssociatedAddresses": [
"0xac7a709f09eac9769c567a24a858fe65b44850af",
"0x3a497a2a8b35b934bf271938502ca24e444e689e"
]
}
],
"xmtp": [
{
"isXMTPEnabled": true // Indicate that XMTP is enabled
}
]
},
"followerProfileId": "16250",
"followerTokenId": "",
"followingAddress": {
"addresses": [
"0x66bd69c7064d35d146ca78e6b186e57679fba249",
"0xeaf55242a90bb3289db8184772b0b98562053559"
],
"domains": [
{
"name": "jasongoldberg.eth",
"resolvedAddress": "0xeaf55242a90bb3289db8184772b0b98562053559"
},
{
"name": "betashop.eth",
"resolvedAddress": "0xeaf55242a90bb3289db8184772b0b98562053559"
}
],
"socials": [
{
"profileName": "betashop.eth",
"profileTokenId": "602",
"profileTokenIdHex": "0x025a",
"userId": "602",
"userAssociatedAddresses": [
"0x66bd69c7064d35d146ca78e6b186e57679fba249",
"0xeaf55242a90bb3289db8184772b0b98562053559"
]
},
{
"profileName": "lens/@betashop9",
"profileTokenId": "94472",
"profileTokenIdHex": "0x017108",
"userId": "0xeaf55242a90bb3289db8184772b0b98562053559",
"userAssociatedAddresses": [
"0xeaf55242a90bb3289db8184772b0b98562053559"
]
}
]
},
"followingProfileId": "602"
},
// more followers
]
}
}
}

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 0x address, ENS, Lens profile, or Farcaster:

Try Demo

https://app.airstack.xyz/query/AQS3vZZW9b
Show all following of vitalik.eth and 0xeaf55242a90bb3289dB8184772b0B98562053559 if they have XMTP enabled

Code

Query
Response
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
}
}
}
{
"data": {
"SocialFollowings": {
"Following": [
{
"followingAddress": {
"addresses": [
"0xed03d7c78f164b66233853a07ee80b7911f7ea2e",
"0x8457b099bc9fa96a45d2c39c67871713cc50ccb7",
"0x4b2df5354934fce9179828d3cd600c93e4962482",
"0x471e9b5f89f827045e6d9ec2083a310c27459157"
],
"domains": [
{
"name": "snapstore.eth",
"resolvedAddress": "0xed03d7c78f164b66233853a07ee80b7911f7ea2e"
},
{
"name": "lludo.eth",
"resolvedAddress": "0x471e9b5f89f827045e6d9ec2083a310c27459157"
},
{
"name": "ludo.landry.eth",
"resolvedAddress": "0x471e9b5f89f827045e6d9ec2083a310c27459157"
},
{
"name": "landry.eth",
"resolvedAddress": "0x471e9b5f89f827045e6d9ec2083a310c27459157"
},
{
"name": "onetown.eth",
"resolvedAddress": "0xed03d7c78f164b66233853a07ee80b7911f7ea2e"
},
{
"name": "monkeypod.eth",
"resolvedAddress": "0x471e9b5f89f827045e6d9ec2083a310c27459157"
}
],
"socials": [
{
"profileName": "lens/@onetown",
"profileTokenId": "107023",
"profileTokenIdHex": "0x01a20f",
"userId": "0xed03d7c78f164b66233853a07ee80b7911f7ea2e",
"userAssociatedAddresses": [
"0xed03d7c78f164b66233853a07ee80b7911f7ea2e"
]
},
{
"profileName": "ludo",
"profileTokenId": "165",
"profileTokenIdHex": "0x0a5",
"userId": "165",
"userAssociatedAddresses": [
"0xed03d7c78f164b66233853a07ee80b7911f7ea2e",
"0x8457b099bc9fa96a45d2c39c67871713cc50ccb7",
"0x4b2df5354934fce9179828d3cd600c93e4962482",
"0x471e9b5f89f827045e6d9ec2083a310c27459157"
]
},
{
"profileName": "lens/@lludo",
"profileTokenId": "106216",
"profileTokenIdHex": "0x019ee8",
"userId": "0x471e9b5f89f827045e6d9ec2083a310c27459157",
"userAssociatedAddresses": [
"0x471e9b5f89f827045e6d9ec2083a310c27459157"
]
}
],
"xmtp": [
{
"isXMTPEnabled": true
}
]
},
"followingProfileId": "165",
"followerAddress": {
"addresses": [
"0x66bd69c7064d35d146ca78e6b186e57679fba249",
"0xeaf55242a90bb3289db8184772b0b98562053559"
],
"domains": [
{
"name": "jasongoldberg.eth",
"resolvedAddress": "0xeaf55242a90bb3289db8184772b0b98562053559"
},
{
"name": "betashop.eth",
"resolvedAddress": "0xeaf55242a90bb3289db8184772b0b98562053559"
}
],
"socials": [
{
"profileName": "betashop.eth",
"profileTokenId": "602",
"profileTokenIdHex": "0x025a",
"userId": "602",
"userAssociatedAddresses": [
"0x66bd69c7064d35d146ca78e6b186e57679fba249",
"0xeaf55242a90bb3289db8184772b0b98562053559"
]
},
{
"profileName": "lens/@betashop9",
"profileTokenId": "94472",
"profileTokenIdHex": "0x017108",
"userId": "0xeaf55242a90bb3289db8184772b0b98562053559",
"userAssociatedAddresses": [
"0xeaf55242a90bb3289db8184772b0b98562053559"
]
}
]
},
"followerProfileId": "602",
"followerTokenId": ""
}
// more following
]
}
}
}

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