In this guide, we’ll make a webhook which will send a DC to the user based on any action they perform on Farcaster! For this guide, I’ll send direct casts to people whose casts include a specific keyword.
target_url
. To test it out, we can use a service like ngrok to create a public URL that will forward requests to your local server.
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 all the casts created with neynarDC present in the text.
Now the server will log out the event when it is fired. It will look something like this:
<warpcast_api_key>
with the api key that you generated from the Warpcast dashboard.
In the request, we need to provide the FID to send the message to, the message body, and an idempotencyKey to retry if the request fails.
For the recipientFid
we are using the FID of the author of the cast and the idempotencyKey
is a random key generated by uuid
which we need to install and import: