Custom Feeds

This guide will introduce the concept of Custom Feeds and how to create and manage them.


This guide provides an introduction to the concept of Custom Feeds. More information will be provided in due course.

As mentioned in the Feed concept page, there are two classes of Feed instances:

  • The Global Feed: The familiar shared feed that aggregates all public Lens activity.

  • Custom Feeds: App or community-specific feeds that can be open or governed by Feed Rules.

Create a Custom Feed

To create an Feed, you need to:

  1. Create an Feed Metadata object

  2. Upload the Feed Metadata object onto a public URI.

  3. Deploy the Lens Feed smart contract.

See the Lens Metadata Standards guide for more information on creating and hosting Metadata objects.

1

Create Feed Metadata

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

Example
import { feed } from "@lens-protocol/metadata";
const metadata = feed({  name: "XYZ",  title: "Not Just Another Feed… or is it?",  description: "My custom feed description",});

2

Upload Feed Metadata

Then, upload the Feed Metadata object to a public URI.

import { uploadJson } from "./my-upload-lib";
const metadataURI = await uploadJson(metadata); // e.g., lens://4f91ca…

3

Deploy Feed Contract

You can use the createFeed mutation to deploy the Lens Feed smart contract.

You MUST be authenticated as Builder to make this request.

mutation {  createFeed(    request: {      metadataUri: "lens://4f91cab87ab5e4f5066f878b72…"
      # optional list of admins      # admins: [EvmAddress!]
      # other fields such as feed rules configuration      # will be documented in due course    }  ) {    ... on CreateFeedResponse {      hash    }
    ... on SelfFundedTransactionRequest {      ...SelfFundedTransactionRequest    }
    ... on TransactionWillFail {      reason    }  }}

Finally, handle the result as explained in the Transaction Lifecycle guide.

Fetch a Feed

Use the feed query to fetch a single Feed by address or by transaction hash.

query {  feed(    request: {      feed: "0xdeadbeef…"
      # OR
      # txHash: TxHash!    }  ) {    address
    # other fields such as feed rules    # will be documented in due course  }}