Skip to content

Neynar

Neynar is a Farcaster development platform that provides intuitive APIs to build on Farcaster.

Import

import { neynar } from 'frog/middlewares'

Usage

import { Frog } from 'frog'
import { neynar } from 'frog/middlewares'
 
export const app = new Frog()
  .use(
    neynar({
      apiKey: 'NEYNAR_FROG_FM',
      features: ['interactor', 'cast'],
    }),
  )

Parameters

apiKey

  • Type: string

Neynar API key.

import { Frog } from 'frog'
import { neynar } from 'frog/middlewares'
 
export const app = new Frog()
  .use(
    neynar({
      apiKey: 'NEYNAR_FROG_FM',
      features: ['interactor', 'cast'],
    }),
  )

features

  • Type: ('interactor' | 'cast')[]

Set of features to enable and inject into context.

  • 'interactor': Fetches the user who interacted with the frame.
  • 'cast': Fetches the cast of the frame.
import { Frog } from 'frog'
import { neynar } from 'frog/middlewares'
 
export const app = new Frog()
  .use(
    neynar({
      apiKey: 'NEYNAR_FROG_FM',
      features: ['interactor', 'cast'],
    }),
  )

createNeynar

Convenience utility to setup a Neynar hub and middleware with a single apiKey.

Import

import { createNeynar } from 'frog/middlewares'

Usage

import { Frog } from 'frog'
import { createNeynar } from 'frog/middlewares'
 
const neynar = createNeynar({ apiKey: 'NEYNAR_FROG_FM' })
 
export const app = new Frog({
  hub: neynar.hub(),
})
  .use(
    neynar.middleware({ features: ['interactor', 'cast'] }),
  ) 

Parameters

import { type CreateNeynarParameters } from 'frog/middlewares'

apiKey

  • Type: string

Neynar API key.

Return Type

import { type 
type CreateNeynarReturnType = { hub: (parameters?: Pretty<Omit<NeynarHubParameters, 'apiKey'>>) => Hub; middleware: (parameters: Pretty<Omit<NeynarMiddlewareParameters, 'apiKey'>>) => MiddlewareHandler<{ Variables: NeynarVariables; }>; }
CreateNeynarReturnType
} from 'frog/middlewares'