Help & Support

Manage Apps

This guide explains how to manage Apps on Lens.

Update App Metadata

To update the metadata of an existing app, follow these steps.

You MUST be authenticated as Builder and be owner or admin of the App to update its metadata.

1

Create New App Metadata

First, construct an App Metadata object with the new content.

Use the @lens-protocol/metadata package to construct a valid AppMetadata object:

Example
import { MetadataAttributeType, app } from "@lens-protocol/metadata";
const metadata = app({  name: "XYZ",  tagline: "The next big thing",  description: "An app to rule them all",  logo: "lens://4f91cab87ab5e4f5066f878b72…",  developer: "John Doe <[email protected]>",  url: "https://example.com",  termsOfService: "https://example.com/terms",  privacyPolicy: "https://example.com/privacy",  platforms: ["web", "ios", "android"],});

2

Upload App Metadata

Next, upload the App Metadata object to a public URI.

import { storageClient } from "./storage-client";
const { uri } = await storageClient.uploadAsJson(metadata);
console.log(uri); // e.g., lens://4f91ca…

This example uses Grove storage to host the Metadata object. See the Lens Metadata Standards guide for more information on hosting Metadata objects.

3

Update New Custom App Metadata

Next, update the app metadata using setAppMetadata action.

Example
import { uri, evmAddress } from "@lens-protocol/client";import { setAppMetadata } from "@lens-protocol/client/actions";
// …
const result = await setAppMetadata(sessionClient, {  metadataUri: uri("lens://4f91…"), // the URI with new metadata  app: evmAddress("0x1234…"),});

4

Handle Result

Finally, handle the result using the adapter for the library of your choice:

import { handleOperationWith } from "@lens-protocol/client/viem";
// …
const result = await setAppMetadata(sessionClient, {  metadataUri: uri("lens://4f91…"),  app: evmAddress("0x1234…"),}).andThen(handleOperationWith(walletClient));

See the Transaction Lifecycle guide for more information on how to determine the status of the transaction.

Update App Feeds

To update the custom feeds of an existing app, follow these steps.

You MUST be authenticated as Builder and be owner or admin of the App to update its feeds.

1

Update the App Feeds

First, update the custom feeds in an app using addAppFeeds or removeAppFeeds actions.

import { evmAddress } from "@lens-protocol/client";import { addAppFeeds } from "@lens-protocol/client/actions";
// …
const result = await addAppFeeds(sessionClient, {  feeds: [evmAddress("0x4546…")],  app: evmAddress("0x1234…"),});

2

Handle Result

Then, handle the result using the adapter for the library of your choice:

import { handleOperationWith } from "@lens-protocol/client/viem";
// …
const result = await addAppFeeds(sessionClient, {  feeds: ['0x4567…']  app: evmAddress("0x1234…")}).andThen(handleOperationWith(walletClient));

See the Transaction Lifecycle guide for more information on how to determine the status of the transaction.

Set App Default Feed

To set the default feed for an app, follow these steps.

You MUST be authenticated as Builder and be owner or admin of the App to set its default feed.

1

Update App Default Feed

First, use setDefaultAppFeed action to set the default feed of an app.

import { evmAddress } from "@lens-protocol/client";import { setDefaultAppFeed } from "@lens-protocol/client/actions";
// …
const result = await setDefaultAppFeed(sessionClient, {  feed: { custom: evmAddress("0x4546…") },  app: evmAddress("0x1234…"),});

2

Handle Result

Then, handle the result using the adapter for the library of your choice:

import { handleOperationWith } from "@lens-protocol/client/viem";
// …
const result = await setDefaultAppFeed(sessionClient, {  feeds: { global: true },  app: evmAddress("0x1234…"),}).andThen(handleOperationWith(walletClient));

See the Transaction Lifecycle guide for more information on how to determine the status of the transaction.

Update App Graph

To update the graph of an existing app, follow these steps.

You MUST be authenticated as Builder and be owner or admin of the App to update its graph.

1

Set New Custom App Graph

First, use setAppGraph action to update or set the graph of an existing app.

import { evmAddress } from "@lens-protocol/client";import { setAppGraph } from "@lens-protocol/client/actions";
// …
const result = await setAppGraph(sessionClient, {  graph: { custom: evmAddress("0x1234…") },  app: evmAddress("0x1234…"),});

2

Handle Result

Then, handle the result using the adapter for the library of your choice:

import { handleOperationWith } from "@lens-protocol/client/viem";
// …
const result = await setAppGraph(sessionClient, {  graph: { globalGraph: true },  app: evmAddress("0x1234…"),}).andThen(handleOperationWith(walletClient));

See the Transaction Lifecycle guide for more information on how to determine the status of the transaction.

App Treasury

To update the treasury of an existing app, follow these steps.

You MUST be authenticated as Builder and be owner or admin of the App to update its treasury.

1

Update App Treasury

First, use setAppTreasury action to update or set the treasury of an existing app.

Example
import { evmAddress } from "@lens-protocol/client";import { setAppTreasury } from "@lens-protocol/client/actions";
// …
const result = await setAppTreasury(sessionClient, {  treasury: evmAddress('0x4567…')  app: evmAddress('0x1234…')});

2

Handle Result

Then, handle the result using the adapter for the library of your choice:

import { handleOperationWith } from "@lens-protocol/client/viem";
// …
const result = await setAppTreasury(sessionClient, {  treasury: evmAddress("0x4567…"),  app: evmAddress("0x1234…"),}).andThen(handleOperationWith(walletClient));

See the Transaction Lifecycle guide for more information on how to determine the status of the transaction.

App Sponsorship

To update the sponsorship of an existing app, follow these steps.

You MUST be authenticated as Builder and be owner or admin of the App to update its sponsorship.

1

Update App Sponsorship

First, use setAppSponsorship action to update or set the sponsorship of an existing app.

Example
import { evmAddress } from "@lens-protocol/client";import { setAppSponsorship } from "@lens-protocol/client/actions";
// …
const result = await setAppSponsorship(sessionClient, {  app: evmAddress("0x1234…"),  sponsorship: evmAddress("0x4567…"),});

2

Handle Result

Then, handle the result using the adapter for the library of your choice:

import { handleOperationWith } from "@lens-protocol/client/viem";
// …
const result = await setAppSponsorship(sessionClient, {  sponsorship: evmAddress("0x4567…"),  app: evmAddress("0x1234…"),}).andThen(handleOperationWith(walletClient));

See the Transaction Lifecycle guide for more information on how to determine the status of the transaction.

Group Management

App Groups allow you to organize initiatives or projects within your application.

Fetch App Groups

Use the fetchAppGroups action to fetch a list of groups using an App.

import { evmAddress } from "@lens-protocol/client";import { fetchAppGroups } from "@lens-protocol/client/actions";
import { client } from "./client";
const result = await fetchAppGroups(client, {  app: evmAddress("0x1234…"),});
if (result.isErr()) {  return console.error(result.error);}
// items: Array<Group>const { items, pageInfo } = result.value;

See the Pagination guide for more information on how to handle paginated results.

Add App Groups

To add groups to your app, follow these steps.

You MUST be authenticated as Builder and be the owner or admin of the App to add groups.

1

Add Groups to App

Use the addAppGroups action to add groups to an app.

Example
import { evmAddress } from "@lens-protocol/client";import { addAppGroups } from "@lens-protocol/client/actions";
const result = await addAppGroups(sessionClient, {  app: evmAddress("0x1234…"),  groups: [evmAddress("0x5678…"), evmAddress("0x9012…")],});
if (result.isErr()) {  return console.error(result.error);}

2

Handle Result

Finally, handle the result using the adapter for the library of your choice:

import { handleOperationWith } from "@lens-protocol/client/viem";
// …
const result = await addAppGroups(sessionClient, {  app: evmAddress("0x1234…"),  groups: [evmAddress("0x5678…"), evmAddress("0x9012…")],})  .andThen(handleOperationWith(walletClient))  .andThen(sessionClient.waitForTransaction);

See the Transaction Lifecycle guide for more information on how to determine the status of the transaction.

Remove App Groups

To remove groups from your app, follow these steps.

You MUST be authenticated as Builder and be the owner or admin of the App to remove groups.

1

Remove Groups from App

Use the removeAppGroups action to remove groups from an app.

Example
import { evmAddress } from "@lens-protocol/client";import { removeAppGroups } from "@lens-protocol/client/actions";
const result = await removeAppGroups(sessionClient, {  app: evmAddress("0x1234…"),  groups: [evmAddress("0x5678…"), evmAddress("0x9012…")],});
if (result.isErr()) {  return console.error(result.error);}

2

Handle Result

Finally, handle the result using the adapter for the library of your choice:

import { handleOperationWith } from "@lens-protocol/client/viem";
// …
const result = await removeAppGroups(sessionClient, {  app: evmAddress("0x1234…"),  groups: [evmAddress("0x5678…"), evmAddress("0x9012…")],})  .andThen(handleOperationWith(walletClient))  .andThen(sessionClient.waitForTransaction);

See the Transaction Lifecycle guide for more information on how to determine the status of the transaction.

See the Groups section for more information on creating and managing individual groups.

Access Control

The App contract supports two roles: Owner and Administrator.

Administrators can:

  • Update the App Metadata

  • Update the App Rules

  • Update the App Feeds and Graph

  • Update the App Treasury

  • Update the App Sponsorship

The Owner can do everything the administrators can do, plus transfer ownership of the App to another address.

See the Team Management guide for more information on how to manage these roles.