🧍Check Single User

Learn how to use Airstack to check if a single user has XMTP or not.

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 a single user has 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.

By 0x Address

Simply use the following query to check if a user has XMTP or not with this example of a user that has an XMTP:

Try Demo

Code

query MyQuery {
  XMTPs(
    input: {
      blockchain: ALL
      filter: { owner: { _eq: "0xa91c2d10a993d14f842d23b97f2ab3fdf6b5b9aa" } }
    }
  ) {
    XMTP {
      isXMTPEnabled
    }
  }
}

Here's an example of user the does not have any XMTP:

Try Demo

Code

query MyQuery {
  XMTPs(
    input: {
      blockchain: ALL
      filter: { owner: { _eq: "0x5416e5dc14caa0950b2a24ede1eb0e97c360bcf5" } }
    }
  ) {
    XMTP {
      isXMTPEnabled
    }
  }
}

By Solana Address

Simply use the following query to check if a solana address has enabled XMTP or not with this example of a user that has an XMTP:

Try Demo

Code

query MyQuery {
  XMTPs(
    input: {
      blockchain: ALL
      filter: { owner: { _eq: "GJQUFnCu7ZJHxtxeaeskjnqyx8QFAN1PsiGuShDMPsqV" } }
    }
  ) {
    XMTP {
      isXMTPEnabled
    }
  }
}

By ENS

With Airstack Identity API, you can simply swap the address input to any ENS names, either on-chain or off-chain (e.g. ):

Try Demo

Code

query MyQuery {
  XMTPs(input: { blockchain: ALL, filter: { owner: { _eq: "vitalik.eth" } } }) {
    XMTP {
      isXMTPEnabled
    }
  }
}

By cb.id

With Airstack Identity API, you can simply swap the address input to any cb.id:

Try Demo

Code

query MyQuery {
  XMTPs(
    input: { blockchain: ALL, filter: { owner: { _eq: "yosephks.cb.id" } } }
  ) {
    XMTP {
      isXMTPEnabled
    }
  }
}

By Lens Profile Name or ID

With Airstack Identity API, you can simply swap the address input owner to any Lens profile name:

Try Demo

Code

query MyQuery {
  XMTPs(
    input: { blockchain: ALL, filter: { owner: { _eq: "lens/@vitalik" } } }
  ) {
    XMTP {
      isXMTPEnabled
    }
  }
}

Alternatively, you can also swap the address input owner to any Lens profile ID, either in or hex form:

Try Demo

Code

query MyQuery {
  XMTPs(
    input: { blockchain: ALL, filter: { owner: { _eq: "lens_id:100275" } } }
  ) {
    XMTP {
      isXMTPEnabled
    }
  }
}

By Farcaster Name or ID

With Airstack Identity API, you can simply swap the address input owner to any :

Try Demo

Code

query MyQuery {
  XMTPs(
    input: {
      blockchain: ALL
      filter: { owner: { _eq: "fc_fname:vitalik.eth" } }
    }
  ) {
    XMTP {
      isXMTPEnabled
    }
  }
}

Alternatively, you can also swap the address input owner to any Farcaster ID:

Try Demo

Code

query MyQuery {
  XMTPs(input: { blockchain: ALL, filter: { owner: { _eq: "fc_fid:5650" } } }) {
    XMTP {
      isXMTPEnabled
    }
  }
}

Developer Support

If you have any questions or need help regarding checking XMTP for a single user with various , please join our Airstack's Telegram group.

More Resources

Last updated

Was this helpful?