Skip to main content

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:

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 MyQuery($address: Identity!) {
XMTPs(input: { blockchain: ALL, filter: { owner: { _eq: $address } } }) {
XMTP {
isXMTPEnabled
}
}
}

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 BulkFetchPrimaryENSandXMTP($lens: [Identity!]) {
XMTPs(
input: { blockchain: ALL, filter: { owner: { _in: $lens } }, limit: 100 }
) {
XMTP {
isXMTPEnabled
owner {
socials {
dappName
profileName
}
}
}
pageInfo {
nextCursor
prevCursor
}
}
}

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 BulkFetchFarcasterHaveXMTP($farcaster: [Identity!]) {
XMTPs(
input: {
blockchain: ALL
filter: { owner: { _in: $farcaster } }
limit: 100
}
) {
XMTP {
isXMTPEnabled
owner {
socials {
dappName
profileName
}
}
}
pageInfo {
nextCursor
prevCursor
}
}
}

Check if Farcaster followers have XMTP enabled​

show me all Farcaster followers of vitalik.eth and their XMTP
query MyQuery($user: Identity!) {
SocialFollowers(
input: {
filter: { identity: { _eq: $user }, dappName: { _eq: farcaster } }
blockchain: ALL
limit: 50
}
) {
Follower {
followerAddress {
addresses
xmtp {
isXMTPEnabled
}
}
}
}
}

Check if Farcaster following have XMTP enabled​

show me all Farcaster following of vitalik.eth and their XMTP

query MyQuery($user: Identity!) {
SocialFollowings(
input: {
filter: { identity: { _eq: $user }, dappName: { _eq: farcaster } }
blockchain: ALL
limit: 200
}
) {
Following {
followingAddress {
addresses
xmtp {
isXMTPEnabled
}
}
}
}
}

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 MyQuery($tokenAddress: Address!) {
TokenBalances(
input: {
filter: { tokenAddress: { _eq: $tokenAddress } }
blockchain: ethereum
}
) {
TokenBalance {
owner {
xmtp {
isXMTPEnabled
}
}
}
}
}

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 POAPEventHoldersWithXMTP($eventId: String!) {
Poaps(input: { filter: { eventId: { _eq: $eventId } }, blockchain: ALL }) {
Poap {
owner {
addresses
xmtp {
isXMTPEnabled
}
}
}
}
}

Learn more about Airstack​

Check if a single user has XMTP enabled​

Check if multiple users have XMTP enabled​

Check if NFT and POAP holders have XMTP enabled​

Was the information on this page helpful?
powered by XMTP