Learn how to integrate Airstack Hubs GRPC API into your Farcaster app within minutes.

Step 1: Install Dependencies

First, install the necessary dependencies to your project:

npm i @farcaster/hub-nodejs dotenv

Step 2: Connect to GRPC API

Then, you can connect and call to Airstack Hubs GRPC API by using the @farcaster/hub-nodejs library offered by the Farcaster team by providing the GRPC URL with the Airstack API key added to the metadata field x-airstack-hubs:

import {
} from '@farcaster/hub-nodejs';
import { config } from "dotenv";


// Instantiate the gRPC client for a secure connection
const client = getSSLHubRpcClient('hubs-grpc.airstack.xyz');

client.$.waitForReady(Date.now() + 5000, async (e) => {
  if (e) {
    console.error(`Failed to connect to the gRPC server:`, e);
  } else {
    console.log(`Connected to the gRPC server`);
    const metadata = new Metadata();
    // add API key here
    metadata.add("x-airstack-hubs", process.env.AIRSTACK_API_KEY as string);

    // After everything, close the RPC connection

Next Steps

Once you have the GRPC API integrated, you can start exploring all the APIs offered:

Developer Support

If you have any questions or need help regarding integrating Airstack GRPC API into your Farcaster app, please join our Airstack's Telegram group.

More Resources

Last updated