Slaikydocs

    Build an app#errors

    Errors and rate limits

    What a refusal looks like, the codes your app will meet, and how to wait when Slaiky says you sent too many.

    Every answer says ok. When Slaiky refuses a call, the body is { "ok": false, "error": { … } } and the HTTP status says the same. Write your code against code; show message to people.

    The refusal

    your app → Slaikyreactions.add
    { "messageId": "7f3c0021-5a1e-4c2b-9d6f-1a2b3c4d5e14", "emoji": "✅" }
    Slaiky → your app403
    {
      "ok": false,
      "error": {
        "code": "missing_scope",
        "message": "This app needs the reactions:write permission for that",
        "needed": "reactions:write"
      }
    }
    FieldWhat it is
    codeWhat went wrong, for your code. It never changes with the language.
    messageThe same, in one sentence, for a person.
    fieldsWhich inputs are wrong, each with its own message.
    neededWith missing_scope: the permission the call needs.
    retryAfter, scopeWith 429: the seconds to wait, and which limit it was.
    maxWith 413: the largest body accepted, in bytes.

    A wrong argument is named in fields by its path in your body (channel, blocks.0.text), and message repeats the first one:

    Slaiky → your app422
    {
      "ok": false,
      "error": {
        "code": "invalid",
        "message": "This field is required",
        "fields": { "channel": "This field is required", "threadId": "Invalid format" }
      }
    }

    A manifest’s problems are named by JSON pointer instead (Manifests). When a call to the MCP server is refused before a tool runs (a wrong token, too many calls), the same error object comes in the JSON-RPC error.data. A tool that refuses (a missing permission, say) answers with its result instead: isError: true and one sentence in English, with no code.

    In the reader’s language

    message and fields follow the request’s Accept-Language header, in any language Slaiky speaks; without one, English. code stays the same, so your code never needs to read the words.

    you run
    curl -s https://app.slaiky.xyz/api/methods/reactions.add \
      -H "authorization: Bearer $SLAIKY_BOT_TOKEN" \
      -H 'accept-language: pt-BR' \
      -H 'content-type: application/json' \
      -d '{"messageId": "7f3c0021-5a1e-4c2b-9d6f-1a2b3c4d5e14", "emoji": "✅"}'
    Slaiky → your app403
    { "ok": false, "error": { "code": "missing_scope", "message": "Este app precisa da permissão reactions:write para isso", "needed": "reactions:write" } }

    If your app shows Slaiky’s message to someone, ask in their language.

    The codes

    codeStatusWhenWhat to do
    unauthorized401No bot token, a wrong one, or one that stopped: a new one was made, or the app was removed or uninstalled.Check the token. Token and secret → New token makes another.
    invalid_auth401A configuration token or refresh token that is wrong, expired or already used.Refresh it, or make a new one (Manifests).
    missing_scope403The app lacks the permission the call needs. needed names it. A post to a public channel the bot isn’t in, without channels:join or chat:write.public, answers this too, and so does an incoming webhook whose app lost incoming-webhook.Add it under Permissions, or in the manifest.
    forbidden403Allowed in general, not here: the message isn’t the bot’s, the channel is archived, the app isn’t yours to change, or it was installed from another workspace.Read message.
    not_found404The channel, message, person, file, view or webhook isn’t there, or the bot can’t see it: a private channel or DM the bot isn’t in looks like this. Also an address that isn’t part of the API.Check the id or the #name; add the bot to the conversation.
    unknown_method404No method has that name.See Web API methods.
    invalid422An argument is missing or wrong.Fix what fields names.
    bad_request400The arguments are fine, but the call can’t be done: an empty message, a reply to a reply, a response URL used too many times.Read message.
    socket_mode_off400apps.connections.open while Socket Mode is off.Turn it on under Events.
    invalid_trigger400views.open or views.push with a trigger id that expired or was used.Open the modal right after the click: a trigger id lasts 30 seconds.
    hash_conflict409views.update or views.publish with a hash that changed since.Load the view again, then update it.
    invalid_manifest422 or 409The manifest has problems, by JSON pointer in fields. 409: a command name is taken.See Manifests.
    invalid_code, invalid_client400, 401oauth.v2.access with a code that is wrong, expired or spent, or with a wrong client secret.See Add to Slaiky.
    plan_required402The workspace is read-only until it has a plan: only a few reads answer.Tell the workspace’s owner.
    payload_too_large413The body is too big. max is the limit, in bytes.Send less, or upload files instead.
    rate_limited, quota_exceeded429Too many calls, or too many bytes uploaded, for now.Wait Retry-After seconds (Rate limits).
    internal500Something failed on Slaiky’s side.Try again later.

    Rate limits

    A bot’s Web API calls are limited to 120 per 10 seconds. Calls that do what a person does (post, edit, react, change a channel, upload) also count against the limit a person has for that action, per bot. Calls made without a bot token (configuration tokens, oauth.v2.access) count by the address they come from. apps.manifest.create, update and delete also count as app changes, limited to 30 per 1 hour for each member (scope: apps). Each install in another workspace is its own bot, with its own count.

    Over a limit, the answer is 429 with a Retry-After header, in whole seconds, and the same number in retryAfter. scope says which limit it was: botApi for the Web API, or the action’s own (messages, reactions…).

    your app → Slaikychat.postMessage
    { "channel": "#general", "text": "Deploy finished." }
    Slaiky → your app429
    {
      "ok": false,
      "error": {
        "code": "rate_limited",
        "message": "Too many attempts. Try again in 7 seconds.",
        "retryAfter": 7,
        "scope": "botApi"
      }
    }

    Back off

    Wait Retry-After seconds, then send the same call again. Limits count in fixed windows, so trying sooner only gets another 429. Give up after a few tries, and spread steady work out instead of sending it in bursts.

    your app → Slaikycall.mjs
    // Call a Web API method; on 429, wait as long as Slaiky says, then try again. Node 22+, no packages.
    const API = process.env.SLAIKY_API ?? 'https://app.slaiky.xyz/api/methods';
    
    async function call(method, body, tries = 3) {
      for (let attempt = 1; ; attempt++) {
        const res = await fetch(`${API}/${method}`, {
          method: 'POST',
          headers: { authorization: `Bearer ${process.env.SLAIKY_BOT_TOKEN}`, 'content-type': 'application/json' },
          body: JSON.stringify(body),
        });
        const answer = await res.json();
        if (res.status !== 429 || attempt === tries) return answer;
        // Whole seconds, the same number as answer.error.retryAfter.
        await new Promise((done) => setTimeout(done, Number(res.headers.get('retry-after')) * 1000));
      }
    }
    
    const answer = await call('chat.postMessage', { channel: process.env.SLAIKY_CHANNEL ?? '#general', text: 'Deploy finished.' });
    console.log(JSON.stringify(answer));
    if (!answer.ok) process.exit(1);
    your app → Slaikycall.py
    # Call a Web API method; on 429, wait as long as Slaiky says, then try again. Python 3, no packages.
    import json, os, time, urllib.error, urllib.request
    
    API = os.environ.get("SLAIKY_API", "https://app.slaiky.xyz/api/methods")
    TOKEN = os.environ["SLAIKY_BOT_TOKEN"]
    
    
    def call(method, body, tries=3):
        for attempt in range(1, tries + 1):
            req = urllib.request.Request(
                f"{API}/{method}",
                data=json.dumps(body).encode(),
                headers={"authorization": f"Bearer {TOKEN}", "content-type": "application/json"},
            )
            try:
                with urllib.request.urlopen(req) as res:
                    return json.load(res)
            except urllib.error.HTTPError as err:  # a refusal still answers JSON
                if err.code != 429 or attempt == tries:
                    return json.load(err)
                # Whole seconds, the same number as error.retryAfter.
                time.sleep(int(err.headers["retry-after"]))
    
    
    answer = call("chat.postMessage", {"channel": os.environ.get("SLAIKY_CHANNEL", "#general"), "text": "Deploy finished."})
    print(json.dumps(answer))
    if not answer["ok"]:
        raise SystemExit(f"{answer['error']['code']}: {answer['error']['message']}")

    Updated . Every method, scope, event and limit here is generated from the server’s own code.