Skip to main content

Group chat overview

Group chat is the latest exciting addition to Push Chat, for the first time ever, web3 users are finally able to talk to each other in web3 native groups and have fine-grained controls over them allowing new ways by which community can be engaged besides adding new utilities to your token. Group chat enables protocols or web3 projects to create —

  • DAO / NFT community
  • Private or public groups
  • Conditional / Gated group for joining or sending message
  • Gating based on tokens, NFTs, social following or custom endpoint
  • Ability to integrate in your UI (web / mobile) without users going to Discord, Telegram or breaking the UX

Create group API

// userAlice.chat.group.create(name, {options?})
const createdGroup = await userAlice.chat.group.create(name);

Create group parameters

ParamTypeSubtypeDefaultRemarks
namestring--The name of the group to be created.
optionsobject--Optional Configuration for creating group.
-options.descriptionstring-A description of the group.
-options.imagestring-Image for the group in Base64 format
-options.membersstring[][]An array of member recipients. Members supports a number of address format
-options.adminsstring[]-An array of admin recipients. Admins supports a number of address format
-options.privatebooleanfalseIndicates if the group is private.
-options.rulesany[]-Define conditions such as token gating, nft gating, custom endpoint for joining or sending message in a group. See conditional group gating to understand rule engine and how to fine tune conditional rules of your group

Note: Parameters in this style are mandatory.

