Create a Group

This guide will help you create a Group on Lens.


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

To create an Group, you need to:

  1. Create an Group Metadata object

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

  3. Deploy the Lens Group smart contract.

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

1

Create Group Metadata

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

Example
import { group } from "@lens-protocol/metadata";
const metadata = group({  name: "XYZ",  slug: "xyz",  description: "My group description",  icon: "lens://BsdfA...",});

2

Upload Group Metadata

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

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

3

Deploy Group Contract

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

You MUST be authenticated as Builder to make this request.

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

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

That's it—you have successfully created a Group on Lens!