đĄ Activate Kit for Farcaster Auth KitAirstack Activate Kit enables you to execute a series of API calls to activate Farcaster users after they connect with Farcaster Auth Kit.
Farcaster Auth Kit enables your users to login to your app with their Farcaster custody address. Airstack Activate Kit is the next immediate step.
With Airstack Activate you can immediately fetch all of the user's:
Registration details from Optimism and Hubs
Profile details including bio, profile image
You can also use Airstack regex search to enable auto-complete search for Farcaster users in your app.
Table Of Contents
In this guide, you will learn to use Airstack to:
Pre-requisites
Basic knowledge of GraphQL
Get Started
JavaScript/TypeScript/Python
If you are using JavaScript/TypeScript or Python, Install the Airstack SDK:
npm yarn pnpm pip
React
Copy npm install @airstack/airstack-react
Node
Copy npm install @airstack/node
React
Copy yarn add @airstack/airstack-react
Node
Copy yarn add @airstack/node
React
Copy pnpm install @airstack/airstack-react
Node
Copy pnpm install @airstack/node
Then, add the following snippets to your code:
React Node Python
Copy 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 >;
}
};
Copy import { init , fetchQuery } from "@airstack/node" ;
init ( "YOUR_AIRSTACK_API_KEY" );
const query = `YOUR_QUERY` ; // Replace with GraphQL Query
const { data , error } = await fetchQuery (query);
console .log ( "data:" , data);
console .log ( "error:" , error);
Copy import asyncio
from airstack . execute_query import AirstackClient
api_client = AirstackClient (api_key = "YOUR_AIRSTACK_API_KEY" )
query = """YOUR_QUERY""" # Replace with GraphQL Query
async def main ():
execute_query_client = api_client . create_execute_query_object (
query = query)
query_response = await execute_query_client . execute_query ()
print (query_response.data)
asyncio . run ( main ())
Other Programming Languages
To access the Airstack APIs in other languages, you can use https://api.airstack.xyz/gql as your GraphQL endpoint.
Get Farcaster User Details
You can fetch the Farcaster user details of a 0x address by using the Socials
API and provide the 0x address to the identity
filter input:
Try Demo
Code
Query Response
Copy query MyQuery {
Socials(
input: {
filter : {
identity : { _eq : "0x182327170fC284cAaA5b1bC3e3878233f529D741" }
dappName : { _eq : farcaster }
}
blockchain : ethereum
limit : 200
}
) {
Social {
profileName
fnames
userId
profileImage
profileImageContentValue {
image {
medium
}
}
}
}
}
Copy {
"data" : {
"Socials" : {
"Social" : [
{
"profileName" : "v" ,
"fnames" : [ "v" , "varunsrin.eth" ] ,
"userId" : "2" ,
"profileImage": "https://i.seadn.io/gae/sYAr036bd0bRpj7OX6B-F-MqLGznVkK3--DSneL_BT5GX4NZJ3Zu91PgjpD9-xuVJtHq0qirJfPZeMKrahz8Us2Tj_X8qdNPYC-imqs?w=500&auto=format",
"profileImageContentValue" : {
"image" : {
"medium": "https://assets.airstack.xyz/image/social/XCPJH5EP49qftYc7+wAFfv5jzo3ddBWc9FMEERWezG8=/medium.png"
}
}
}
]
}
}
}
Get Farcaster User's Connected Addresses
You can fetch the Farcaster profile's connected addresses of a 0x address by using the Socials
API and provide the 0x address to the identity
filter input and all the connected addresses will be returned in the userAssociatedAddresses
field:
Try Demo
Code
Query Response
Copy query MyQuery {
Socials(
input: {
filter : {
identity : { _eq : "0x182327170fC284cAaA5b1bC3e3878233f529D741" }
dappName : { _eq : farcaster }
}
blockchain : ethereum
limit : 200
}
) {
Social {
userAssociatedAddresses
}
}
}
Copy {
"data" : {
"Socials" : {
"Social" : [
{
"userAssociatedAddresses" : [
"0x4114e33eb831858649ea3702e1c9a2db3f626446" ,
"0x91031dcfdea024b4d51e775486111d2b2a715871" ,
"0x182327170fc284caaa5b1bc3e3878233f529d741"
]
}
]
}
}
}
Get Farcaster User's Followers and Following Counts
You can fetch the Farcaster profile's connected addresses of a 0x address by using the Socials
API and provide the 0x address to the identity
filter input.
The number of people following and people followed by the given Farcaster profile will be returned in the followerCount
and followingCount
, respectively:
Try Demo
Code
Query Response
Copy query MyQuery {
Socials(
input: {
filter : {
identity : { _eq : "0x182327170fC284cAaA5b1bC3e3878233f529D741" }
dappName : { _eq : farcaster }
}
blockchain : ethereum
limit : 200
}
) {
Social {
followerCount
followingCount
}
}
}
Copy {
"data" : {
"Socials" : {
"Social" : [
{
"followerCount" : 37149 ,
"followingCount" : 1000
}
]
}
}
}
Get Farcaster User's Followers
You can fetch all the users following 0x address on Farcaster by using the SocialFollowers
API and provide the 0x address to the identity
filter input:
Try Demo
Code
Query Response
Copy query MyQuery {
SocialFollowers(
input: {
filter : {
dappName : { _eq : farcaster }
identity : { _eq : "0x182327170fC284cAaA5b1bC3e3878233f529D741" }
}
blockchain : ALL
limit : 200
}
) {
Follower {
followerAddress {
addresses
socials(input: { filter : { dappName : { _eq : farcaster } } }) {
profileName
userId
}
}
}
}
}
Copy {
"data" : {
"SocialFollowers" : {
"Follower" : [
{
"followerAddress" : {
"addresses" : [ "0xf86365d15b374a28c453396af7e10af24fae1b04" ] ,
"socials" : [
{
"profileName" : "aresangel" ,
"userId" : "214577"
}
]
}
} ,
{
"followerAddress" : {
"addresses" : [ "0x9ad6bf4108b79057c0ccc70521c86feca540f24f" ] ,
"socials" : [
{
"profileName" : "tortula" ,
"userId" : "193061"
}
]
}
}
// More users following 0x182327170fC284cAaA5b1bC3e3878233f529D741 on Farcaster
]
}
}
}
Get Farcaster User's Followings
You can fetch all the users being followed by 0x address on Farcaster by using the SocialFollowings
API and provide the 0x address to the identity
filter input:
Try Demo
Code
Query Response
Copy query MyQuery {
SocialFollowings(
input: {
filter : {
dappName : { _eq : farcaster }
identity : { _eq : "0x182327170fC284cAaA5b1bC3e3878233f529D741" }
}
blockchain : ALL
limit : 200
}
) {
Following {
followingAddress {
addresses
socials(input: { filter : { dappName : { _eq : farcaster } } }) {
profileName
userId
}
}
}
}
}
Copy {
"data" : {
"SocialFollowings" : {
"Following" : [
{
"followingAddress" : {
"addresses" : [
"0x7244b3a5726f5f11d6fb9414ea98d8ce9f10c88a" ,
"0x6ca011aae6d551a3efa533c40c24a810321c0384"
] ,
"socials" : [
{
"profileName" : "adeets-22" ,
"userId" : "323"
}
]
}
} ,
{
"followingAddress" : {
"addresses" : [
"0x66bd69c7064d35d146ca78e6b186e57679fba249" ,
"0xeaf55242a90bb3289db8184772b0b98562053559"
] ,
"socials" : [
{
"profileName" : "betashop.eth" ,
"userId" : "602"
}
]
}
}
// More users followed on Farcaster by 0x182327170fC284cAaA5b1bC3e3878233f529D741
]
}
}
}
Get All Farcaster Users Whose Names Start With Certain Terms (auto-complete)
You can fetch all Farcaster users that starts with given words by providing the regex pattern "^<given-words>"
to the _regex
operator in Socials
API:
Try Demo
Code
Query Response
Copy query MyQuery {
Socials(
input: {
filter : {
# This regex pattern will search all Farcaster users
# starting with "a"
profileName : { _regex : "^a" },
dappName : { _eq : farcaster}
},
blockchain : ethereum
}
) {
Social {
dappName
profileName
}
}
}
Copy {
"data" : {
"Socials" : {
"Social" : [
{
"dappName" : "farcaster" ,
"profileName" : "atty"
} ,
{
"dappName" : "farcaster" ,
"profileName" : "anita-mpf"
} ,
{
"dappName" : "farcaster" ,
"profileName" : "amarraghu"
}
// Other Farcaster users starting with "a"
]
}
}
}
Get All Farcaster Users Whose Names Contain Certain Terms (auto-complete)
You can fetch all Farcaster users that contains given words by providing "<given-words>"
directly to the _regex
operator in Socials
API:
Try Demo
Code
Query Response
Copy query MyQuery {
Socials(
input: {
filter : {
# This regex pattern will search all Farcaster users
# containing "abc"
profileName : { _regex : "abc" },
dappName : { _eq : farcaster}
},
blockchain : ethereum
}
) {
Social {
dappName
profileName
}
}
}
Copy {
"data" : {
"Socials" : {
"Social" : [
{
"dappName" : "farcaster" ,
"profileName" : "abcabc"
} ,
{
"dappName" : "farcaster" ,
"profileName" : "krabchinski"
} ,
{
"dappName" : "farcaster" ,
"profileName" : "861213abcc"
}
// Other Farcaster users containing with "abc"
]
}
}
}
Developer Support
If you have any questions or need help regarding the activate kit for Farcaster Auth Kit , please join our Airstack's Telegram group.
More Resources
Last updated 2 months ago