### Example Usage of Agent Instructions Source: https://doc.nextbot.ru/functional/functions/sending-result/yclients/deistvie-yclients-poluchit-informaciyu-o-usluge Demonstrates how to query the documentation dynamically using an HTTP GET request with the 'ask' query parameter to get specific information not explicitly present on the page. ```http GET https://doc.nextbot.ru/functional/functions/sending-result/yclients/deistvie-yclients-poluchit-informaciyu-o-usluge.md?ask= ``` -------------------------------- ### Dynamic Documentation Query Example Source: https://doc.nextbot.ru/functional/functions/sending-result/yclients/deistvie-yclients-poluchit-sobytiya Perform an HTTP GET request to this URL with the 'ask' query parameter to dynamically query the documentation for specific information or clarification. ```http GET https://doc.nextbot.ru/functional/functions/sending-result/yclients/deistvie-yclients-poluchit-sobytiya.md?ask= ``` -------------------------------- ### System Prompt Example for Agent Source: https://doc.nextbot.ru/functional/functions/sending-result/python/podklyuchenie-i-rabota-s-google-tablicam/kalkulyator-summy-zakaza-primer-realizacii This example shows how to integrate the Google Sheets functionality into an agent's system prompt. It defines the agent's persona and task, guiding it to assist customers with material selection and order calculation based on available data. ```text Ты Василий, консультант в онлайн-магазине стройматериалов. Твоя задача — помочь клиенту подобрать нужный строительный материал (из предоставленных на текущий момент в наличии), уточнить его размеры, передать данные для расчёта стоимости и сообщить результат. Всегда следуй процессу в вежливой и профессиональной форме, избегая ненужных отвлечений. ``` -------------------------------- ### Example: Confirming Product Availability with Avito Pro Variables Source: https://doc.nextbot.ru/functional/setting-up-agent/system-prompt/peremennye-v-prompte Construct a prompt to confirm product availability and price using specific details from an Avito Pro listing. This ensures the AI provides accurate information based on the listing. ```text Когда клиент спросит о наличии, подтверди: "{{Avito Pro — название объявления}}" есть в наличии за {{Avito Pro — цены объявления}}. Забрать можно по адресу: {{Avito Pro — адрес объявления}}. ``` -------------------------------- ### Restricted Python Environment with Available Modules Source: https://doc.nextbot.ru/functional/functions/sending-result/python/ispolzovanie-rest-api This example showcases the capabilities within a restricted Python environment, detailing available system variables, modules (like requests, json, hashlib, datetime), and functions. It includes examples of logging, making HTTP GET requests, and basic data processing. ```python # Доступные параметры в словаре args: # args["event_type"] - тип мероприятия (тип: string) [возможные значения определены в enum] # args["date"] - дата (тип: string) # args["start_time"] - время начала, формат даты - ISO 8601(YYYY-MM-DDTHH:mm) (тип: string) # args["city"] - город (тип: string) [возможные значения определены в enum] # args["venue"] - место проведения (тип: string) # args["event_duration_minutes"] - продолжительность мероприятия в минутах (тип: integer) # args["name"] - имя (тип: string) # args["phone_number"] - номер телефона (тип: string) # args["event_duration_hours"] - продолжительность мероприятия в часах (тип: string) # Системные поля в словаре args: # args["dateStringCreatedDialog"] - Дата/время начала (текст) # args["dateUonCreatedDialog"] - Дата/время начала (под UON) # args["dateStringUseFunction"] - Дата/время функции (текст) # args["dateUonUseFunction"] - Дата/время функции (под UON) # args["link"] - Ссылка на диалог # args["messenger"] - Мессенджер # args["linkAdAvito"] - Ссылка на объявление Авито # args["locationAvito"] - Локация Авито # args["linkDialogAvito"] - Ссылка на диалог Авито # args["nameUser"] - Имя в мессенджере # args["linkWidget"] - Ссылка на сайт с виджетом # args["phoneNumberWhatsapp"] - Номер телефона из WhatsApp # args["linkInUserMessanger"] - Ссылка на пользователя в мессенджере # args["agentHash"] - ID агента # args["platformIdSalebot"] - ID платформы Salebot # Доступные возможности: # Математика: abs, round, pow, sum, max, min, divmod, math (модуль) # Типы данных: bool, int, float, str, chr, ord, bin, oct, hex # Структуры: dict, list, tuple, set, frozenset, len, sorted, reversed, any, all # Итерация: range, enumerate, zip, iter, next, filter, map # Операторы присваивания: +=, -=, *=, /=, //=, %=, **=, <<=, >>=, &=, ^=, |= # HTTP: requests.get(), requests.post(), requests.put(), requests.delete() # JSON: json.loads(), json.dumps() # Кодирование: base64 (модуль) - для кодирования/декодирования в base64 # Хеширование: hashlib (модуль) - для создания хешей (md5, sha1, sha256 и др.) # Работа с CSV: csv (модуль) - для чтения/записи CSV файлов # Структуры данных: collections (модуль) - Counter, defaultdict, deque и др. # Функциональное программирование: itertools, functools (модули) # Регулярные выражения: re (модуль) # Дата и время: datetime (модуль), time (модуль), dateutil (модуль) # Случайные числа: random (модуль) # Статистика: statistics (модуль) # URL обработка: urllib.parse (модуль) # Логирование: debug() - для отладочных сообщений # Пример использования логирования debug("Начало выполнения функции") debug(f"Получены аргументы: {args}") # Пример HTTP-запроса с логированием (используем публичный API JSONPlaceholder) try: debug("Отправка HTTP запроса к JSONPlaceholder API...") response = requests.get("https://jsonplaceholder.typicode.com/posts/1") response.raise_for_status() data = response.json() debug(f"Получен ответ от API: {data}") except requests.RequestException as e: debug(f"Ошибка при выполнении запроса: {str(e)}") result = {"status": "error", "message": str(e)} else: debug("Запрос выполнен успешно") result = { "status": "success", "title": data.get("title"), "body": data.get("body") } # Пример обработки данных с логированием try: debug("Начало обработки данных") # Пример обработки полученных данных processed_data = { "post_info": f"Заголовок: {result.get('title', '')}", "word_count": len(result.get('body', '').split()) } debug(f"Данные обработаны: {processed_data}") except Exception as e: debug(f"Ошибка при обработке данных: {str(e)}") raise # Результат выполнения функции необходимо сохранить в переменную result ``` -------------------------------- ### Query Documentation via API Source: https://doc.nextbot.ru/functional/functions/sending-result/altegio/deistvie-altegio-sozdat-sobytie Demonstrates how to perform an HTTP GET request to query documentation dynamically using the 'ask' query parameter. ```http GET https://doc.nextbot.ru/functional/functions/sending-result/altegio/deistvie-altegio-sozdat-sobytie.md?ask= ``` -------------------------------- ### Setting up the First Agent Source: https://doc.nextbot.ru/advices/advanced-techniques/multiagentnost This is the initial agent that receives all incoming messages. Ensure all communication channels are attached to this primary agent. ```text Привязываем к нему все необходимые каналы связи ([ссылка](/functional/channels.md)).
{% hint style="info" %} **Привязывать мессенджеры необходимо только к первому агенту!** {% endhint %} ``` -------------------------------- ### Accessing Function Arguments in Python Script Source: https://doc.nextbot.ru/functional/functions/sending-result/python Demonstrates how to retrieve function parameters passed to the Python script using the 'args' dictionary. It shows a basic example of getting a value for 'event_type'. ```python event_type = args.get("event_type", "") ``` -------------------------------- ### System Prompt for Function Call Source: https://doc.nextbot.ru/functional/functions/sending-result/forma-personalnykh-dannykh/deistviya-posle-otpravki-formy/deistvie-posle-otpravki-pdn-formy-python-script/raschyot-stoimosti-zakaza-%2B-otpravka-dannykh-po-rest-api-%2B-email-primer-realizacii An example of a system prompt instructing an AI assistant to use the 'process_data' function when a user wants to place an order. This guides the AI's interaction flow. ```text Ты консультант в магазине стройматериалов. Твоя задача — уточнить, какой строительный материал нужен клиенту, и затем вызвать функцию `process_data`. Не нужно уточнять никаких дополнительных параметров или задавать сопутствующие вопросы. # Steps 1. Приветствуй клиента и прояви готовность помочь с выбором стройматериалов. 2. Узнай, какой именно материал нужен клиенту. 3. Как только клиент отвечает, вызови функцию `process_data`. 4. Заверши взаимодействие, поблагодарив клиента за его выбор. # Output Format Напиши ответ в формате диалога. Разговор должен быть дружелюбным, кратким и ориентированным на клиента. ``` -------------------------------- ### Query Documentation Dynamically Source: https://doc.nextbot.ru/functional/setting-up-agent/data-i-vremya Use this GET request to ask questions about the documentation. The response includes direct answers and relevant excerpts. ```HTTP GET https://doc.nextbot.ru/functional/setting-up-agent/data-i-vremya.md?ask= ``` -------------------------------- ### Query Documentation via HTTP GET Source: https://doc.nextbot.ru/~/revisions/DuDmsfBFqgzFOEsHSFdn/functional/integrations/kommo/podklyuchenie/kommunikaciya-cherez-kommo To get information not directly on this page, make an HTTP GET request to the page URL with an 'ask' query parameter. The question should be specific and in natural language. ```bash GET https://doc.nextbot.ru/~/revisions/DuDmsfBFqgzFOEsHSFdn/functional/integrations/kommo/podklyuchenie/kommunikaciya-cherez-kommo.md?ask= ``` -------------------------------- ### Querying Documentation with HTTP GET Source: https://doc.nextbot.ru/~/revisions/DuDmsfBFqgzFOEsHSFdn/functional/integrations/bitrix24 To get more information not directly on the page, make an HTTP GET request to the current URL with the 'ask' query parameter. This is useful for clarifications or retrieving related sections. ```http GET https://doc.nextbot.ru/~/revisions/DuDmsfBFqgzFOEsHSFdn/functional/integrations/bitrix24.md?ask= ``` -------------------------------- ### Query Documentation Dynamically Source: https://doc.nextbot.ru/~/revisions/DuDmsfBFqgzFOEsHSFdn/functional/integrations/notion/limit-zapisei Use this method to ask questions about the documentation. Perform an HTTP GET request with the 'ask' query parameter to get specific answers and relevant excerpts. ```http GET https://doc.nextbot.ru/~/revisions/DuDmsfBFqgzFOEsHSFdn/functional/integrations/notion/limit-zapisei.md?ask= ``` -------------------------------- ### AI-Generated Knowledge Base Creation Prompt Example Source: https://doc.nextbot.ru/~/revisions/DuDmsfBFqgzFOEsHSFdn/functional/knowledge-base/spravochniki When creating a knowledge base with AI, provide a clear description of its purpose and optionally, an example of the data structure. This helps the AI generate a relevant and well-formatted knowledge base. ```text Каталог мороженого с информацией о составе, цене и весе * Наименование * Состав * Цена * Производитель * Вес ``` -------------------------------- ### Example Result Source: https://doc.nextbot.ru/functional/functions/sending-result/forma-personalnykh-dannykh/deistviya-posle-otpravki-formy/deistvie-posle-otpravki-pdn-formy-python-script/raschyot-stoimosti-zakaza-%2B-otpravka-dannykh-po-rest-api-%2B-email-primer-realizacii This is an example of a successful result returned by the script after processing order data. ```json { "status": "success", "total": 600, "area": 6 } ``` -------------------------------- ### Query Documentation Dynamically Source: https://doc.nextbot.ru/questions-answers/errors-description/channels/salebot Use this method to ask questions about the documentation. The response will contain a direct answer and relevant excerpts. ```HTTP GET https://doc.nextbot.ru/questions-answers/errors-description/salebot.md?ask= ``` -------------------------------- ### Querying Documentation via HTTP GET Source: https://doc.nextbot.ru/functional/setting-up-agent/golosovye-soobsheniya-i-izobrazheniya/rabota-s-failami.-golosovye-soobsheniya To get additional information not explicitly on the page, perform an HTTP GET request to the current page URL with the 'ask' query parameter. The question should be specific and in natural language. ```http GET https://doc.nextbot.ru/functional/setting-up-agent/golosovye-soobsheniya-i-izobrazheniya/rabota-s-failami.-golosovye-soobsheniya.md?ask= ``` -------------------------------- ### Reminder Text Examples Source: https://doc.nextbot.ru/functional/functions/sending-result/altegio/deistvie-altegio-sozdat-sobytie Examples of reminder texts that can be used with system variables and function parameters. ```plaintext Напоминание о записи {altegioBookingDate} в {altegioBookingTime} на услугу {service_name} ``` ```plaintext Расскажите, как прошла услуга {service_name} ```