Enable / Disable Chat Slowmode (private)
By default, slowdown mode is not enabled. If slowdown mode is enabled, it will automatically default to 30 seconds, meaning that once a user sends a message then they’ll have to wait at least 30 seconds to send 2nd one.
Toggle Slowmode for chats via the private Chats service. 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.
Time units: All timestamps shown are epoch nanoseconds (UTC).
EnableSlowmode
Example — Enable slowmode for one chat
file.ts
export const enableChatSlowmode = async () => {
const opts = {
method: 'POST',
headers: {
'content-type': 'application/json',
'Authorization': `Bearer ${'your-api-key'}`
},
body: JSON.stringify({
arguments: [
{
query: {
conditions: [
{
ids: [
'26cc372a-f415-49aa-aeef-4d15b9ae9637'
]
}
]
}
}
]
})
};
const res = await fetch('https://chat.dev.zu.casa/chat.chats.private.v1.Service/EnableSlowmode', opts).then(r => r.json());
return res.chats[0];
};Sample Response
file.json
{
"chats": [
{
"id": "26cc372a-f415-49aa-aeef-4d15b9ae9637",
"kind": "KindIndependent",
"metadata": {
"name": "general"
},
"slowmode": {
"status": "SlowmodeEnabled",
"limit": 1,
"window": 30000000000
},
"access_time": 1757669000000000000,
"create_time": 1757000000000000000,
"update_time": 1757669055000000000
}
]
}DisableSlowmode
Example — Disable slowmode for one chat
file.ts
export const disableChatSlowmode = async () => {
const opts = {
method: 'POST',
headers: {
'content-type': 'application/json',
'Authorization': `Bearer ${'your-api-key'}`
},
body: JSON.stringify({
arguments: [
{
query: {
conditions: [
{
ids: [
'26cc372a-f415-49aa-aeef-4d15b9ae9637',
]
}
]
}
},
]
})
};
const res = await fetch('https://chat.dev.zu.casa/chat.chats.private.v1.Service/DisableSlowmode', opts).then(r => r.json());
return res.chats;
};Sample Response
file.json
{
"chats": [
{
"id": "26cc372a-f415-49aa-aeef-4d15b9ae9637",
"kind": "KindIndependent",
"metadata": {
"name": "general"
},
"slowmode": {
"status": "SlowmodeDisabled",
"limit": 1,
"window": 30000000000
},
"access_time": 1757669000000000000,
"create_time": 1757000000000000000,
"update_time": 1757669070000000000
}
]
}UpdateSlowmode
Example — Update slowmode for one chat
In the following example the chat will be updated to limit each user to a maximum of 2 messages within 30 seconds.
file.ts
export const updateChatSlowmode = async () => {
const opts = {
method: 'POST',
headers: {
'content-type': 'application/json',
'Authorization': `Bearer ${'your-api-key'}`
},
body: JSON.stringify({
arguments: [
{
query: {
conditions: [
{
ids: [
'26cc372a-f415-49aa-aeef-4d15b9ae9637',
]
}
]
},
slowdown: {
window: 30000000000,
limit: 2,
}
},
]
})
};
const res = await fetch('https://chat.dev.zu.casa/chat.chats.private.v1.Service/Update', opts).then(r => r.json());
return res.chats;
};Sample Response
file.json
{
"chats": [
{
"id": "26cc372a-f415-49aa-aeef-4d15b9ae9637",
"kind": "KindIndependent",
"metadata": {
"name": "general"
},
"slowmode": {
"status": "SlowmodeEnabled",
"limit": 2,
"window": 30000000000
},
"access_time": 1757669000000000000,
"create_time": 1757000000000000000,
"update_time": 1757669070000000000
}
]
}