Help & Support

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",  description: "My group description",  icon: "lens://BsdfA...",});

2

Upload Group Metadata

Then, upload the Group 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 Lens Storage to host the Metadata object. See the Lens Metadata Standards guide for more information on hosting Metadata objects.

3

Deploy Group Contract

Then, use the createGroup action to deploy the Lens Group smart contract.

You MUST be authenticated as Builder to make this request.

import { uri } from "@lens-protocol/client";import { createGroup } from "@lens-protocol/client/actions";
const result = await createGroup(sessionClient, {  metadataUri: uri("lens://4f91c…"),});

4

Handle Result

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

import { handleWith } from "@lens-protocol/client/viem";
// …
const result = await createGroup(sessionClient, {  metadataUri: uri("lens://4f91ca…"),}).andThen(handleWith(walletClient));

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


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