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 0x Address or ENS If XMTP Is Enabled​

You can resolve either a 0x address of ENS 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 If XMTP Is Enabled​

You can check if an array of Lens profiles have XMTP enabled:

For vitalik.lens and shanemac.lens, 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 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 NFT or Token holders have XMTP​

Get the NFT holders that have XMTP 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​

Get the POAP holders that have XMTP using the Poaps API and provide an 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 XMTP For Single User​

Check XMTP For Multiple User​

NFT & POAP Holders​

Was the information on this page helpful?
powered by XMTP