Skip to content
On this page

Partner: CommunityInfo API ​

EndpointMethodDescription
/api/v0/partnerRpc/communityInfo.userHasViewPermissionForCommunityjsonRpcUser has view permission for community
/api/v0/partnerRpc/communityInfo.userHasViewPermissionForCommunityChanneljsonRpcUser has view permission for community channel
/api/v0/partnerRpc/communityInfo.listCommunityChannelsjsonRpcList community channels
/api/v0/partnerRpc/communityInfo.listCommunitySubChannelsjsonRpcList community sub channels
/api/v0/partnerRpc/communityInfo.listCommunityChannelMessagesjsonRpcList community channel messages

User has view permission for community ​

Method: jsonRpc

HTTP Method: POST

Path: /api/v0/partnerRpc/communityInfo.userHasViewPermissionForCommunity

Description: API returns true if user has permission to view community.

Request:

{
    "userId": string
    "communityId": string
}

Response:

{
    "data": {
        "hasPermission": bool
    }
    "error": { "status": bool, "code": int, "message": string }
}

User has view permission for community channel ​

Method: jsonRpc

HTTP Method: POST

Path: /api/v0/partnerRpc/communityInfo.userHasViewPermissionForCommunityChannel

Description: API returns true if user has permission to view community channel.

Request:

{
    "userId": string
    "communityId": string
    "channelId": string
}

Response:

{
    "data": {
        "hasPermission": bool
    }
    "error": { "status": bool, "code": int, "message": string }
}

List community channels ​

Method: jsonRpc

HTTP Method: POST

Path: /api/v0/partnerRpc/communityInfo.listCommunityChannels

Description: API returns channels of the community.

Request:

{
    "communityId": string
    "afterChannelId": string  // pagination cursor, get channels after this channel id
    "limit": int  // max number of channels to return (1-100)
}

Response:

{
    "data": {
        "channels": [{
            "sourceString": string  // textchat channel belonging source
            "channelId": string  // textchat channel id
            "title": string  // channel title
            "settings": map[string]{ custom structure }  // channel settings, like permissions for community channel
            "contentDirectoryId": string  // content directory resource id, for CMS
            "options": [ string ]  // additional options for a channel, like 'events' or 'booth'
            "lastEpoch": int  // last encryption epoch number for a channel
            "needNewEpoch": bool  // flag to point that channel encryption epoch should be changed on next message
            "thumbnailId": string  // channel thumbnail resource id
            "totalCount": int  // total count of messages in a channel
            "unreadCount": int  // count of unread messages for current participant / not returned if empty
            "subChannelCount": int  // amount of first level subchannels in a channel (if present)
            "lastReadTs": timestamp  // last read timestamp for current participant / not returned if empty
            "opponentLastReadTs": timestamp  // last read timestamp for opponent (only for direct channels) / not returned if empty
            "lastMessage": {  // last message in a channel / not returned if empty
                "messageId": string
                "created": timestamp
                "authorId": string
                "authorName": string
                "messageBody": string
                "messageContentType": int  // 0 - text, 1 - blocked, 2 - deleted, 3 - request JSON, 4 - endorsement JSON, 5 - activity JSON, 6 - card JSON, 7 - system JSON, 8 - poll, 9 - forward, 10 - file attachment, 11 - image, 12 - video, 13 - audio
                "encryptionVersion": string  // encryption version, like 'verus.v1'
                "encryptionEpoch": int  // epoch defines key bundle that was used for encryption
                "encryptionEpk": string  // ephemeral public key that should be used to decrypt cypher data
            }
            "isHighAlert": bool  // is channel set on high alert
            "isPinned": bool  // indicates if the channel was pinned by the user
            "spawnUnreadCount": int  // count of unread AI agent spawned channels from this direct channel / not returned if empty
            "spawnParentId": string  // parent channel id for spawned channel / not returned if empty
            "spawnLastMessageTs": timestamp  // timestamp of last message in spawned channels
        }]
        "total": int  // total amount of channels
        "hasNext": bool  // there are more channels to fetch
    }
    "error": { "status": bool, "code": int, "message": string }
}

List community sub channels ​

Method: jsonRpc

HTTP Method: POST

Path: /api/v0/partnerRpc/communityInfo.listCommunitySubChannels

Description: API returns sub-channels for the community.

Request:

{
    "communityId": string
    "channelId": string
    "parentSubChannelId": string  // parent subchannel id, if nested
    "fetchNested": bool  // if false - api fetches only first level of subchannels; if true - all nested subchannels
}

Response:

{
    "data": {
        "subChannels": [{
            "channelId": string
            "subChannelId": string
            "parentSubChannelPath": string
            "parentSubChannelTitles": [ string ]
            "created": timestamp
            "title": string
            "contentDirectoryId": string
            "options": [ string ]
            "lastMessageBucketId": string
            "lastMessage": {
                "messageId": string
                "created": timestamp
                "authorId": string
                "authorName": string
                "messageBody": string
                "messageContentType": int  // 0 - text, 1 - blocked, 2 - deleted, 3 - request JSON, 4 - endorsement JSON, 5 - activity JSON, 6 - card JSON, 7 - system JSON, 8 - poll, 9 - forward, 10 - file attachment, 11 - image, 12 - video, 13 - audio
                "encryptionVersion": string  // encryption version, like 'verus.v1'
                "encryptionEpoch": int  // epoch defines key bundle that was used for encryption
                "encryptionEpk": string  // ephemeral public key that should be used to decrypt cypher data
            }
            "messageCount": int
            "subChannelCount": int
        }]
    }
    "error": { "status": bool, "code": int, "message": string }
}

