Yuva bots

A bot is an account that a program drives through the Bot API instead of a person through the app. Bots can read and post in text rooms, react, pin, upload files, receive webhook events, and sit in voice rooms and play audio, always within the permissions the lodge's staff gave them.

How it fits together#

  1. You make a bot. In Yuva, open Ayarlar → Geliştirici, create a bot, and copy its token. The token is shown once; Yuva stores only its hash. You can create up to 5 scoped tokens, regenerate, or revoke them there any time. Each account can own up to 10 bots.

  2. Staff add it to a lodge. Someone in the lodge with the Botları yönet staff power (or the owner) opens Sunucu ayarları → Botlar, pastes the bot's ID (bot_…, copy it from the Geliştirici panel), and picks what the bot may do. They can only hand out rights they hold themselves; see permissions.

  3. Your program connects with the token (Authorization: Bot <token>), lists its lodges and rooms, polls for new messages or listens via webhooks, posts, and joins voice.

Bots are not people, and Yuva keeps them apart where it matters:

  • They can't be invited, can't invite, and can't join lodges on their own: only staff add them.

  • They can't send or receive direct messages or friend requests.

  • They see only the lodges they were added to, and in those only the rooms their role can read.

  • Every message they post shows a BOT badge, as do their entries in member lists and profile cards.

  • Staff can change their rights, mute, move or disconnect them in voice, kick or ban them, like any member. Adding, changing and removing bots shows in the lodge's audit log.

Documentation#

  • Authentication: tokens, scopes, headers, revocation.

  • Permissions: what each right allows, overrides, who can grant what.

  • API reference: every endpoint, request, response, OpenAPI 3.1, and code examples.

  • Webhooks: optional HTTPS event delivery, HMAC signatures, and retries.

  • Voice guide: how bots sit and speak in voice rooms (LiveKit tickets, mesh signalling).

  • Rate limits: headers, Retry-After, and per-endpoint budgets.

  • Changelog: API additions and SDK version history.

  • Video API: a member's own key for uploading videos and managing their shares (not a bot token; made in the video studio), documented in the repository's docs/app-api.md, section "Video API".

  • Quickstarts: Python, TypeScript, JavaScript.

SDKs live in this repository: sdk/python (Python, httpx; voice via livekit, or aiortc in mesh lodges) and sdk/js (one package for TypeScript and JavaScript; voice via @livekit/rtc-node, or werift in mesh lodges). LiveKit lodges need yuva-bot 2.0.0 or yuva_bot 0.2.0 or newer.

Hata kodları

