Action History

Learn how to retrieve the action history of the authenticated profile.

You must be authenticated with the Profile you intent retrieving action history for. See Profile Login for more information.

Profile Action History

The Lens backend keeps track of various types of actions. Refer to the ProfileActionHistoryType enum below for a complete list of available action types.

enum ProfileActionHistoryType {  // An Open Action was executed  Acted = "ACTED",
  // A Profile was blocked  Blocked = "BLOCKED",
  // A publication was collected  Collected = "COLLECTED",
  // A comment was posted  Comment = "COMMENT",
  // A Profile was followed  Follow = "FOLLOW",
  // An Handle was linked to the Profile  LinkHandle = "LINK_HANDLE",
  // The Profile logged in  LoggedIn = "LOGGED_IN",
  // A publication was mirrored  Mirror = "MIRROR",
  // A new post was created  Post = "POST",
  // A publication was quoted  Quote = "QUOTE",
  // The Profile refreshed their auth token  RefreshAuthToken = "REFRESH_AUTH_TOKEN",
  // The Profile metadata was updated  SetProfileMetadata = "SET_PROFILE_METADATA",
  // The Profile Follow Module was updated  SetProfileModule = "SET_PROFILE_MODULE",
  // A Profile was unblocked  Unblocked = "UNBLOCKED",
  // A Profile was unfollowed  Unfollow = "UNFOLLOW",
  // An Handle was unlinked from the Profile  UnlinkHandle = "UNLINK_HANDLE",}

Use the useProfileActionHistory hook to retrieve the action history of the authenticated profile.

import { useProfileActionHistory } from '@lens-protocol/react-web';
function ActionHistory() {  const { data, loading, error } = useProfileActionHistory();
  if (loading) return <p>Loading...</p>;
  if (error) return <p>Error: {error.message}</p>;
  return (    <ul>      { => (        <div key={}>          {item.actionType} {item.actionedOn}        </div>      ))}    </ul>  );}

The hook yields a PaginatedReadResult<ProfileActionHistory[]>. For more information on pagination, refer to this guide.

Latest Paid Actions

The Latest Paid Actions is a feed of all paid actions performed by the authenticated profile. This includes paid follows and open actions that require payment, such as paid collects.

You can use the useLatestPaidActions hook to get a paginated list of the latest paid actions.

Available in @lens-protocol/react-web and @lens-protocol/react-native

import { useLatestPaidActions } from '@lens-protocol/react-web';
import { PaidActionItem } from  './PaidActionItem';
function PaidActions() {  const { data, loading, error } =  useLatestPaidActions();
  if (loading) return <div>Loading...</div>;
  if (error) return <div>Error: {error.message}</div>;
  return (    {data.length === 0 && <p>No paid actions found.</p>}
    { => (      <PaidActionItem key={item.latestActed[0].actedAt} action={item} />    ))}  );}

The hook returns PaginatedReadResult<Array<AnyPaidAction>>. For more information on pagination, refer to this guide.

That's it—you now know how to surface different types of the action history for the authenticated profile.