List community channel messages ​

Method: jsonRpc

HTTP Method: POST

Path: /api/v0/partnerRpc/communityInfo.listCommunityChannelMessages

Description: API returns channels of the community, optionally filtered by search query.

Request:

{
    "communityId": string
    "channelId": string
    "messageId": string  // pagination cursor, skip to start from the beginning
    "direction": string  // pagination direction: before (default), after, bilateral (both before and after), single (single message)
    "limit": int  // max number of messages to return (1-100)
}

Response:

{
    "data": {
        "messages": [{
            "channelId": string
            "bucketId": string
            "messageId": string
            "authorId": string
            "agentId": string
            "networkId": string
            "created": timestamp
            "updated": timestamp
            "messageType": int  // 0 - my, 1 - user, 3 - system, 4 - system JSON, 6 - request JSON, 7 - endorsement JSON, 8 - activity JSON, 9 - card JSON, 100-199 - AI messages
            "messageBody": string
            "messageTitle": string
            "isBlocked": bool
            "isDeleted": bool
            "attachments": [{
                "resourceId": string
                "fileName": string
                "fileSize": int
                "contentType": string
                "durationFloat": float
                "updated": timestamp
                "encryptionVersion": string  // encryption version, like 'verus.v1'
                "encryptionEpoch": int  // epoch defines key bundle that was used for encryption
                "encryptionEpk": string  // ephemeral public key that should be used to decrypt cypher data
            }]
            "replyMessage": {
                "channelId": string
                "messageId": string
                "authorId": string
                "created": timestamp
                "messageType": int
                "messageBody": string
                "attachments": [{
                    "resourceId": string
                    "fileName": string
                    "fileSize": int
                    "contentType": string
                    "durationFloat": float
                    "updated": timestamp
                    "encryptionVersion": string  // encryption version, like 'verus.v1'
                    "encryptionEpoch": int  // epoch defines key bundle that was used for encryption
                    "encryptionEpk": string  // ephemeral public key that should be used to decrypt cypher data
                }]
                "encryptionVersion": string  // encryption version, like 'verus.v1'
                "encryptionEpoch": int  // epoch defines key bundle that was used for encryption
                "encryptionEpk": string  // ephemeral public key that should be used to decrypt cypher data
            }
            "forwardMessage": {
                "channelId": string
                "messageId": string
                "authorId": string
                "created": timestamp
                "messageType": int
                "messageBody": string
                "attachments": [{
                    "resourceId": string
                    "fileName": string
                    "fileSize": int
                    "contentType": string
                    "durationFloat": float
                    "updated": timestamp
                    "encryptionVersion": string  // encryption version, like 'verus.v1'
                    "encryptionEpoch": int  // epoch defines key bundle that was used for encryption
                    "encryptionEpk": string  // ephemeral public key that should be used to decrypt cypher data
                }]
                "encryptionVersion": string  // encryption version, like 'verus.v1'
                "encryptionEpoch": int  // epoch defines key bundle that was used for encryption
                "encryptionEpk": string  // ephemeral public key that should be used to decrypt cypher data
            }
            "subChannelPath": string
            "subChannelTitles": [ string ]
            "options": [ string ]
            "customParams": map[string]{ custom structure }
            "reactions": {
                "counters": [{  // counter per reaction, in descending order
                    "emoji": string
                    "count": int
                }]
                "userEmoji": string  // user's emoji reaction to the message
            }
            "pollId": string
            "userPoll": {
                "poll": {  // channel's poll
                    "id": string
                    "channelId": string  // the channel the poll is in
                    "question": string  // question/description of the poll
                    "isMultiSelect": bool  // allow the users to select multiple choices
                    "isAnonymous": bool  // can users see who voted for what
                    "created": timestamp  // the time when poll was created
                    "closingTime": timestamp  // users cannot vote after the closing time, defaults to one day
                    "options": [ string ]  // list of options which the channel users vote for
                    "voteCounters": [ int ]  // calculated number of votes per option respectively
                }
                "vote": {  // user's vote in the poll'
                    "pollId": string
                    "userId": string
                    "options": [ string ]  // list of options the user voted for
                }
            }
            "threadChannelId": string
            "threadMessageCount": int
            "viewCount": int
            "upVoteCount": int
            "downVoteCount": int
            "encryptionVersion": string  // encryption version, like 'verus.v1'
            "encryptionEpoch": int  // epoch defines key bundle that was used for encryption
            "encryptionEpk": string  // ephemeral public key that should be used to decrypt cypher data
        }]
        "hasNext": bool  // true if channel has newer messages and 'afterMessageId' cursor applied
        "hasPrevious": bool  // true if channel has older messages and 'afterMessageId' cursor not applied
        "total": int  // total amount of channel messages
        "channelSource": string  // channel source (belonging) string
    }
    "error": { "status": bool, "code": int, "message": string }
}