Actions11
Overview
The "Retrain Chatbot" operation allows users to update and improve an existing chatbot's knowledge base by providing new training data. This can include custom source text, question-and-answer pairs, and URLs from which content is scraped for training purposes. The node sends this data to the chatbot service API to retrain the specified chatbot.
This operation is beneficial when you want to enhance a chatbot’s responses with fresh or domain-specific information without creating a new chatbot from scratch. For example, after adding new product details or FAQs on your website, you can retrain the chatbot to incorporate this updated knowledge.
Practical examples:
- Feeding a chatbot with recent customer support Q&A pairs to improve its accuracy.
- Scraping specific web pages (e.g., documentation or blog posts) to enrich the chatbot’s understanding of your products.
- Providing custom source text that summarizes new policies or announcements for the chatbot to learn.
Properties
| Name | Meaning |
|---|---|
| Chatbot Name or ID | Select the chatbot to retrain from a list or specify its ID via expression. |
| Source Text | Custom free-form text input used as additional training material for the chatbot. |
| Questions & Answers | Multiple pairs of questions and their corresponding answers to train the chatbot on specific topics. Each pair consists of a "Question" string and an "Answer" string. |
| URLs to Scrape | List of URLs whose content will be scraped and used as training data for the chatbot. |
| Scraping Options | Collection of options controlling how scraping is performed: • Cookies: Semicolon-separated cookies for authorized scraping. • Extract Main Content: Whether to remove common non-content elements automatically. • Include Only Tags: CSS selectors to exclusively extract. • Exclude Tags: CSS selectors to exclude from scraping results. |
Output
The output JSON contains the response from the chatbot service API after attempting to retrain the chatbot. It includes:
success: Boolean indicating if the retraining request was accepted successfully.chatbotId: The ID of the chatbot that was retrained.- Additional fields returned by the API related to the retraining process status or metadata.
If an error occurs, the output may contain an error field describing the issue.
No binary data output is involved in this operation.
Dependencies
- Requires an API key credential for authenticating requests to the chatbot service API.
- The node uses the base URL configured in the credentials to send HTTP POST requests to the
/api/v2/retrain-chatbotendpoint. - Proper network access to the chatbot service API is necessary.
- If scraping URLs, the target websites must be accessible and allow scraping with optional cookie authorization.
Troubleshooting
- Missing or invalid API credentials: Ensure the API key and base URL are correctly set in the node credentials.
- Invalid chatbot ID: Verify that the chatbot ID exists and is correct; use the provided option to select from available chatbots.
- Malformed input data: Make sure question-answer pairs and URLs are properly formatted and not empty.
- Scraping failures: If URLs cannot be scraped, check network connectivity, URL correctness, and cookie authorization if required.
- API errors: The node surfaces error messages returned by the API. Common errors might relate to rate limits, invalid parameters, or server issues. Review the error message and adjust inputs accordingly.
- Continue On Fail: If enabled, the node will continue processing other items even if some fail, returning error details in the output.
Links and References
- n8n Expressions Documentation
- Refer to your chatbot service API documentation for detailed retraining endpoint behavior and accepted parameters.