Form Integration
Connect your AI agents to forms for intelligent data processing and conversational experiences.
Overview
Form integration connects your AI agents directly to forms, enabling intelligent processing of submissions, conversational form experiences, and automated data handling.
Integration Modes
1. Post-Submit Processing
Agent processes form data after submission:
┌──────────┐ ┌──────────┐ ┌──────────┐
│ Form │───▶│ AI Agent │───▶│ Action │
│ Submitted│ │ Process │ │ (Email, │
└──────────┘ └──────────┘ │ DB, etc)│
└──────────┘
2. Conversational Form
Agent guides user through form completion:
┌──────────┐ ┌──────────┐ ┌──────────┐
│ User │◀──▶│ AI Agent │───▶│ Form │
│ Chat │ │ Collect │ │ Data │
└──────────┘ └──────────┘ └──────────┘
3. Hybrid Mode
Traditional form with AI assistance:
┌──────────────────────────────────────────┐
│ Form UI │
├──────────────────────────────────────────┤
│ [Name: _________] │
│ [Email: ________] │
│ [Question: _____] ┌──────────────┐ │
│ │ AI Chat │ │
│ [Submit] │ Assistant │ │
│ └──────────────┘ │
└──────────────────────────────────────────┘
Configuration
Basic Form-Agent Connection
json{ "form": { "id": "contact_form", "agent_integration": { "enabled": true, "agent_id": "support_agent", "mode": "post_submit", "process_fields": ["message", "question"] } } }
Form Settings
| Setting | Type | Description |
|---|---|---|
agent_id | string | Agent to connect |
mode | string | "post_submit", "conversational", "hybrid" |
process_fields | array | Fields to send to agent |
include_all_fields | boolean | Send all form data |
response_action | string | What to do with response |
Post-Submit Processing
Configuration
json{ "agent_integration": { "mode": "post_submit", "agent_id": "form_processor", "message_template": "Process this form submission:\n\nName: {{name}}\nEmail: {{email}}\nMessage: {{message}}", "response_action": "store", "store_field": "ai_analysis" } }
Use Cases
Lead Qualification
json{ "agent_integration": { "mode": "post_submit", "agent_id": "lead_qualifier", "message_template": "Qualify this lead:\n\nCompany: {{company}}\nRole: {{job_title}}\nBudget: {{budget}}\nTimeline: {{timeline}}\nNeeds: {{requirements}}", "response_format": { "type": "json", "schema": { "score": "number", "qualification": "string", "next_action": "string" } }, "post_process": { "update_submission": { "lead_score": "{{response.score}}", "qualification": "{{response.qualification}}" }, "trigger_workflow": { "workflow_id": "lead_routing", "condition": "{{response.score}} >= 70" } } } }
Support Ticket Classification
json{ "agent_integration": { "mode": "post_submit", "agent_id": "ticket_classifier", "message_template": "Classify this support request:\n\nSubject: {{subject}}\nDescription: {{description}}\nUrgency (user-selected): {{urgency}}", "response_format": { "type": "json", "schema": { "category": "string", "priority": "string", "department": "string", "suggested_response": "string" } }, "post_process": { "create_ticket": { "system": "zendesk", "mapping": { "subject": "{{subject}}", "description": "{{description}}", "category": "{{response.category}}", "priority": "{{response.priority}}", "assignee_group": "{{response.department}}" } }, "send_auto_response": { "condition": "{{response.suggested_response}} !== null", "email": "{{email}}", "template": "auto_response", "variables": { "suggested_answer": "{{response.suggested_response}}" } } } } }
Feedback Analysis
json{ "agent_integration": { "mode": "post_submit", "agent_id": "feedback_analyzer", "message_template": "Analyze this customer feedback:\n\nRating: {{rating}}/5\nFeedback: {{feedback}}\nProduct: {{product}}", "response_format": { "type": "json", "schema": { "sentiment": "string", "themes": "array", "actionable_insights": "array", "requires_followup": "boolean" } } } }
Conversational Forms
Configuration
json{ "form": { "id": "intake_form", "mode": "conversational", "agent_id": "intake_agent", "conversation_config": { "greeting": "Hi! I'll help you get started. What's your name?", "fields_to_collect": [ { "field": "name", "prompt": "Nice to meet you! What's your name?", "validation": "required" }, { "field": "email", "prompt": "What's the best email to reach you at?", "validation": "email" }, { "field": "company", "prompt": "What company are you with?", "validation": "optional" }, { "field": "needs", "prompt": "Tell me about what you're looking for today.", "validation": "min_length:20" } ], "completion_message": "Thanks {{name}}! I've got everything I need. Someone from our team will reach out to {{email}} shortly." } } }
Agent System Prompt for Conversational Forms
markdownYou are a friendly intake specialist collecting information from potential customers. Your goal is to collect the following information naturally through conversation: - Name - Email - Company (optional) - Their needs/requirements Guidelines: 1. Be conversational and friendly, not robotic 2. Ask one question at a time 3. Acknowledge their responses before asking the next question 4. If they provide multiple pieces of information at once, acknowledge all of them 5. Validate email format before accepting 6. For "needs", encourage them to be specific When you have all required information, summarize what you've collected and confirm. Use the collect_field tool to store each piece of information: - collect_field(name, value) - stores the field value Example conversation: User: "Hi, I'm interested in your product" You: "Great to hear! I'd love to help you learn more. First, what's your name?" User: "I'm John from Acme Corp" You: [collect_field("name", "John"), collect_field("company", "Acme Corp")] "Nice to meet you, John! And what's the best email to reach you at Acme Corp?"
Conversational Form Widget
Embed a conversational form on your website:
html<script src="https://cdn.arcanflows.com/form-widget.js"></script> <script> Arcanflows.conversationalForm({ formId: 'intake_form', container: '#form-container', theme: 'light', position: 'inline' // or 'floating' }); </script>
Hybrid Mode
Combine traditional form with AI assistance:
Configuration
json{ "form": { "id": "application_form", "mode": "hybrid", "agent_config": { "agent_id": "form_assistant", "position": "sidebar", "trigger": "help_button", "capabilities": [ "answer_questions", "explain_fields", "suggest_values", "validate_input" ] } } }
AI Assistance Features
Field Help
json{ "fields": { "annual_revenue": { "type": "number", "label": "Annual Revenue", "ai_help": { "enabled": true, "prompt": "Explain what we mean by annual revenue and why we need it", "examples": true } } } }
Smart Suggestions
json{ "fields": { "job_title": { "type": "text", "label": "Job Title", "ai_suggest": { "enabled": true, "based_on": ["company_type", "department"], "prompt": "Suggest appropriate job titles for someone in {{department}} at a {{company_type}}" } } } }
Validation Assistance
json{ "fields": { "description": { "type": "textarea", "label": "Project Description", "ai_validate": { "enabled": true, "rules": [ { "check": "completeness", "prompt": "Check if this description includes: goals, timeline, budget, and success criteria" }, { "check": "clarity", "prompt": "Evaluate if this description is clear and specific enough" } ], "feedback_mode": "inline" } } } }
Response Actions
Store Response
Save AI response with submission:
json{ "response_action": { "type": "store", "field": "ai_analysis", "format": "json" } }
Trigger Workflow
Start a workflow with the response:
json{ "response_action": { "type": "workflow", "workflow_id": "process_application", "input": { "form_data": "{{submission}}", "ai_response": "{{response}}" } } }
Send Notification
Notify based on response:
json{ "response_action": { "type": "notification", "conditions": [ { "if": "{{response.priority}} === 'urgent'", "channel": "slack", "message": "Urgent form submission from {{name}}: {{response.summary}}" }, { "if": "{{response.score}} >= 80", "channel": "email", "to": "[email protected]", "subject": "High-value lead: {{name}}" } ] } }
Custom Webhook
Send to external service:
json{ "response_action": { "type": "webhook", "url": "https://your-service.com/api/form-processed", "method": "POST", "body": { "submission_id": "{{submission.id}}", "form_data": "{{submission.data}}", "ai_analysis": "{{response}}" } } }
Embedding Options
Inline Form with Agent
html<div id="arcanflows-form"></div> <script src="https://cdn.arcanflows.com/forms.js"></script> <script> Arcanflows.renderForm({ formId: 'contact_form', container: '#arcanflows-form', agentAssistant: { enabled: true, position: 'right-sidebar', collapsed: false } }); </script>
Floating Chat Form
html<script src="https://cdn.arcanflows.com/forms.js"></script> <script> Arcanflows.conversationalForm({ formId: 'intake_form', mode: 'floating', position: 'bottom-right', triggerButton: { text: 'Get Started', icon: 'chat' } }); </script>
API Integration
Submit Form to Agent
bashcurl -X POST "https://api.arcanflows.com/api/v1/forms/{form_id}/submit" \ -H "X-API-Key: your_api_key" \ -H "Content-Type: application/json" \ -d '{ "data": { "name": "John Doe", "email": "[email protected]", "message": "I need help with..." }, "process_with_agent": true }'
Response
json{ "submission_id": "sub_abc123", "status": "processed", "data": { "name": "John Doe", "email": "[email protected]", "message": "I need help with..." }, "agent_response": { "category": "support", "priority": "medium", "suggested_response": "Thank you for reaching out..." } }
Best Practices
1. Clear Agent Instructions
Define exactly what the agent should do with form data:
json{ "message_template": "You are processing a support request form. Analyze the submission and provide:\n1. Category (billing/technical/general)\n2. Priority (low/medium/high/urgent)\n3. Suggested response\n\nForm data:\n{{json submission}}" }
2. Handle Validation
Let the agent help with validation:
json{ "pre_submit_validation": { "agent_id": "validator", "check_fields": ["description", "requirements"], "validation_prompt": "Check if these fields are complete and clear enough for us to help" } }
3. Graceful Fallbacks
Handle agent failures gracefully:
json{ "error_handling": { "on_agent_error": "submit_without_processing", "fallback_classification": { "category": "general", "priority": "medium" }, "notify_admin": true } }
4. Privacy Considerations
Be mindful of what data is sent to agents:
json{ "privacy": { "exclude_fields": ["ssn", "credit_card"], "mask_fields": ["phone"], "anonymize": false } }
5. Test Thoroughly
Test the integration with various inputs:
- Valid submissions
- Edge cases
- Invalid data
- Large text inputs
- Special characters