Incoming webhooks allow you to receive real-time notifications about Farcaster events. Consider the following use cases.
- watch a channel - get events for any new casts on a specific channel
- watch a user - get events for any new casts from a specific user
- watch a mention - get events when a specific user gets @ mentioned in a cast
You’ll need to configure 2 things before you can start receiving Farcaster events via webhooks.
It’s not possible to use webhooks on frontend-only apps
1. Create a webhook
Create a REST API route with the POST method on your backend to handle the webhook events. It should be able to handle incoming data with Content-Type set to application/json format.
To test that your webhook is set up correctly, try this curl
curl -X POST \
-d '{"event" : "test"}' \
-H 'Content-Type: application/json' \
https://api.your-farcaster-app.com/webhooks/neynar
2. Register the webhook details on the Neynar Dev Portal
Set this outgoing webhook URL on the Neynar developer portal. See How to Use Neynar Webhooks for how.
https://api.your-farcaster-app.com/webhooks/neynar
A webhook should be configured with at least 1 valid event subscription. Each webhook can support multiple event types and/or multiple subscriptions for the same type. Some subscriptions require one or more parameters to be configured before you can start receiving the relevant events.
Event types supported
-
cast.created Subscriptions supported
- Authors - Get events for new casts & replies by a specific user
- Root Parent Url - Get events for new casts & replies in a specific channel
- Parent Url - Get events for new casts (but not replies) in a specific channel
- Mentions - Get events when a specific user gets @ mentioned in a cast
-
user.updated Subscriptions supported
- User - Get profile update events for specific users
You’re all set! You’ll start receiving events on your backend.
Contact us on Slack.