Smart Responses
Automatically analyze and answer questions posted within tickets
The SmartResponses feature allows your bot to automatically respond to specific phrases in messages or during ticket creation. This helps provide quick and relevant information without manual intervention.
How It Works
When a user submits a message or a modal input, the bot scans the input for predefined phrases. If a match is found based on the configured criteria, the bot responds automatically with a specified message or embed. The matching process can include advanced analysis like synonym recognition and contextual understanding.
Configuration Options
Phrases
Each phrase entry specifies a phrase to detect, the response to give, and how closely a message must match the phrase to trigger the response.
Configuration | Description | Example |
---|---|---|
Phrase | The exact phrase or question the bot should look for. |
|
Response | The message the bot should send when the phrase is detected. |
|
MatchPercent | The similarity threshold for triggering a response. A higher value means a closer match is required. |
|
Type | The format of the response. Can be |
|
Note: The MatchPercent
can be between 0.00 and 1.00, with 1.00 meaning 100% of the message needs to match. It is suggested to keep MatchPercent
around 0.80-0.85 to reduce false flags.
Advanced Analysis
Configuration | Description | Example |
---|---|---|
SynonymThreshold | Controls how the bot recognizes words with similar meanings. |
|
ContextualAnalysis | Allows the bot to understand the meaning of a phrase based on the context it is used in. |
|
Hint: Set SynonymThreshold
to a value between 0.00 and 1.00. A lower threshold makes the bot more flexible in recognizing synonyms, while a higher threshold makes it stricter. For better performance, a value around 0.60-0.70 is recommended.
Example Usage
If a user submits a ticket with the message, "I can't set up MongoDB," the bot can understand this in the context of database setup issues and respond accurately, even if the exact phrase "setup Mongo" isn't used. By enabling ContextualAnalysis
, the bot can better understand and respond to varied ways users might phrase their questions or problems.
Example Configurations
No Role Requirement
Below is an example configuration showing phrases and their responses without role requirements:
Role Requirement
Below is an example configuration showing phrases and their responses with role requirements:
Embed Example
Below is an example configuration showing phrases and their responses with embeds:
Note: You can set HasRoleResponse
or NoRoleResponse
to an empty string ""
if you do not want to send any message when a role-specific response is triggered.
Setting Up SmartResponses
Identify Common Queries: List the common questions or phrases users might ask.
Define Responses: For each phrase, create a clear, helpful response. Decide if it should be a simple text message or an informative embed.
Configure MatchPercent: Set the similarity threshold. Start with 0.75 and adjust based on accuracy.
Enable Advanced Analysis (Optional): Use
SynonymThreshold
andContextualAnalysis
for better matching accuracy.
Advanced Usage: ErrorPatterns
IMPORTANT: Do not use ErrorPatterns
if you do not understand Regex.
The ErrorPatterns
feature allows advanced users to configure specific error patterns and responses for their bots. This is useful for automatically diagnosing and responding to common errors in the bot's runtime environment.
Configuration Options
Each error pattern entry specifies a regex pattern to detect, and the response message.
Example Configurations
Creating Regex Patterns
Identify the Error Message: Look at the typical error messages you want to catch.
Create the Regex Pattern: Write a regex pattern that matches the error message. Use capturing groups
(.*)
to capture variable parts of the error message.Escape Special Characters: Escape special characters as needed.
Test the Pattern: Make sure the regex pattern correctly matches the error messages.
Example Explanation
FileNotFoundError
Pattern:
Error: Cannot find module '(.*)'\\s*Require stack:
Explanation: This pattern matches the error message when a module file is not found. It captures the missing module name.
Response: "It seems you are missing the file '{1}'. Please ensure that the file is present in the folder."
ModuleNotFoundError
Pattern:
Error: Cannot find module '(.*)'
Explanation: This pattern matches the error message when a module is not found. It captures the missing module name.
Response: "It seems you are missing the module '{1}'. Please ensure that the module is installed. You can install it using
npm install {1}
."
NPMInstallError
Pattern:
Error: The specified module could not be found\\.\\s*\\\\\\?.*\\.(node)
Explanation: This pattern matches the error message for missing node modules.
Response: "It seems you are missing a node module. Please try running
npm install
to ensure all packages are installed correctly."
SyntaxError
Pattern:
SyntaxError: (.*)
Explanation: This pattern matches syntax error messages and captures the error description.
Response: "There is a syntax error: '{1}'. Please review your code for any syntax mistakes."
EADDRINUSEError
Pattern:
Error: listen EADDRINUSE: address already in use (.*):(.*)
Explanation: This pattern matches the error message when an address is already in use and captures the address and port.
Response: "It looks like the port '{2}' is already in use. This usually means you have two instances of the bot running. Please check and stop any other running bots or change the port number in your configuration."
SpecifiedModuleNotFoundError
Pattern:
Error: The specified module could not be found\\.
Explanation: This pattern matches a generic module not found error.
Response: "It seems you are missing a required node module. Please try running
npm install
to ensure all packages are installed."
Last updated