Get notified when someone tags your bot in a cast
@bot
fid
of your bot in the mentioned_fids
field for a cast.created
filter.
What this does is anytime a cast is created on the protocol, it checks if your bot that has that fid
is mentioned in the cast. If it is, it fires a webhook event to your backend.
fid
of your bot in the parent_author_fids
field. See screenshot below. This will fire an event for whenever someone casts a reply where your bot is the parent cast’s author.
cast.created
event. This is because webhook filters are logical OR
filters meaning that the event will fire if any one of the conditions are fulfilled. In this case, the webhook server will notify your backend if someone
mentioned_fids
filterparent_author_fids
filtertarget_url
. For the purpose of this demo, we used ngrok to create a public URL. You can also use a service like localtunnel that will forward requests to your local server. Note that free endpoints like ngrok, localtunnel, etc. usually have issues because service providers start blocking events. Ngrok is particularly notorious for blocking our webhook events. This is best solved by using a url on your own domain.
bun serve index.ts
, and run ngrok with ngrok http 3000
. Copy the ngrok URL and paste it into the “Target URL” field in the Neynar developer portal. The webhook will call the target URL every time the selected event occurs. Here, I’ve chosen to receive all casts that mention @neynar
in the text by putting in @neynar’s fid
: 6131.
Now the server will log out the event when it is fired. It will look something like this:
200
success to the webhook server else it will keep retrying the same event delivery.