What You’ll Build
A complete AI-powered contact routing system with:- A customizable contact form for your website or application
- Intelligent content analysis using OpenAI
- Automated routing to department-specific email addresses
- Attachment handling capabilities
- Easy maintenance and monitoring
Prerequisites
Before starting this tutorial, make sure you have:- An active Prisme.ai account
- The SendMail app installed in your workspace
Step 1: Creating Your Workspace
First, let’s set up a dedicated workspace for our contact routing system:Access AI Builder
Create a New Workspace
Configure Workspace Settings
- Name your workspace “AI Contact Routing” (or a name of your choice)
- Add a description like “Intelligent contact form with AI-based routing”
- Select an appropriate icon for your workspace
- Configure any additional settings as needed
Step 2: Building the Contact Form
Now, let’s create a user-friendly contact form that will collect information from your visitors:Create a New Page
Configure Page Properties
- Name your page “Contact Us Form”
- Set the slug to “contact-us” (this will be used in the URL)
Add a Form Block
Set the Form Submission Event
Save Your Page
Get the Page URL
workspace-slug.pages.host/lang/contact-us
Step 3: Installing Required Apps
Before creating our automation, we need to install the necessary apps from the Prisme.ai App Store:Access the App Store
Install the SendMail App
- Click the ”+” button to browse available apps
- Search for “SendMail” and click to install it
- Follow the on-screen instructions to complete the installation
Install the OpenAI App
- Again, click the ”+” button in the Apps section
- Search for “OpenAI” and click to install it
- During configuration, enter your OpenAI API key
Step 4: Creating the Form Submission Handler
Now, let’s build the automation that will process form submissions and route them based on AI analysis:Create a New Automation
- Navigate to the “Automations” section of your workspace
- Click “Create Automation”
- Name it “Form Submission Handler”
- Set the slug to “form-submission-handler”
Configure the Event Trigger
Set Default Recipient
- Variable name: “recipient”
- Value: “hello@example.com” (a default email in case routing fails)
Add OpenAI Analysis
- Model: Select “gpt-4” (or another appropriate model)
- Messages:
- System role: “Given the following customer inquiry, categorize it as either sales, support, or careers. Provide your categorization based on the content. Answer only with category nothing else.”
- User role:
"{{payload.message}}"
- Output: “result”
Extract AI Response
- Variable name: “routingDecision”
- Value:
"{{result.choices[0].message.content}}"
Create Conditional Routing
- Condition:
{{routingDecision}} = "sales"
- Action: Set recipient to “sales@example.com”
- Condition:
{{routingDecision}} = "support"
- Action: Set recipient to “support@example.com”
- Condition:
{{routingDecision}} = "careers"
- Action: Set recipient to “careers@example.com”
Configure Email Notification
- To:
"{{recipient}}"
(the dynamically set department email) - ReplyTo:
"{{payload.email}}"
(the submitter’s email) - Subject: “New Contact Form Submission”
- Body: “Message:
{{payload.message}}
, Name:{{payload.name}}
, Attachment:{{payload.attachment}}
”
Set Output and Save
- Set the automation output to
{{routingDecision}}
- Save your automation
Step 5: Testing Your Contact Routing System
Now it’s time to test your AI contact routing system:Access Your Contact Form
Submit Test Inquiries
- A sales-related inquiry (e.g., “I’m interested in pricing for your enterprise plan”)
- A support-related inquiry (e.g., “I’m having trouble logging into my account”)
- A careers-related inquiry (e.g., “I’d like to apply for the marketing position”)
Verify Email Routing
Test Attachment Handling
Step 6: Version Control and Deployment
To finalize your contact routing system:Pull Your Changes
Set Up Access Controls
Monitoring and Optimization
After deployment, regularly check the system’s performance:Monitor Activity Logs
Review Classification Accuracy
Optimize the AI Prompt
Extending Your Contact Routing System
Consider these enhancements to make your system even more powerful:- Multi-level Classification: Add subcategories to route inquiries to specific teams within departments
- Priority Detection: Use AI to identify urgent inquiries and flag them for immediate attention
- Sentiment Analysis: Detect the emotional tone of inquiries to handle frustrated customers appropriately
- Automated Responses: Send automated acknowledgment emails based on the inquiry type
- CRM Integration: Connect with your CRM system to log inquiries as leads or support tickets
- Slack Integration: Send notifications to Slack channels for real-time team collaboration