Private ServicesChat member token

Create Chat Member Token (private)

Issue Chat Member Tokens to grant users specific permissions within an chat. In production, call this from your backend using your company’s API key. For development and testing, you can run it in your frontend to verify your integration without backend setup.


Example

file.ts
export const createChatMemberToken = async () => {
 
    const opts = {
        method: 'POST',
        headers: {
            'content-type': 'application/json',
            'Authorization': `Bearer ${'your-api-key'}`
        },
        body: JSON.stringify({
            arguments: [
                {
                    user_id: '8ae5a0b9-9206-44ca-950b-5a0b51f82d4e',
                    chat_id: 'c2ed3890-716d-4380-a597-d860ecacada0',
                    metadata: {
                        note: 'temporary moderator'
                    },
                    permissions: [
                        "PermissionChatBlock",
                        "PermissionChatUnblock"
                    ]
                }
            ]
        })
    };
 
    const res = await fetch('https://chat.dev.zu.casa/chat.tokens.private.v1.Service/Create', opts).then(r => r.json());
 
    return res.tokens[0];
};

Sample Response

file.json
{
  "tokens": [
    "52jAQLH01rJTSUaAdFFvnHY6sqBTyMn1PYrlk4Mtz4-VskjLxmQcXGgarceWIaVjLzzrnza_MUkHpFoLur4eqiEUcUUSMdMlSAxgHb7aiBAq-kp89pyFO-nNE2oDaPAJ6AVLcdVL_YRgjjY73Tfh5mv91zaDc0SIAB6XciLuBVVO_itpj43d9aEZ3FfW1kBlFer46iWpazgFo1MOhZMj7EI0oBciAjUxpDWzdPd2FSwLsKXa31c4LE6-hhmIDZE5xiqcfmZp2a3tv3QVa_Pfp75pZ8lWDAEfRpq3uzGHvjcj_jzWzvKpxV4cOlzTK5CR7ojcp0C8WydAvVD-H6zTDK4R-CkYW7fn-D046PDmSvNq5xEPccUk"
  ]
}

Permission

Below are all available permissions and what they do. Names match the API exactly.

Chat permissions (100–199)

PermissionImplied ByDescription
PermissionChatGrants all chat capabilities below.
PermissionChatBlockPermissionChatBlock a member from using chat.
PermissionChatUnblockPermissionChatRemove a chat block for a member.
PermissionChatMutePermissionChatMute a member (they cannot send messages).
PermissionChatUnmutePermissionChatUnmute a member.
PermissionChatMessageDeletePermissionChatDelete messages in chat.
PermissionChatKickPermissionChatKick a member out of the chat.
permissionChatSlowmodeBypassPermissionChatBypass slowmode restrictions when sending messages.