Boost Engagement
This guide will show you the essential signal-boosting features on Lens.
Reposting
Users can repost any Post to their own Feed, another Feed, or even the Global Lens Feed. Reposting is an effective way for users to amplify content they find valuable and share it with their followers.
You MUST be authenticated as Account Owner or Account Manager to repost content on Lens.
First, inspect the post.operations.canRepost field to determine whether the logged-in Account is allowed to repost it. Some posts may have restrictions on who can repost them.
Check Rules
switch (post.operations.canRepost.__typename) { case "PostOperationValidationPassed": // Reposting is allowed break;
case "PostOperationValidationFailed": // Reposting is not allowed console.log(post.operations.canRepost.reason); break;
case "PostOperationValidationUnknown": // Validation outcome is unknown break;}
Where:
PostOperationValidationPassed: The logged-in Account can repost the Post.
PostOperationValidationFailed: Reposting is not allowed. The reason field explains why, and unsatisfiedRules lists the unmet requirements.
PostOperationValidationUnknown: The Post or its Feed (for custom Feeds) has one or more unknown rules requiring ad-hoc verification. The extraChecksRequired field provides the addresses and configurations of these rules.
Treat the PostOperationValidationUnknown as failed unless you intend to support the specific rules. See Post Rules for more information.
Next, if the Post allows reposting, you can proceed to repost it.
You MUST repost on the same Feed as the original Post. Cross-feed quoting is currently not supported. If you find this feature valuable, please let us know by opening an issue.
- TypeScript
- GraphQL
- React
Use the repost action to repost on Lens.
- TypeScript
- GraphQL
- React
Then, handle the result using the adapter for the library of your choice:
See the Transaction Lifecycle guide for more information on how to determine the status of the transaction.
Reactions
Reactions let users express their opinion on a Post, providing immediate feedback to the Post's author on how their content resonates with the audience.
Currently, reactions are not stored on-chain. We plan to implement a decentralized solution in the future that maintains a smooth user experience while aligning with the web3 ethos.
Add a Reaction
At present, users can react to a Post with an upvote or downvote. In the future, more reaction options may be introduced to offer a wider range of engagement possibilities.
You MUST be authenticated as Account Owner or Account Manager to make this request.
- TypeScript
- GraphQL
- React
Use the addReaction action to add a reaction to a Post.
Add Reaction
import { PostReactionType, postId } from "@lens-protocol/client";import { addReaction } from "@lens-protocol/client/action";
const result = await addReaction(sessionClient, { post: postId("42"), reaction: , PostReactionType.Upvote // or Downvote});
if (result.isErr()) { return console.error(result.error);}
// Boolean indicating success adding the reactionconst success = result.value;
Undo a Reaction
Users can undo their reaction to a Post at any time.
You MUST be authenticated as Account Owner or Account Manager to make this request.
- TypeScript
- GraphQL
- React
Use the undoReaction action to remove a reaction from a Post.
Undo Reaction
import { PostReactionType, postId } from "@lens-protocol/client";import { undoReaction } from "@lens-protocol/client/action";
const result = await undoReaction(sessionClient, { post: postId("42"), reaction: , PostReactionType.Upvote // or Downvote});
if (result.isErr()) { return console.error(result.error);}
// Boolean indicating success adding the reactionconst success = result.value;
Fetch Reactions
- TypeScript
- GraphQL
- React
Use the paginated fetchPostReactions action to fetch the reactions for a Post.
See the Pagination guide for more information on how to handle paginated results.