Expected response
{
members: [
{
wallet: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9',
publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' +
'\n' +
'xsBNBGTvNZgBCADeYpZfxgn1HoMUuWM42v8ZWfLPwglQYmzz5rY3PdPPoRFU\n' +
'v0AyPjYKpmLh2ZNfXjPaS9GuMdpXaomYSEwsV02hXZOQelo9cLop0Fc2i+l7\n' +
'70rYhePuOuQ+XD/xYzhngAgNJ9rX96YnSodldb8uJfxYmgoF0E9Z2o2fgZGj\n' +
'll2CPnOaLXZaBQlPS3x/461TmZ1n2ZePS/fwiC7taLz3PtyGtKaC0vo4isvI\n' +
'yf04fkjudG0XIns5CWjdR2HeDC8BzSl8OVj8AQAc5uVU8Abk+ejWVr4zfoox\n' +
'eaziDPgGdkckFiQ6Tdsg0tPwwOpSrCCtJocTmc/fWaBb0YlnyAAL88fJABEB\n' +
'AAHNAMLAig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sf/VOoZJEOlb7tTk4+SpYtsGte5X/yLT5Bkls7Rp8ubK\n' +
'/V99muj1nA/OkasllXQUSGEweVz6ejzJ0oMm3Vewmw8PelsdAnfS7Ud1MnXQ\n' +
'h+O8TCR56F5gAMWxZmxFpZMZyUFOH6KM+vL7HJUBztUS2g0ELsHKy9ep2yhv\n' +
'iABIwx/gEuPr0NDAH9x9XFKg5m3rO64KTY4BRWBISwmQ25dM1s1bwDPLi5XI\n' +
'6Daw1glFxpPRrxgQGlVLzJOu5b8swQ==\n' +
'=9hCc\n' +
'-----END PGP PUBLIC KEY BLOCK-----\n',
isAdmin: true,
image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzUlEQVR4AcXBsWlDMRiF0c8XTeAJPIAgoFbgQew1PIbXyKsyhUGtCqM6ZAJX6Z32fykM4hnuObv71++TYJRKlHtji1EqUe6NSJgJM2G2W74/nkzIvfHKKJUZwkyYCbOUe+Odcm/MEGbCTJil2/VMdLx8Eo1S2SL3RnS7nomEmTATZmm//BANKlHujS1GqUT7hRVhJsyEWWLSKJVXcm/MEGbCTJgl/sm9EY1SmTFKJcq9EY1SiYSZMBNm6XE6sHJhJffGOz1OByJhJsyE2R/3lDA4e9QQhAAAAABJRU5ErkJggg=='
}
],
pendingMembers: [
{
wallet: 'eip155:0x119bb8ad40B1f94e2b30ae5f59eeaEB67cD0Bd6C',
publicKey: null,
isAdmin: false,
image: null
},
{
wallet: 'eip155:0x6e0C509d14EbF26A529bf6DC5CC9bee7F5b8DBa4',
publicKey: null,
isAdmin: false,
image: null
},
{
wallet: 'eip155:0xE3FDD0527a9F8418f9a7D9e970452827FbE202FF',
publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' +
'\n' +
'xsBNBGTvNZgBCADouo4S2kPqA//+I7nDAk15/LcJ2TGvDhOYuPNUNMiNGOb4\n' +
'txusuKz6HOaG+K9hiUBpHjKrYEmCT2FEXxt8bfS3SpWb74RHSk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
'fo4wkpEONHRH+LGX7GV0pwymHu42TUnULmED6BrMgMYG2sKpxMThxtAxRaiP\n' +
'nZ3DKXr8GCjTYnbEZpoi2zKCOQARAQABwsB2BBgBCAAqBYJk7zWYCZCrD2gy\n' +
'8Zu4awKbDBYhBKru9/u8wPcTeHibkasPaDLxm7hrAADGyQgA5NMUkoyDTPZa\n' +
'Znj1dB+17xBXCZ/u7pPQc1DukBefVke7/qYIicdnnEGIX3Zd7TckFRsDljR/\n' +
'3418Bne4WyL57fAF/GgYsegpJ9n1KT7oPxWzibIaYdj7R6bkDt5r61EDWC3N\n' +
'VBbnZu9cO15TYkObJIiyNvwbQyd6Dm313b39GnEE8sM709TWsI6Es6rRZAfC\n' +
'+sI8ezYxqVUbP7sW3jJZYzdPOhZPHvFd5iJ2EfygEOuk5tb7AimfNwF/CNcB\n' +
'weQGEU7feOSB9lXXA+Ag1duLM4B9bLbbHEQIPhKlBF1ED64e/W/5HNfoAkS4\n' +
'qhzOD5XWs6xs45nnYqUbBFLG9Xk+Jg==\n' +
'=qtAv\n' +
'-----END PGP PUBLIC KEY BLOCK-----\n',
isAdmin: false,
image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAw0lEQVR4AcXBsXECMRRF0csbdbAZBagHKlJMSOL90IUq2h5UABktLE6/HcizY4/fOafrcntzQB/BTKvBEcJMmAmz0keQtRpk67bzRQ1m1m0nu19E1keQCTNhJsxO1+X2JukjmHm+Ppg5Lw9mWg0yYSbMhFnhoPPy4C8JM2EmzArftBr8J2EmzIRZ6SPIWg2yPoKs1WCmjyBrNcj6CDJhJsyEWWk1OKKP4DdaDTJhJsyEWeEHrQbZuu3M3C/iCGEmzITZJ/s7LOkKUABjAAAAAElFTkSuQmCC'
}
],
contractAddressERC20: null,
numberOfERC20: 0,
contractAddressNFT: null,
numberOfNFTTokens: 0,
verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' +
'\n' +
'wsBzBAEBCAAnBYJk7zWZCZBMYqhmfI2WQRYhBC9DyzhpX3ACb/yTq0xiqGZ8\n' +
'jZZBAADwAwgAq/6WjtwRt1aPTLWwtSx80Ng/Wxf97dkpebMXSj9T7f5ia1rM\n' +
'8wqsuNUDMEMPB9LM34f6Q5pD994oeN2YT7z34u20mskiNphZdx/DNvu8w9UZ\n' +
'rI3tyjfZULhARNVM34sSABnHtExbl4ZArhNDsT86ku0sZNjr9frn2mtgmlKN\n' +
'nQdGcLJSxbci0hFg3nE5mYNpwZNs2S/2uk11WHKxzMhII6AdePE77BKPqedu\n' +
'PiXDODO2dIvV8glLQoJPRPgc2ap+/xYIBUFljqHGPU/62VSLlHxBJv72p5s/\n' +
'kOxiqD42TmpaaMtfudqgsZsGoYpZDHcMKYGNZs+9qVRHPRD+s0QhEA==\n' +
'=c6IF\n' +
'-----END PGP SIGNATURE-----\n',
groupImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==',
groupName: 'influential_maroon_gamefowl',
groupDescription: 'urgent_brown_butterfly',
isPublic: false,
groupCreator: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9',
chatId: '5f769c881ffe328117dea3d3acd0b97ce7f4c163e440f75a96be3e33f7d2a000',
meta: null,
scheduleAt: null,
scheduleEnd: null,
groupType: 'default',
status: null,
rules: {},
eventType: 'create'
}
ParameterTypeRemarks
membersArray<Object>An array containing member objects.
members.walletstringThe wallet address of the member.
members.publicKeystringThe member's public PGP key (if available).
members.isAdminbooleanIndicates whether the member is an admin.
members.imagestringImage associated with the member.
pendingMembersArray<Object>An array containing pending member objects.
pendingMembers.walletstringThe wallet address of the pending member.
pendingMembers.publicKeystringThe pending member's public PGP key (if available).
pendingMembers.isAdminbooleanIndicates whether the pending member is an admin.
pendingMembers.imagestringImage associated with the pending member.
contractAddressERC20string or nullContract address for ERC20 tokens (Used for tokenGating).
numberOfERC20numberThe number of ERC20 tokens associated. (Used for tokenGating).
contractAddressNFTstring or nullContract address for NFT tokens (Used for tokenGating)
numberOfNFTTokensnumberThe number of NFT tokens associated. (Used for tokenGating)
verificationProofstringVerification proof associated with group data.
groupImagestringGroup's image.
groupNamestringThe name of the group.
groupDescriptionstringDescription of the group.
isPublicbooleanIndicates whether the group is public or private.
groupCreatorstringPush Profile DID of the group creator.
chatIdstringUnique chat ID associated with the group.
metaobject or nullAdditional metadata (if available).
scheduleAttimestamp or nullScheduled start time (if available).
scheduleEndtimestamp or nullScheduled end time (if available).
groupTypestringType of the group (default, spaces, live etc).
statusstring or nullStatus information ( active, expired etc)
rulesObjectGroup-specific moderation rules
eventTypestringThe type of event (create, update etc)

