Learn how you can build and split your request inbox by using Airstack to determine if a user can be considered a real user or not in your XMTP messaging app.
The request inbox is for users unknown to the main user and without any connections. It typically holds spam, which users should avoid.
There could also occasionally be real users with no connections who might want to contact the main user. To manage this, we recommend dividing the request inbox even further into two parts:
Top Requests: This includes likely real users from the request inbox.
All Requests: This contains all users in the request inbox, without filtering.
Use the Airstack API to check if senders in the request inbox are genuine and place them in the Top Requests Inbox.
Some criteria that can be checked for splitting the request inbox:
Senders Have Non-Virtual POAPs (IRL POAPs can only be minted in person, so this is a strong positive signal)
Senders have X number of followers on Farcaster (e.g. if the user has >1000 followers you may have some confidence they are a real user)
Senders have X number of followers on Lens
Senders have/have not sent tokens/NFTs previously (If the user has no wallet history it's a strong negative signal)
Senders hold some tokens/NFTs (If the user has no wallet history it's a strong negative signal)
Table Of Contents
In this guide, you will learn how to use Airstack to create a request inbox by:
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.
Best Practice
While choosing a specific criteria will significantly decrease the number of spam appearing on your user's XMTP inbox, It is best practice that you combine the multiple criterion given here to build and split your Request Inbox.
This is done to provide multiple layers of filtration that will make it nearly impossible for spammers to have their messages slide into your users' XMTP inbox.
Check If Senders Have Any Token Transfers
You can check if senders have sent any token by providing an array of senders' 0x addresses to the $senders variable using the TokenTransfers API:
You can use this query to filter senders on the fly with a maximum of 200 wallet inputs to the $senders variable per API call.
{"data": {"ethereum": {"TokenTransfer": [ // If TokenTransfer array is not empty, then there are token transfers {"transactionHash":"0xd2e0d4e8aae125a7edae14c7dab106c1620be136b239e7f9dbd60861034b0c25","from": {"addresses":"0xB59Aa5Bb9270d44be3fA9b6D67520a2d28CF80AB" } },// other Ethereum token transfers ] },"base": {"TokenTransfer": [ // If TokenTransfer array is not empty, then there are token transfers {"transactionHash":"0x5b7faf6bd2266c3344bd5ee79fdbca32416b5162b97afbd41a39bbd1516d1ea7","from": {"addresses":"0x0964256674E42d61f0fF84097E28F65311786ccb" } },// Other Base token transfers ] },"zora": {"TokenTransfer": [ {"transactionHash":"0x928c96854d4aa1c7852472885efb0c2506b7a2b27e81562d6fef6480f9e12a86","from": {"addresses": ["0x0964256674e42d61f0ff84097e28f65311786ccb" ] } },// Other Zora token transfers ] } }}
Check If Senders Have Any Token Balances
You can check if senders hold any token in their wallet across multiple chains, e.g. Ethereum, Polygon, Base, or Zora, by providing an array of senders' 0x addresses to the $senders variable using the TokenBalances API:
You can use this query to filter senders on the fly with a maximum of 200 wallet inputs to the $senders variable per API call.
{"data": {"Ethereum": {"TokenBalance": [ // Shows that hold some tokens in Ethereum {"tokenAddress":"0xbf5495efe5db9ce00f80364c8b423567e58d2110","owner": {"addresses": [// This sender hold tokens inside its wallet on Ethereum"0x0964256674e42d61f0ff84097e28f65311786ccb" ] } },// more Ethereum tokens ] },"Base": {"TokenBalance": [ {"tokenAddress":"0x73d8048044b24e6fba5833849c3e5c26c6523719","owner": {"addresses": [// This sender hold tokens inside its wallet on Base"0x0964256674e42d61f0ff84097e28f65311786ccb" ] } },// more Base tokens ] },"Zora": {"TokenBalance": [ {"tokenAddress":"0x7b7a8caf6882d29ebd893b038b873d277344e397","owner": {"addresses": [// This sender hold tokens inside its wallet on Zora"0x0964256674e42d61f0ff84097e28f65311786ccb" ] } },// more Zora tokens ] } }}
Check If Senders Have Any Non-Virtual POAPs
You can check if senders have attended any non-virtual POAPs by providing an array of senders' 0x addresses to the $senders variable using the Poaps API:
You can use this query to filter senders on the fly with a maximum of 200 wallet inputs to the $senders variable per API call.
{"data": {"Poaps": {"Poap": [ {"mintOrder":5,"mintHash":"0x4974ddc3ada2100b8e4cb2e17fb993324f71e0676cdd33dfff107899fca16e90","poapEvent": {"isVirtualEvent":false// This is not virtual event },"owner": {"addresses": [// This sender has attended a non-virtual POAP event"0x0964256674e42d61f0ff84097e28f65311786ccb" ] } }, {"mintOrder":12,"mintHash":"0xdbb3a298401c221e6596557cecd0c0c8944e0dd538b7d81b6d97449b5911ce98","poapEvent": {"isVirtualEvent":true// This is virtual event },"owner": {"addresses": ["0x0964256674e42d61f0ff84097e28f65311786ccb" ] } },// more POAPs ] } }}
Check If Senders Have X or More Followers on Lens
You can check if senders have X or more Lens followers by providing an array of senders' 0x addresses to the $senders variable using the Socials API:
You can use this query to filter senders on the fly with a maximum of 200 wallet inputs to the $senders variable per API call.
Check If Senders Have X or More Followers on Farcaster
You can check if senders have X or more Farcaster followers by providing an array of senders' 0x addresses to the $senders variable using the Socials API:
You can use this query to filter senders on the fly with a maximum of 200 wallet inputs to the $senders variable per API call.