Her Bot API hata yanıtı Türkçe error mesajının yanında sabit code ve bu bölüme işaret eden docs bağlantısı içerir.

  • BAD_REQUESTGeçersiz istek
    HTTP 400

    Ne zaman oluşur: Gövde geçerli JSON değil, `content-type: application/json` eksik, kimlik sıfır/negatif/çok büyük, `limit`/`cursor` aralığı bozuk ya da mesaj doğrulaması geçemedi.

    Nasıl düzeltilir: Yanıttaki `field` ve `error` alanlarını kontrol et; geçerli pozitif tam sayı kimlik ve doğru JSON gövdesi gönder.

  • INVALID_TOKENGeçersiz anahtar
    HTTP 401

    Ne zaman oluşur: `Authorization: Bot <token>` başlığı eksik, biçimi yanlış, anahtar iptal edilmiş, süresi dolmuş, yenilenmiş ya da bot/sahip hesabı silinmiş.

    Nasıl düzeltilir: Ayarlar → Geliştirici panelinden geçerli ve süresi dolmamış bir bot anahtarı alıp yeniden dene; 401 yanıtlarını döngüde tekrarlama.

  • FORBIDDENYetki yetersiz
    HTTP 403

    Ne zaman oluşur: Botun bu sunucu veya kanalda gereken izni (`write`, `speak`, `mention`, `manageMessages` vb.) yok ya da dosya eki için güven düzeyi yetersiz.

    Nasıl düzeltilir: Sunucu yöneticisinden botun rol/kanal izinlerini açmasını iste; kanal düzeyindeki `perms` nesnesini denetle.

  • SCOPE_MISSINGAnahtar kapsamı yetersiz
    HTTP 403

    Ne zaman oluşur: Kullanılan bot anahtarı bu uç noktanın gerektirdiği kapsamı (`read`, `write` veya `voice`) içermiyor.

    Nasıl düzeltilir: Ayarlar → Geliştirici panelinden gereken kapsamı içeren bir anahtar kullan veya yeni kapsamlı anahtar oluştur.

  • NOT_FOUNDKaynak bulunamadı
    HTTP 404

    Ne zaman oluşur: İstenen sunucu, kanal, mesaj veya sesli oda yok ya da bot o sunucuya/kanala erişemiyor.

    Nasıl düzeltilir: Kimliği doğrula, botun sunucuya eklendiğinden ve odayı görme izni bulunduğundan emin ol.

  • UNKNOWN_ROUTEBilinmeyen uç nokta
    HTTP 404

    Ne zaman oluşur: İstek yolu `/api/bot/v1` altında tanımlı hiçbir uç noktayla eşleşmiyor.

    Nasıl düzeltilir: OpenAPI belgesinden (`/api/bot/v1/openapi.json`) veya API başvurusundan doğru yolu kontrol et.

  • METHOD_NOT_ALLOWEDYöntem desteklenmiyor
    HTTP 405

    Ne zaman oluşur: Yol mevcut ancak gönderilen HTTP yöntemi (ör. `GET` yerine `PUT`) bu uçta kabul edilmiyor.

    Nasıl düzeltilir: Yanıttaki `Allow` başlığında listelenen izinli HTTP yöntemlerinden birini kullan.

  • VOICE_UPGRADE_REQUIREDSes SDK güncellemesi gerekli
    HTTP 409

    Ne zaman oluşur: Sunucunun sesi LiveKit üzerinden çalışıyor ancak join/beat isteği `"sfu": true` içermiyor.

    Nasıl düzeltilir: JS SDK'yı en az `2.0.0`, Python SDK'yı en az `0.2.0` sürümüne yükselt veya sese katılırken `"sfu": true` gönder.

  • CONTENT_LENGTH_REQUIREDContent-Length gerekli
    HTTP 411

    Ne zaman oluşur: Dosya yükleme isteğinde (`POST /channels/{id}/files`) geçerli `content-length` başlığı eksik veya boş dosya gönderildi.

    Nasıl düzeltilir: İsteğe bayt cinsinden doğru `Content-Length` başlığını ekle.

  • PAYLOAD_TOO_LARGEGövde çok büyük
    HTTP 413

    Ne zaman oluşur: JSON gövdesi 512 kB sınırını ya da yüklenen dosya izin verilen azami boyutu aştı.

    Nasıl düzeltilir: JSON gövdesini küçült (satır içi görsel en fazla 350.000 base64 karakter) veya daha küçük bir dosya yükle.

  • UNSUPPORTED_MEDIA_TYPEDesteklenmeyen dosya türü
    HTTP 415

    Ne zaman oluşur: Yüklenen dosya uzantısı izin verilen listede değil ya da dosya içeriği uzantısıyla uyuşmuyor.

    Nasıl düzeltilir: `x-file-name` başlığındaki uzantının desteklenen güvenli bir dosya türüyle ve içerik başlığıyla eşleştiğinden emin ol.

  • RATE_LIMITEDHız sınırı aşıldı
    HTTP 429

    Ne zaman oluşur: Dakikadaki genel istek, mesaj, tepki, dosya yükleme, ses bileti ya da IP başına hatalı anahtar sınırı aşıldı.

    Nasıl düzeltilir: `Retry-After` başlığı veya gövdedeki `retryAfter` (saniye) kadar bekleyip üssel geri çekilmeyle tekrar dene.

  • INTERNALSunucu hatası
    HTTP 500

    Ne zaman oluşur: Sunucu tarafında beklenmeyen bir hata oluştu.

    Nasıl düzeltilir: Kısa bir beklemenin ardından tekrar dene; sorun sürerse yanıt başlığındaki `X-Request-Id` değerini destekle paylaş.

  • INSUFFICIENT_STORAGESunucu depolama alanı dolu
    HTTP 507

    Ne zaman oluşur: Dosya yüklemesi için sunucu diskinde ayrılan güvenlik rezervinin altında boş alan kaldı.

    Nasıl düzeltilir: Daha sonra tekrar dene veya daha küçük bir dosya yükle.