description |
---|
Learn how to integrate Airstack Hubs HTTP API into your Farcaster app within minutes. |
First, install the necessary dependencies to your project:
{% tabs %} {% tab title="npm" %}
npm i axios dotenv
{% endtab %}
{% tab title="yarn" %}
yarn add axios dotenv
{% endtab %}
{% tab title="pnpm" %}
pnpm install axios dotenv
{% endtab %}
{% tab title="bun" %}
bun install axios dotenv
{% endtab %} {% endtabs %}
Then, you can connect and call to Airstack Hubs HTTP API by using library such as axios
and provide the URL with the Airstack API key added to the headers field x-airstack-hubs
:
{% tabs %} {% tab title="axios" %}
import axios from "axios";
import { config } from "dotenv";
config();
const main = async () => {
const server = "https://hubs.airstack.xyz";
try {
const response = await axios.get(`${server}/v1/info?dbstats=1`, {
headers: {
"Content-Type": "application/json",
// Provide API key here
"x-airstack-hubs": process.env.AIRSTACK_API_KEY as string,
},
});
console.log(response);
console.log(json);
} catch (e) {
console.error(e);
}
}
main();
{% endtab %} {% endtabs %}
Once you have the HTTP API integrated, you can start exploring all the APIs offered:
- Casts
- Reactions
- Links
- User Data
- FIDs
- Storage
- Username Proofs
- Verifications
- Message
- Hub Events
- Onchain Events
If you have any questions or need help regarding integrating Airstack HTTP API into your Farcaster app, please join our Airstack's Telegram group.