diff --git a/keyserver/src/responders/farcaster-webhook-responders.js b/keyserver/src/responders/farcaster-webhook-responders.js --- a/keyserver/src/responders/farcaster-webhook-responders.js +++ b/keyserver/src/responders/farcaster-webhook-responders.js @@ -323,11 +323,11 @@ throw new ServerError('missing_signer_uuid'); } - const postCastResponse = await neynarClient?.postCast( - neynarConfig.signerUUID, - castHash, - replyText, - ); + const postCastResponse = await neynarClient?.postCast({ + signerUUID: neynarConfig.signerUUID, + parent: castHash, + text: replyText, + }); if (!postCastResponse?.success) { throw new ServerError('post_cast_failed'); diff --git a/lib/utils/neynar-client.js b/lib/utils/neynar-client.js --- a/lib/utils/neynar-client.js +++ b/lib/utils/neynar-client.js @@ -345,17 +345,29 @@ } } - async postCast( - signerUUID: string, - parent: string, - text: string, - ): Promise { + async postCast(params: { + +signerUUID: string, + +parent: string, + +text?: ?string, + +embeds?: ?$ReadOnlyArray<{ +url: string }>, + }): Promise { const url = getNeynarURL('2', 'cast', {}); - const body = { - signer_uuid: signerUUID, + const body: { + signer_uuid: string, + parent: string, + text?: string, + embeds?: $ReadOnlyArray<{ +url: string }>, + } = { + signer_uuid: params.signerUUID, parent, - text, }; + + if (params.embeds) { + body.embeds = params.embeds; + } + if (params.text) { + body.text = params.text; + } try { const response = await fetch(url, { method: 'POST',