đŸ‘ŦCheck Multiple Users

Learn how to use Airstack to check if multiple users have 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 multiple users have 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.

Bulk Check Multiple Users Have XMTP

To check multiple users if they have XMTP is similar to checking for single users.

Swap _eq comparator with _in to allow array inputs:

Try Demo

Code

query MyQuery {
  XMTPs(
    input: {
      blockchain: ALL
      filter: {
        owner: {
          _in: [
            "0xa91c2d10a993d14f842d23b97f2ab3fdf6b5b9aa"
            "shanemac.eth"
            "lens/@vitalik"
          ]
        }
      }
    }
  ) {
    XMTP {
      isXMTPEnabled
      owner {
        addresses
        domains {
          name
        }
        socials {
          dappName
          profileName
        }
      }
    }
  }
}

The response will return fewer amount of element in the XMTP array if some of the owner input has no XMTP.

Therefore, you can use owner field response to double check if in more details if a specific user has XMTP or not.

Bulk Check Lens Profiles Have XMTP

You can bulk check Lens profiles have XMTP by providing either Lens profile or ID into the owner input array:

Try Demo

Code

query BulkFetchLensandXMTP {
  XMTPs(
    input: {
      blockchain: ALL
      filter: {
        owner: {
          _in: ["lens/@hoobastank", "lens_id:0x09718", "lens/@barisadiguzel"]
        }
      }
      limit: 100
    }
  ) {
    XMTP {
      isXMTPEnabled
      owner {
        socials(input: { filter: { dappName: { _eq: lens } } }) {
          profileName
          profileTokenIdHex
          userAssociatedAddresses
        }
      }
    }
  }
}

Bulk Check Farcasters Have XMTP

You can bulk check Farcasters have XMTP by providing either Farcaster or ID into the owner input array:

Try Demo

Code

query BulkFetchFarcasterHaveXMTP {
  XMTPs(
    input: {
      blockchain: ALL
      filter: {
        owner: {
          _in: ["fc_fname:vitalik.eth", "fc_fname:varunsrin.eth", "fc_fid:602"]
        }
      }
      limit: 100
    }
  ) {
    XMTP {
      isXMTPEnabled
      owner {
        socials(input: { filter: { dappName: { _in: farcaster } } }) {
          profileName
          userId
          userAssociatedAddresses
        }
        addresses
      }
    }
  }
}

Developer Support

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

More Resources

  1. e.g. lens_id:0x09718

  2. e.g. fc_fid:5650

Last updated

Was this helpful?