Social: InvitationToken API
| Endpoint | Method | Description |
|---|---|---|
| social:createInvitationToken | websocket | Create invitation token |
| social:getInvitationToken | websocket | Get invitation token |
| social:listInvitationTokensCreatedByUser | websocket | List invitation tokens created by user |
| social:revokeInvitationToken | websocket | Revoke invitation token |
| social:redeemInvitationToken | websocket | Redeem invitation token |
| social:listInvitationTokenUsages | websocket | List invitation token usages |
Create invitation token
Method: websocket
Endpoint: social:createInvitationToken
Description: Creates an invitation token that can be redeemed by other users to perform certain actions (e.g., join a room, join a group, etc.). The token can be created with specific sources (e.g., room, group) and client routes (e.g., room page, group page) to direct users to the appropriate place after redeeming the token. The token can also have an expiration time and can be revoked by the creator.
Request:
{
"data": {
"tokenName": string // human-readable name for the invitation token
"usageType": string // oneTime / dueToDate / open
"clientRoute": string // the client route to redirect to after redeeming the token
"expires": timestamp // timestamp when the token expires (usageType == dueToDate)
"sources": [{ // list of sources (e.g., room, group) token grants permissions to
"sourceType": string // room / group / community
"sourceId": string
"permissions": {
"view": bool
"comment": bool
"contribute": bool
"edit": bool
"manage": bool
}
}]
}
"event": { "id": string, "date": timestamp }
}
Response:
{
"data": {
"token": {
"tokenId": string
"tokenName": string // human-readable name for the invitation token
"created": timestamp
"usageType": string // oneTime / dueToDate / open
"usageStatus": string // active / expired / revoked
"createdBy": string // userId of the token creator
"clientRoute": string // the client route to redirect to after redeeming the token
"expires": timestamp // timestamp when the token expires (usageType == dueToDate)
"sources": [{ // list of sources (e.g., room, group) where user grants permissions to
"sourceType": string // room / group / community
"sourceId": string
"permissions": {
"view": bool
"comment": bool
"contribute": bool
"edit": bool
"manage": bool
}
}]
}
}
"error": { "status": bool, "code": int, "message": string }
}
Get invitation token
Method: websocket
Endpoint: social:getInvitationToken
Request:
{
"data": {
"tokenId": string
}
"event": { "id": string, "date": timestamp }
}
Response:
{
"data": {
"token": {
"tokenId": string
"tokenName": string // human-readable name for the invitation token
"created": timestamp
"usageType": string // oneTime / dueToDate / open
"usageStatus": string // active / expired / revoked
"createdBy": string // userId of the token creator
"clientRoute": string // the client route to redirect to after redeeming the token
"expires": timestamp // timestamp when the token expires (usageType == dueToDate)
"sources": [{ // list of sources (e.g., room, group) where user grants permissions to
"sourceType": string // room / group / community
"sourceId": string
"permissions": {
"view": bool
"comment": bool
"contribute": bool
"edit": bool
"manage": bool
}
}]
}
}
"error": { "status": bool, "code": int, "message": string }
}
List invitation tokens created by user
Method: websocket
Endpoint: social:listInvitationTokensCreatedByUser
Request:
{ empty }
Response:
{
"data": {
"tokens": [{
"tokenId": string
"tokenName": string // human-readable name for the invitation token
"created": timestamp
"usageType": string // oneTime / dueToDate / open
"usageStatus": string // active / expired / revoked
"createdBy": string // userId of the token creator
"clientRoute": string // the client route to redirect to after redeeming the token
"expires": timestamp // timestamp when the token expires (usageType == dueToDate)
"sources": [{ // list of sources (e.g., room, group) where user grants permissions to
"sourceType": string // room / group / community
"sourceId": string
"permissions": {
"view": bool
"comment": bool
"contribute": bool
"edit": bool
"manage": bool
}
}]
}]
}
"error": { "status": bool, "code": int, "message": string }
}
Revoke invitation token
Method: websocket
Endpoint: social:revokeInvitationToken
Request:
{
"data": {
"tokenId": string
}
"event": { "id": string, "date": timestamp }
}
Response:
{
"error": { "status": bool, "code": int, "message": string }
}
Redeem invitation token
Method: websocket
Endpoint: social:redeemInvitationToken
Request:
{
"data": {
"tokenId": string
}
"event": { "id": string, "date": timestamp }
}
Response:
{
"error": { "status": bool, "code": int, "message": string }
}
List invitation token usages
Method: websocket
Endpoint: social:listInvitationTokenUsages
Request:
{
"data": {
"tokenId": string
}
"event": { "id": string, "date": timestamp }
}
Response:
{
"data": {
"usages": [{
"tokenId": string
"userId": string
"redeemed": timestamp
}]
}
"error": { "status": bool, "code": int, "message": string }
}