Learn about conditional rules to understand how groups permissions such as joining group or sending messages can be customized for your community or needs.


Create group interface

interface GroupRules {
entry?: { conditions?: any[] };
chat?: { conditions?: any[] };
}

interface GroupOptions {
description?: string;
image?: string; // base 64 encoded string
members?: string[];
admins?: string[];
private?: boolean;
rules?: GroupRules;
}

interface CreateGroupParams {
name: string;
options?: GroupOptions;
}

const createdGroup = async ({ name, options }: CreateGroupParams): Promise<any> => {
// Your implementation here
};

// Example
const groupName = "Example Group";
const groupDescription = "This is an example group.";
const groupImage = "data:image/png;base64,iVBORw0K..."; // example base64 encoded image string
const walletAddress1 = "0x123...";
const walletAddress2 = "0x456...";
const walletAddress3 = "0x789...";

const newGroup = await userAlice.chat.group.create(groupName,
{
description: groupDescription,
image: groupImage,
members: [walletAddress1, walletAddress2, walletAddress3],
admins: [],
private: false,
rules: {
entry: { conditions: [] },
chat: { conditions: [] },
},
},
});

Creating a gated group

Groups can be gated based on a number of conditions such as token gating, NFT gating, or Guild gating. Learn more about conditional rules for group to understand how to fine tune conditional rules of your group.