### Discord Bot Endpoint Source: https://docs.kindroid.ai/api-documentation Core endpoint for sending context and getting a response, used in the Kindroid Discord bot integration. ```APIDOC ## POST /discord-bot ### Description Core endpoint for sending context and getting a response, used in the Kindroid Discord bot integration. ### Method POST ### Endpoint /discord-bot ### Request Header - **Authorization** (string) - Required - Bearer token for authentication. - **X-Kindroid-Requester** (string) - Recommended - Hashed unique string of the Discord user who triggered this call. ### Request Body - **share_code** (string) - Required - 5 letter string, must be shared by the UID who is authenticating. - **enable_filter** (boolean) - Optional - Content filter for public servers is recommended. - **conversation** (array) - Required - An array of message objects, each containing username, text, and timestamp. - **username** (string) - Required - The username of the message sender. - **text** (string) - Required - The content of the message. - **timestamp** (string) - Required - The timestamp of the message in ISO 8601 format. ### Response #### Success Response (200 OK) AI response. #### Error Response - 400 Bad Request - 401 Unauthorized - 403 Forbidden - 500 Internal Server Error ``` -------------------------------- ### Configure Environment Variables for Kindroid Discord Bot Source: https://docs.kindroid.ai/official-discord-bot-integration Paste this block into the Raw editor for environment variables in Railway. Replace the bolded placeholders with your specific Kindroid API key, shared AI code, and Discord bot token. Ensure KINDROID_INFER_URL is set to the default value. ```env KINDROID_INFER_URL=https://api.kindroid.ai/v1/discord-bot KINDROID_API_KEY=**your_kindroid_api_key_here** SHARED_AI_CODE_1=**your_shared_code_1_here** BOT_TOKEN_1=**your_discord_bot_token_1_here** ENABLE_FILTER_1=**true** ``` -------------------------------- ### Send Message Source: https://docs.kindroid.ai/api-documentation Sends a message to an AI and receives a response. This request may take a long time, so you should await for its response. ```APIDOC ## POST /send-message ### Description Sends a message to an AI and receives a response. This request may take a long time, so you should await for its response. ### Method POST ### Endpoint /send-message ### Request Body - **ai_id** (string) - Required - The ID of the AI to send the message to. - **message** (string) - Required - The message content. ### Response #### Success Response (200 OK) AI response. #### Error Response - 400 Bad Request - 401 Unauthorized - 403 Forbidden - 500 Internal Server Error ``` -------------------------------- ### Hash Discord Username for X-Kindroid-Requester Header Source: https://docs.kindroid.ai/api-documentation This code snippet demonstrates how to generate a hashed username for the X-Kindroid-Requester header. It encodes non-ASCII characters and hashes the result to an alphanumeric string, capped at 32 characters, for use in API requests. ```javascript const lastUsername = conversation[conversation.length - 1].username; // Encode username to handle non-ASCII characters, then hash to alphanumeric const hashedUsername = Buffer.from(encodeURIComponent(lastUsername)) .toString("base64") .replace(/[^a-zA-Z0-9]/g, "") .slice(0, 32); ```