createChannel
⚠️
Channels have been deprecated in favor of Contexts. Check out createContext.
Will create a new channel in an existing group. Can only be used by the admin of a group
How to use?
const res = await orbis.createChannel(group_id, options);Parameters
group_id- (stream) ID of the group in which this channel should beoptions- Object which contains the details of the channelgroup_id-stringID of the group this channel is part ofname-stringName of the channeldescription-stringDescription of the channeltype-stringDisplay type for the channel, can be:chat- If the channel should be displayed as a group chat like Discordfeed- If the posts shared are longer with comments and threads
encryptionRules-objectoptionalA JSON object containing the optional encryption rules for this channel. Those rules must then be passed as a parameter to the createPost function.type-stringThe type of encryption needed, only token-gated is supported for now.chain-stringThe chain on which the smart contract is. Must be one of those in lowercasecontractType-stringThe type of contract being used, must be ERC20, ERC721 or ERC1155.contractAddress-stringThe address of the contract.minTokenBalance-stringThe minimum balance required to decrypt the post (in WEI for ERC20).tokenId-stringoptionalUsed only for ERC1155 tokens to represent the tokenId used.
vcAccessRules-arrayoptionalThe list of credentials requested to share content in this channel.key-stringThe key to check in the credential JSON object.id-stringThe value expected for the keyrule-stringCan be = or includes. It will be used to check if the key is equal to the id or if it should simply include it.issuer-stringThe did issuing the credential.
data-objectoptionalCan be used to attach some custom data to a channel
Returns
{
status: 200,
doc: "kjzl6cwe1...e4wvxhiqj",
result: "Success creating TileDocument."
}Examples
Access Gating via Gitcoin Passport
Creates a channel that requires users to have a Github Credential in their Gitcoin Passport.
const res = await orbis.createChannel(
"kjzl6cwe1...e4wvxhiqj",
{
group_id: "kjzl6cwe1...e4wvxhiqj",
pfp: "https://...",
name: "developers-only",
description: "Channel restricted to developers.",
"vcAccessRules": [
{
"id": "GitHub",
"key": "provider",
"rule": "=",
"issuer": "did:key:z6mkghvghlobledj1bgrlhs4lpgjavbma1tn2zcryqmyu5lc"
}
]
}
);