Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33411211
D13785.1768992340.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D13785.1768992340.diff
View Options
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
@@ -5,6 +5,7 @@
import invariant from 'invariant';
import bots from 'lib/facts/bots.js';
+import { inviteLinkURL } from 'lib/facts/links.js';
import { extractKeyserverIDFromID } from 'lib/keyserver-conn/keyserver-call-utils.js';
import { createSidebarThreadName } from 'lib/shared/sidebar-utils.js';
import { type NeynarWebhookCastCreatedEvent } from 'lib/types/farcaster-types.js';
@@ -200,6 +201,7 @@
const event = assertWithValidator(body, taggedCommFarcasterInputValidator);
const eventTaggerFID = event.data.author.fid;
+ const neynarConfigPromise = getNeynarConfig();
const taggerUserIDPromise = getVerifiedUserIDForFID(
eventTaggerFID.toString(),
);
@@ -285,13 +287,32 @@
}
const inviteLinkName = Math.random().toString(36).slice(-9);
- const inviteLink = await createOrUpdatePublicLink(commbotViewer, {
- name: inviteLinkName,
- communityID: channelCommunityID,
- threadID: sidebarThreadResponse.newThreadID,
- });
- console.log(inviteLink);
+ const [inviteLink, neynarConfig] = await Promise.all([
+ createOrUpdatePublicLink(commbotViewer, {
+ name: inviteLinkName,
+ communityID: channelCommunityID,
+ threadID: sidebarThreadResponse.newThreadID,
+ }),
+ neynarConfigPromise,
+ ]);
+
+ const introText = 'I created a thread on Comm. Join the conversation here:';
+ const replyText = `${introText} ${inviteLinkURL(inviteLink.name)}`;
+
+ if (!neynarConfig?.signerUUID) {
+ throw new ServerError('missing_signer_uuid');
+ }
+
+ const postCastResponse = await neynarClient?.postCast(
+ neynarConfig.signerUUID,
+ castHash,
+ replyText,
+ );
+
+ if (!postCastResponse?.success) {
+ throw new ServerError('post_cast_failed');
+ }
}
export { taggedCommFarcasterResponder, taggedCommFarcasterInputValidator };
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 21, 10:45 AM (19 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5968184
Default Alt Text
D13785.1768992340.diff (2 KB)
Attached To
Mode
D13785: [keyserver] reply on farcaster with invite link
Attached
Detach File
Event Timeline
Log In to Comment