Query XMTP-enabled addresses
XMTP users can only chat with other users who have XMTP-enabled addresses. Thus, it is essential that if you are building on top of XMTP to know if a user or group of users have XMTP enabled.
In this guide, youβll learn how to use Airstack to:
- Check if ENS addresses have XMTP
- Check if Lens addresses have XMTP
- Check if Farcaster addresses have XMTP
- Check if Farcaster followers have XMTP enabled
- Check if Farcaster following have XMTP enabled
- Check if NFT or token holders have XMTP
- Check if POAP attendees have XMTP
With Airstack XMTPs API, it will return the isXMTPEnabled field that you can use to check if XMTP has been enabled.
Prerequisitesβ
- An Airstack account (free)
- Basic knowledge of GraphQL
π€ AI natural languageβ
Airstack provides an AI solution for you to build GraphQL queries to fulfill your use case easily.
Query a 0x address or ENS name to check if XMTP is enabledβ
You can query a 0x address or ENS name to check if the user has XMTP enabled:
AI prompt
For vitalik.eth, show if XMTP is enabled
- Query
- Variables
- Response
query MyQuery($address: Identity!) {
  XMTPs(input: { blockchain: ALL, filter: { owner: { _eq: $address } } }) {
    XMTP {
      isXMTPEnabled
    }
  }
}
{
  "address": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" // or βvitalik.ethβ
}
{
  "data": {
    "XMTPs": {
      "XMTP": [
        {
          "isXMTPEnabled": true
        }
      ]
    }
  }
}
Bulk query Lens profiles to check if XMTP is enabledβ
You can check if an array of Lens profiles have XMTP enabled:
For lens/@vitalik and lens/@shanemac, show if XMTP is enabled
- Query
- Variables
- Response
query BulkFetchPrimaryENSandXMTP($lens: [Identity!]) {
  XMTPs(
    input: { blockchain: ALL, filter: { owner: { _in: $lens } }, limit: 100 }
  ) {
    XMTP {
      isXMTPEnabled
      owner {
        socials {
          dappName
          profileName
        }
      }
    }
    pageInfo {
      nextCursor
      prevCursor
    }
  }
}
{
  "lens": ["lens/@shanemac", "lens/@vitalik"]
}
{
  "data": {
    "XMTPs": {
      "XMTP": [
        {
          "isXMTPEnabled": true,
          "owner": {
            "addresses": ["0xa64af7f78de39a238ecd4fff7d6d410dbace2df0"],
            "domains": [
              {
                "name": "shanemac.eth"
              }
            ],
            "socials": [
              {
                "dappName": "farcaster",
                "profileName": "shanemac"
              },
              {
                "dappName": "lens",
                "profileName": "lens/@shanemac"
              }
            ]
          }
        },
        {
          "isXMTPEnabled": true,
          "owner": {
            "addresses": ["0xd8da6bf26964af9d7eed9e03e53415d37aa96045"],
            "domains": [
              {
                "name": "satoshinart.eth"
              }
            ],
            "socials": [
              {
                "dappName": "farcaster",
                "profileName": "vbuterin"
              },
              {
                "dappName": "lens",
                "profileName": "lens/@vitalik"
              }
            ]
          }
        }
      ]
    }
  }
}
Bulk query Farcaster name or ID to check if XMTP is enabledβ
For farcaster user name vbuterin, name v, and id 602, show if XMTP are enabled
- Query
- Variables
- Response
query BulkFetchFarcasterHaveXMTP($farcaster: [Identity!]) {
  XMTPs(
    input: {
      blockchain: ALL
      filter: { owner: { _in: $farcaster } }
      limit: 100
    }
  ) {
    XMTP {
      isXMTPEnabled
      owner {
        socials {
          dappName
          profileName
        }
      }
    }
    pageInfo {
      nextCursor
      prevCursor
    }
  }
}
{
  "farcaster": ["fc_fname:vbuterin", "fc_fname:v", "fc_fid:602"]
}
{
  "data": {
    "XMTPs": {
      "XMTP": [
        {
          "isXMTPEnabled": true,
          "owner": {
            "socials": [
              {
                "dappName": "farcaster",
                "profileName": "vbuterin"
              },
              {
                "dappName": "lens",
                "profileName": "lens/@vitalik"
              }
            ],
            "addresses": ["0xd8da6bf26964af9d7eed9e03e53415d37aa96045"]
          }
        },
        {
          "isXMTPEnabled": true,
          "owner": {
            "socials": [
              {
                "dappName": "farcaster",
                "profileName": "v"
              }
            ],
            "addresses": ["0x182327170fc284caaa5b1bc3e3878233f529d741"]
          }
        },
        {
          "isXMTPEnabled": true,
          "owner": {
            "socials": [
              {
                "dappName": "farcaster",
                "profileName": "betashop"
              },
              {
                "dappName": "lens",
                "profileName": "lens/@betashop9"
              }
            ],
            "addresses": ["0xeaf55242a90bb3289db8184772b0b98562053559"]
          }
        }
      ],
      "pageInfo": {
        "nextCursor": "",
        "prevCursor": ""
      }
    }
  }
}
Check if Farcaster followers have XMTP enabledβ
show me all Farcaster followers of vitalik.eth and their XMTP
- Query
- Variables
- Response
query MyQuery($user: Identity!) {
  SocialFollowers(
    input: {
      filter: { identity: { _eq: $user }, dappName: { _eq: farcaster } }
      blockchain: ALL
      limit: 50
    }
  ) {
    Follower {
      followerAddress {
        addresses
        xmtp {
          isXMTPEnabled
        }
      }
    }
  }
}
{
  "user": "vitalik.eth"
}
{
  "data": {
    "SocialFollowers": {
      "Follower": [
        {
          "followerAddress": {
            "addresses": [
              "0x6967e124c745173a571bf846e126e7f38fc66d3f",
              "0x988527874c7e3f02115f89a6a97135c70b6a47fc"
            ],
            "xmtp": [
              {
                "isXMTPEnabled": true // this follower have XMTP enabled
              }
            ]
          }
        },
        {
          "followerAddress": {
            "addresses": [
              "0x21441e89d7afe9922e461914c067dbe0a9bc1998",
              "0x87641313e36e94e4422610a6703ef3e1a8aca5fe"
            ],
            "xmtp": [] // this followers does not have XMTP enabled
          }
        }
      ]
    }
  }
}
Check if Farcaster following have XMTP enabledβ
show me all Farcaster following of vitalik.eth and their XMTP
- Query
- Variables
- Response
query MyQuery($user: Identity!) {
  SocialFollowings(
    input: {
      filter: { identity: { _eq: $user }, dappName: { _eq: farcaster } }
      blockchain: ALL
      limit: 200
    }
  ) {
    Following {
      followingAddress {
        addresses
        xmtp {
          isXMTPEnabled
        }
      }
    }
  }
}
{
  "user": "vitalik.eth"
}
{
  "data": {
    "SocialFollowings": {
      "Following": [
        {
          "followingAddress": {
            "addresses": [
              "0x1ca66c990e86b750ea6b2180d17fff89273a5c0d",
              "0x9eab9d856a3a667dc4cd10001d59c679c64756e7"
            ],
            "xmtp": [
              {
                "isXMTPEnabled": true // this following have XMTP enabled
              }
            ]
          }
        },
        {
          "followingAddress": {
            "addresses": [
              "0x2596e027e19d7122798284010f9575c0eb18bbea",
              "0xc3fdadbae46798cd8762185a09c5b672a7aa36bb"
            ],
            "xmtp": [] // this following does not have XMTP enabled
          }
        }
      ]
    }
  }
}
Check if NFT or token holders have XMTP enabledβ
Get the NFT holders that have XMTP enabled using the TokenBalances API and provide an NFT contract address for the $tokenAddress input.
- Query
- Variables
- Response
query MyQuery($tokenAddress: Address!) {
  TokenBalances(
    input: {
      filter: { tokenAddress: { _eq: $tokenAddress } }
      blockchain: ethereum
    }
  ) {
    TokenBalance {
      owner {
        xmtp {
          isXMTPEnabled
        }
      }
    }
  }
}
{
  "tokenAddress": "0xc0f95066899efd7c0540b9474f81355a83e6f578" // NFT collection address
}
{
  "data": {
    "TokenBalances": {
      "TokenBalance": [
        {
          "owner": {
            "xmtp": [
              {
                "isXMTPEnabled": true
              }
            ]
          }
        },
        {
          "owner": {
            "xmtp": []
          }
        }
      ]
    }
  }
}
Check if POAP attendees have XMTP enabledβ
Get the POAP holders that have XMTP enabled using the Poaps API and provide a POAP event ID for the $eventId input.
- Query
- Variables
- Response
query POAPEventHoldersWithXMTP($eventId: String!) {
  Poaps(input: { filter: { eventId: { _eq: $eventId } }, blockchain: ALL }) {
    Poap {
      owner {
        addresses
        xmtp {
          isXMTPEnabled
        }
      }
    }
  }
}
{
  "eventId": "141910" // POAP event ID
}
{
  "data": {
    "Poaps": {
      "Poap": [
        {
          "owner": {
            "addresses": ["0xda85048c977134b09fc05cd3d1abd3a63e8edf4d"],
            "xmtp": []
          }
        },
        {
          "owner": {
            "addresses": ["0x546457bbddf5e09929399768ab5a9d588cb0334d"],
            "xmtp": [
              {
                "isXMTPEnabled": true
              }
            ]
          }
        }
      ]
    }
  }
}