This is an n8n community node for integrating with the Avito API. It provides functionality to interact with Avito's shop listings, messaging system, and webhook handling.
n8n is a fair-code licensed workflow automation platform.
- Features
- Installation
- Operations
- Credentials
- Usage Examples
- Webhook Integration
- AI Integration
- Troubleshooting
- Resources
- Version History
- List shop items with filtering:
- Status (active/removed/old/blocked/rejected)
- Pagination (1-100 items per page)
- Category filtering
- Date-based filtering
- Send messages to users
- Webhook integration for real-time message updates
- AI-powered automated responses
- Automatic webhook registration
- Real-time message notifications
- Secure webhook validation
- Test and Production webhook URLs
- Built-in AI consultant workflow
- Context-aware responses
- Customizable AI behavior
- Real-time item data integration
Follow these steps to install this node in your n8n instance:
# Using npm
npm install n8n-nodes-avito
# Using n8n CLI
n8n-node-dev install n8n-nodes-avitoFirst, install n8n globally using npm:
npm install n8n -g# Install dependencies
npm install
# Build the package
npm run build
# Create the package
npm packTo install this custom node in your local n8n installation:
- Build the package as described above
- Install the package in your n8n installation:
cd ~/.n8n/custom
npm install /path/to/n8n-nodes-avito-1.0.1.tgz- Restart n8n
Note: Replace /path/to/n8n-nodes-avito-1.0.1.tgz with the actual path to the generated .tgz file.
#!/bin/bash
# Цвета для вывода
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# Проверка наличия файла конфигурации n8n
N8N_CONFIG_DIR="$HOME/.n8n"
N8N_CONFIG_FILE="$N8N_CONFIG_DIR/config"
N8N_CUSTOM_DIR="$N8N_CONFIG_DIR/custom"
echo -e "${GREEN}1. Проверка конфигурации n8n...${NC}"
if [ ! -d "$N8N_CONFIG_DIR" ]; then
mkdir -p "$N8N_CONFIG_DIR"
fi
if [ ! -d "$N8N_CUSTOM_DIR" ]; then
mkdir -p "$N8N_CUSTOM_DIR"
fi
# Установка правильных прав доступа
chmod 600 "$N8N_CONFIG_FILE" 2>/dev/null
# Генерация и установка ключа шифрования
if [ ! -f "$N8N_CONFIG_FILE" ]; then
NEW_KEY=$(openssl rand -hex 32)
echo "{\"encryptionKey\": \"$NEW_KEY\"}" > "$N8N_CONFIG_FILE"
echo "export N8N_ENCRYPTION_KEY=$NEW_KEY" >> ~/.zshrc
source ~/.zshrc
echo -e "${GREEN}Создан новый ключ шифрования в конфигурационном файле${NC}"
else
EXISTING_KEY=$(cat "$N8N_CONFIG_FILE" | grep -o '"encryptionKey": *"[^"]*"' | cut -d'"' -f4)
if [ ! -z "$EXISTING_KEY" ]; then
echo "export N8N_ENCRYPTION_KEY=$EXISTING_KEY" >> ~/.zshrc
source ~/.zshrc
echo -e "${GREEN}Использован существующий ключ шифрования${NC}"
fi
fi
# Сохраняем текущую директорию
CURRENT_DIR=$(pwd)
echo -e "${GREEN}2. Очистка предыдущей сборки...${NC}"
npm run clean
echo -e "${GREEN}3. Сборка проекта...${NC}"
npm run build
echo -e "${GREEN}4. Создание пакета...${NC}"
npm pack
echo -e "${GREEN}5. Установка пакета...${NC}"
cd "$N8N_CUSTOM_DIR"
# Очищаем существующие node_modules
rm -rf node_modules package-lock.json
# Устанавливаем пакет и зависимости
npm install "$CURRENT_DIR"/n8n-nodes-avito-*.tgz --legacy-peer-deps
# Возвращаемся в исходную директорию
cd "$CURRENT_DIR"
echo -e "${GREEN}6. Перезапуск n8n...${NC}"
pkill -f "n8n"
sleep 2
# Запускаем n8n в фоновом режиме с перенаправлением вывода
export N8N_CUSTOM_NODES_URLS="file://$N8N_CUSTOM_DIR"
export N8N_RUNNERS_ENABLED=true
nohup n8n start --tunnel > n8n.log 2>&1 &
echo -e "${GREEN}Готово! n8n запущен в фоновом режиме.${NC}"
echo -e "${GREEN}Логи доступны в файле: n8n.log${NC}"
echo -e "${GREEN}Для просмотра логов используйте: tail -f n8n.log${NC}"
echo -e "${GREEN}Интерфейс n8n доступен по адресу: http://localhost:5678${NC}" // Get Items
{
"resource": "shop",
"operation": "getItems",
"parameters": {
"perPage": 25, // 1-100
"page": 1, // min: 1
"status": ["active"], // active/removed/old/blocked/rejected
"updatedAtFrom": "YYYY-MM-DD",
"category": 123 // Category ID
}
}// Send Message
{
"resource": "message",
"operation": "send",
"parameters": {
"chat_id": "string", // Required
"user_id": "number", // Required
"message": "string" // Required
}
}- Client ID
- Client Secret
- OAuth 2.0 implementation
- Automatic token refresh
- Token expiration handling
[
{
"node": "Avito",
"parameters": {
"resource": "shop",
"operation": "getItems",
"perPage": 25,
"status": ["active"]
}
}
][
{
"name": "Avito Trigger",
"type": "n8n-nodes-avito.avitoTrigger",
"parameters": {}
},
{
"name": "Get Active Items",
"type": "n8n-nodes-avito.avito",
"parameters": {
"resource": "shop",
"operation": "getItems",
"status": ["active"]
}
},
{
"name": "AI Assistant",
"type": "n8n-nodes-base.aiAgent",
"parameters": {
"prompt": "Your AI consultant prompt",
"contextFields": {
"activeItems": "={{ $node[\"Get Active Items\"].json.resources }}"
}
}
},
{
"name": "Send Response",
"type": "n8n-nodes-avito.avito",
"parameters": {
"resource": "message",
"operation": "send"
}
}
]- Add Avito Trigger node to your workflow
- Activate the workflow
- Use the Production webhook URL in Avito settings
- Use Test webhook URL during development
- 120-second timeout for test webhooks
- Data visible in editor UI
- Switch to Production webhook URL
- Automatic webhook registration
- Persistent webhook connection
- Real-time item context
- Natural language processing
- Customizable responses
- Multi-turn conversations
{
"prompt": "Professional Avito consultant prompt",
"contextFields": {
"activeItems": "Items data",
"messageInfo": "Message context"
},
"parameters": {
"temperature": 0.7,
"maxTokens": 500
}
}-
Webhook Registration
- Check API credentials
- Verify webhook URL accessibility
- Ensure proper permissions
-
Message Sending
- Validate chat_id and user_id
- Check message format
- Verify token validity
-
AI Integration
- Check context data
- Verify AI node configuration
- Monitor response format
- Added AI consultant workflow
- Enhanced webhook handling
- Improved error handling
- Updated documentation
- Initial release
- Basic shop and message operations
- Webhook support
If you have any questions or issues:
- Check the issue tracker
- Create a new issue if needed
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request