feat: neynar data in opengraph share image

This commit is contained in:
veganbeef
2025-05-09 10:55:22 -07:00
parent f3f8924fa9
commit 681f287c20
6 changed files with 49 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
import { NeynarAPIClient, Configuration } from '@neynar/nodejs-sdk';
import { NeynarAPIClient, Configuration, WebhookUserCreated } from '@neynar/nodejs-sdk';
import { APP_URL } from './constants';
let neynarClient: NeynarAPIClient | null = null;
@@ -18,6 +18,19 @@ export function getNeynarClient() {
return neynarClient;
}
type User = WebhookUserCreated['data'];
export async function getNeynarUser(fid: number): Promise<User | null> {
try {
const client = getNeynarClient();
const usersResponse = await client.fetchBulkUsers({ fids: [fid] });
return usersResponse.users[0];
} catch (error) {
console.error('Error getting Neynar user:', error);
return null;
}
}
type SendFrameNotificationResult =
| {
state: "error";