Detect Intent
Detects user intent from natural language text using Google Dialogflow's advanced NLU engine. This node analyzes user input, matches it to trained intents, extracts parameters, and returns structured results for building intelligent conversational automation.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Inputs
- Text - The user's natural language text input to analyze for intent detection. This should be a complete sentence or phrase expressing the user's goal or question.
Options
Authentication
- Credentials - Service Account credentials for authenticating with the Dialogflow API. The credentials must have the "Dialogflow API Client" role assigned.
Configuration
-
Dialog Flow Project ID - (Required) The Google Cloud project ID where your Dialogflow agent is configured. You can find this in the Dialogflow Console settings.
-
Session ID - (Optional) Unique identifier for tracking conversation context across multiple interactions. If not provided, a unique session ID will be auto-generated using the message context ID. Use consistent session IDs for multi-turn conversations.
-
Language - The language code for the text input. Default is English (en). The language should match your text input for accurate intent detection. Supported languages include:
- Chinese - Cantonese (zh-HK)
- Chinese - Simplified (zh-CN)
- Chinese Traditional (zh-TW)
- Danish (da)
- Dutch (nl)
- English (en)
- English - Australian locale (en-AU)
- English - Canadian locale (en-CA)
- English - Great Britain locale (en-GB)
- English - Indian locale (en-IN)
- English - US locale (en-US)
- French (fr)
- French - Canadian locale (fr-CA)
- French France locale (fr-FR)
- German (de)
- Hindi (hi)
- Indonesian (id)
- Italian (it)
- Japanese (ja)
- Korean (ko)
- Norwegian (no)
- Portuguese (pt)
- Portuguese Brazilian (pt-BR)
- Russian (ru)
- Spanish (es)
- Spanish - Latin America locale (es-419)
- Spanish - Spain locale (es-ES)
- Swedish (sv)
- Thai (th)
- Turkish (tr)
- Ukrainian (uk)
Output
- intent - The complete query result object from Dialogflow containing:
- queryText - The original text that was analyzed
- intent.displayName - The name of the matched intent
- intentDetectionConfidence - Confidence score (0.0-1.0) of the intent match
- fulfillmentText - Pre-configured response text from Dialogflow
- parameters - Extracted entities and their values as key-value pairs
- languageCode - The language used for processing
- allRequiredParamsPresent - Boolean indicating if all required parameters were extracted
- diagnosticInfo - Additional diagnostic information
- sentimentAnalysisResult - Sentiment analysis data (if enabled in agent)
How It Works
The Detect Intent node processes natural language text through Google Dialogflow's NLU engine:
- Validation - Validates all required inputs (Text, Credentials, Language, Project ID)
- Authentication - Creates authenticated Dialogflow API client using service account credentials
- Session Setup - Establishes or continues a conversation session using the session ID
- Intent Detection - Sends text to Dialogflow for analysis against trained intents
- Parameter Extraction - Extracts structured data using entity recognition
- Response Processing - Receives complete query result with intent, confidence, and parameters
- Output - Returns structured result object for further automation processing
Intent Matching Process
Dialogflow uses machine learning to match user input to intents:
- Text is analyzed and tokenized
- Similar training phrases are identified
- Confidence scores are calculated for each potential intent
- Best matching intent is selected (if confidence threshold is met)
- Entities are extracted from the text as parameters
- Fulfillment response is generated based on agent configuration
Requirements
- Google Cloud Account - Active account with billing enabled
- Dialogflow API - Enabled in Google Cloud Console
- Dialogflow Agent - Configured agent with intents and training phrases
- Service Account - JSON credentials with "Dialogflow API Client" role
- Project ID - Valid Google Cloud project ID
- Network Access - Connectivity to dialogflow.googleapis.com
Error Handling
The node returns specific error codes for different failure scenarios:
ErrInvalidArg
- Empty Text input
- Missing Language selection
- Empty Dialog Flow Project ID
- Missing credentials content
- Invalid Session ID format
ErrCredentials
- Invalid service account JSON format
- Expired or revoked credentials
- Insufficient API permissions
- Failed to create Dialogflow client
ErrRuntime
- Dialogflow API request failure
- Network connectivity issues
- Project ID not found
- Agent not configured
- API quota exceeded
ErrInternal
- Failed to set output variable
- Internal processing errors
Practical Examples
Example 1: Customer Support Ticket Routing
// Route customer inquiries based on intent
msg.text = "I need help resetting my password";
// After Detect Intent node
const intent = msg.intent;
const intentName = intent.intent.displayName;
const confidence = intent.intentDetectionConfidence;
if (confidence > 0.7) {
if (intentName === "password.reset") {
msg.department = "IT Support";
msg.priority = "High";
} else if (intentName === "billing.inquiry") {
msg.department = "Finance";
msg.priority = "Medium";
}
}
Example 2: Multi-Turn Conversation
// First turn - booking intent
msg.text = "I want to book a flight to Paris";
msg.sessionId = msg.userId; // Use consistent session ID
// After Detect Intent
const params = msg.intent.parameters;
msg.destination = params.city || params.location;
// Second turn - date extraction
msg.text = "Next Friday";
msg.sessionId = msg.userId; // Same session maintains context
// Dialogflow remembers previous context
const departureDate = msg.intent.parameters.date;
Example 3: FAQ Automation
// Process FAQ queries
msg.text = "What are your business hours?";
// After Detect Intent
const result = msg.intent;
const answer = result.fulfillmentText;
const intentMatched = result.intent.displayName;
// Send automated response
if (result.intentDetectionConfidence > 0.8) {
msg.response = answer;
msg.source = "Automated";
} else {
msg.response = "Let me connect you with a human agent.";
msg.source = "Human Required";
}
Example 4: E-commerce Order Status
// Extract order number and check status
msg.text = "What's the status of order #12345?";
// After Detect Intent
const params = msg.intent.parameters;
const orderNumber = params.order_number;
const intent = msg.intent.intent.displayName;
if (intent === "order.status" && orderNumber) {
// Query order database
msg.orderToCheck = orderNumber;
}
Example 5: Multi-Language Support
// Process Spanish customer inquiry
msg.text = "¿Dónde está mi pedido?";
msg.language = "es"; // Set to Spanish
// After Detect Intent
const intentSpanish = msg.intent;
// Returns intent in Spanish context with Spanish fulfillment
msg.reply = intentSpanish.fulfillmentText;
Tips for Effective Use
Intent Design
- Be Specific - Create focused intents for different user goals
- Use Training Phrases - Provide 15-20 diverse examples per intent
- Avoid Overlap - Ensure intents are distinct to prevent confusion
- Test Edge Cases - Include variations, typos, and informal language
Parameter Extraction
- Define Entities - Use system entities (dates, numbers) and custom entities
- Mark Required - Set required parameters for critical data
- Provide Prompts - Configure follow-up prompts for missing parameters
- Validate Values - Check extracted parameters in your automation flow
Session Management
- Use Consistent IDs - Same session ID for related messages
- Unique Per User - Different session ID for each user/conversation
- Context Retention - Sessions maintain context for 20 minutes by default
- Reset When Needed - Use new session ID to start fresh conversations
Confidence Handling
- Set Thresholds - Typically 0.7+ for production, 0.5+ for development
- Handle Low Confidence - Implement fallback logic for uncertain matches
- Log for Review - Track low-confidence results to improve training
- Ask for Clarification - Prompt users when confidence is borderline
Performance Optimization
- Cache Common Intents - Store frequently accessed results
- Batch Processing - Process multiple messages efficiently
- Monitor Quotas - Track API usage to stay within limits
- Regional Endpoints - Use closest Dialogflow region for lower latency
Error Recovery
- Implement Fallbacks - Handle unrecognized input gracefully
- Retry Logic - Retry on temporary API failures
- Validate Inputs - Check text is not empty before processing
- Graceful Degradation - Provide helpful error messages to users
Common Errors and Solutions
"No Credential Content"
Problem: Service account JSON is missing or invalid Solution: Ensure you've pasted the complete JSON key file in credentials
"Project ID cannot be empty"
Problem: Dialog Flow Project ID field is blank Solution: Enter your Google Cloud project ID from Dialogflow Console settings
"Text cannot be empty"
Problem: No text input provided Solution: Ensure the Text input variable contains user's message
"Language cannot be empty"
Problem: Language option not selected Solution: Choose the appropriate language code matching your input text
"Failed to create Dialogflow client"
Problem: Invalid credentials or API not enabled Solution:
- Verify Dialogflow API is enabled in Google Cloud Console
- Check service account has "Dialogflow API Client" role
- Ensure credentials JSON is valid and not expired
Low Intent Detection Confidence
Problem: Confidence scores consistently below 0.7 Solution:
- Add more training phrases to your intents
- Review and improve training phrase diversity
- Check for overlapping intents and merge similar ones
- Verify language setting matches input text language
Session Context Not Maintained
Problem: Follow-up queries don't recognize previous context Solution:
- Use the same session ID for all messages in conversation
- Ensure session hasn't expired (20 minute default timeout)
- Verify context output/input settings in Dialogflow agent
Integration Patterns
Chatbot Workflow
1. Receive Message (Webhook/HTTP)
2. Detect Intent (this node)
3. Branch (Switch based on intent name)
- Intent A → Action A
- Intent B → Action B
- Fallback → Human Handoff
4. Send Response
Email Classification
1. Read Email
2. Extract Body Text
3. Detect Intent
4. Switch (based on intent)
- Sales → Sales Team
- Support → Support Queue
- Billing → Finance Team
5. Route Email
Voice Assistant
1. Speech-to-Text (Google Speech)
2. Detect Intent (this node)
3. Execute Action (based on parameters)
4. Generate Response
5. Text-to-Speech (Google Speech)
Best Practices
- Train Thoroughly - Spend time creating comprehensive training phrases
- Monitor Performance - Review intent detection accuracy regularly
- Use Entities - Leverage entity extraction for structured data
- Handle Fallbacks - Always have a fallback intent configured
- Test Multilingual - If supporting multiple languages, test each separately
- Manage Sessions - Use consistent session IDs for context retention
- Set Confidence Thresholds - Don't trust very low confidence matches
- Log Interactions - Keep records for analysis and improvement
- Update Training - Continuously add real user queries to training set
- Secure Credentials - Store service account keys securely in vault