A customer emails your small business at 11 PM on a Friday. Your team is offline. By Monday morning, you have seventeen more emails and no way to prioritise which ones are actually urgent. The frustrated customer has already left a one-star review. This scenario repeats itself hundreds of times across small businesses every week, not because owners don't care but because hiring dedicated support staff remains prohibitively expensive. The good news: you don't need to hire anyone. What you need is a properly orchestrated set of AI tools that work together to triage incoming tickets, analyse customer sentiment, and generate contextually appropriate draft responses without your team lifting a finger. The workflow runs 24/7, your inbox stays manageable, and customers feel heard even when you're sleeping. Let's build this system using three complementary tools that address different parts of the problem: Twig handles the chatbot interface and initial issue resolution, TheB.AI provides flexible customisation and integrations, and Cogram captures context from any customer calls that escalate beyond automated handling. We'll orchestrate these through n8n, which offers the granularity you need without the cost of enterprise platforms.
The Automated Workflow
The flow works like this: a customer submits a message through your website or email, Twig intercepts it and attempts to resolve the issue automatically, if resolution fails it triggers sentiment analysis in TheB.AI and creates a structured ticket, and if the issue involves conversation, Cogram records and summarises the exchange. Your support team then receives a neatly prioritised queue with draft responses ready to review and send. Here's how to wire it together with n8n.
Step 1: Trigger on Incoming Message
Your entry point is a webhook that fires whenever a new support message arrives. This could be from your website form, email integration, or existing ticketing system. Set up a webhook trigger in n8n that listens for POST requests:
POST /webhook/support-intake
Content-Type: application/json { "customer_email": "user@example.com", "customer_name": "Sarah", "message": "I've been trying to reset my password for 3 days", "message_timestamp": "2026-03-15T14:23:00Z", "source": "website_form"
}
The n8n webhook node should extract these fields and pass them downstream.
Step 2: Send to Twig for Initial Resolution
Twig is designed to resolve customer issues directly, so your first automated action routes the incoming message to Twig via its API. If Twig can solve the problem (password resets, account lookups, billing questions), the customer gets an immediate response without your team's involvement.
POST https://api.twig.ai/v1/chat/resolve
Authorization: Bearer YOUR_TWIG_API_KEY
Content-Type: application/json { "customer_id": "{{ $json.customer_email }}", "message": "{{ $json.message }}", "context": { "source": "{{ $json.source }}", "timestamp": "{{ $json.message_timestamp }}" }
}
Twig will respond with either a resolution status and the message it sent to the customer, or a "needs_escalation" flag indicating human intervention is required.
Step 3: Conditional Branch: Was the Issue Resolved?
In n8n, add a conditional node that checks the Twig response. If status === "resolved", the ticket is marked as handled and logged for analytics. If status === "escalation_needed", proceed to Step 4.
Step 4: Sentiment Analysis and Ticket Enrichment via TheB.AI
For escalated issues, send the original message to TheB.AI to analyse customer sentiment and extract key information. TheB.AI's sentiment module scores the emotional tone (0 to 1, where 0 is angry and 1 is satisfied) and identifies any urgent keywords:
POST https://api.theB.ai/v1/sentiment/analyse
Authorization: Bearer YOUR_THEB_API_KEY
Content-Type: application/json { "text": "{{ $json.message }}", "language": "en"
}
TheB.AI returns a sentiment score and extracted entities (product names, account numbers, keywords like "urgent", "broken", "refund").
Step 5: Generate Draft Response with Claude
Now you have structured data about the issue: the original message, Twig's assessment, sentiment analysis, and key entities. Use this context to prompt Claude Sonnet 4.6 to draft a professional response. This is where the workflow adds real value; instead of your support staff typing responses from scratch, they review and refine AI-generated drafts that already account for customer tone and issue type.
POST https://api.anthropic.com/v1/messages
Authorization: x-api-key: YOUR_ANTHROPIC_API_KEY
Content-Type: application/json { "model": "claude-sonnet-4.6", "max_tokens": 500, "messages": [ { "role": "user", "content": "You are a professional customer support agent. A customer sent this message: '{{ $json.message }}'. Their sentiment score is {{ $json.sentiment_score }} (0=angry, 1=satisfied). Key issues mentioned: {{ $json.extracted_entities }}. Write a concise, empathetic response acknowledging their concern, explaining next steps, and providing relevant information. Keep it under 150 words." } ]
}
Step 6: Optional: Escalated Calls to Cogram
If the ticket involves a phone or video call with the customer, configure Cogram to record and summarise the conversation automatically. This is useful for complex technical issues or complaints that benefit from live discussion. Cogram's API integration captures meeting notes and identifies action items:
POST https://api.cogram.com/v1/integration/meeting
Authorization: Bearer YOUR_COGRAM_API_KEY
Content-Type: application/json { "meeting_id": "{{ $json.ticket_id }}_call", "participants": ["support@company.com", "{{ $json.customer_email }}"], "title": "Support Escalation: {{ $json.extracted_entities[0] }}", "extract_action_items": true, "send_summary_to": "{{ $json.customer_email }}"
}
Step 7: Create Prioritised Ticket in Your System
The final step aggregates all enriched data and creates a ticket your team can action:
POST https://your-ticketing-system.com/api/tickets
Authorization: Bearer YOUR_TICKET_API_KEY
Content-Type: application/json { "title": "Support: {{ $json.extracted_entities[0] }}", "priority": "{{ $json.sentiment_score < 0.3 ? 'high' : 'normal' }}", "customer_email": "{{ $json.customer_email }}", "customer_name": "{{ $json.customer_name }}", "original_message": "{{ $json.message }}", "sentiment_score": "{{ $json.sentiment_score }}", "draft_response": "{{ $json.claude_response }}", "cogram_summary": "{{ $json.cogram_notes }}", "created_at": "{{ $json.message_timestamp }}"
}
Your team sees the ticket with all context, sentiment flag, and a draft response. They spend 30 seconds reviewing and sending instead of five minutes researching and composing.
The Manual Alternative
If you prefer more hands-on control, particularly around response quality, use Twig's support agent interface directly without the full automation. Your team logs in, sees all incoming messages prioritised by TheB.AI's sentiment analysis, and Twig suggests resolutions without automatically sending them. Claude's draft responses sit in a queue for human approval before any customer ever sees them. This approach sacrifices 24/7 automation but gives you complete visibility over outgoing messages.
Pro Tips
Cost optimisation:
Twig resolves most common issues (password resets, order status, refunds) automatically.
This means you're only paying for sentiment analysis and Claude drafting on the 20–30% of tickets that actually need human judgment. Run the workflow for a week and track resolution rates to identify which issue types are best automated versus manual.
Rate limiting:
TheB.AI's sentiment API allows 1000 requests per minute on most plans; n8n's built-in rate limiter prevents you accidentally spiking costs during traffic spikes. Set a ceiling of 500 requests per minute to be conservative.
Error handling:
If Twig's API times out (rare but possible), configure n8n to retry the request twice with exponential backoff before escalating to your team. Set a five-minute timeout; any message that Twig can't resolve in that window goes to a human anyway.
Sentiment thresholds:
A sentiment score below 0.3 indicates an angry or frustrated customer. Mark these as high priority automatically and route them to your most experienced team member. Scores above 0.8 can be handled by newer staff with confidence.
Cogram integration:
Only invoke Cogram when a ticket is marked for a phone call. This keeps costs down; don't record every message exchange, just actual conversations.
Cost Breakdown
| Tool | Plan Needed | Monthly Cost | Notes |
|---|---|---|---|
| Twig | Growth | £80–150 | Per 5000 resolved messages; most issues resolve here |
| TheB.AI | Professional | £60–100 | Sentiment analysis and entity extraction |
| Claude Sonnet 4.6 | API Pay-As-You-Go | £15–40 | ~500 tokens per draft response at ~$0.003/1k tokens |
| Cogram | Professional | £50–80 | Only if you use call recording; optional |
| n8n | Cloud Pro | £30/month | 5000 workflow executions; ample for this setup |
| Total | £235–470 | Saves £2000–4000/month vs. one full-time support hire |