Skip to main content

ThreadConnect Voicemail Setup Guide

Version: 2.0 Last Updated: 2026-01-15 Status: Production Ready


Overview​

ThreadConnect provides three voicemail implementation options, each building on the previous tier. This guide covers complete setup from Mailgun configuration through testing.

Feature Packages​

PackageFeature PathEmailUse Case
Basiccallback-and-voicemailNoSimple voicemail/callback without notifications
Enhancedcallback-and-voicemail-with-emailYesFull callback/voicemail with admin email alerts
Auto-Routevoicemail-only-with-emailYesAll calls go directly to voicemail

Voice Experience Framework​

ThreadConnect implements a progressive 3-tier voice experience model:

Tier 1: ThreadConnect Voice Direct​

  • Calls immediately accepted and queued for agents
  • Rejects calls during non-business hours
  • No voicemail capability
  • Implementation: Basic Studio Flow

Tier 2: ThreadConnect Voice Direct with Voicemail (Auto-Route)​

  • Custom greeting plays
  • All calls automatically routed to voicemail recording
  • Task created in Flex queue
  • Email notification with recording + transcription
  • Implementation: voicemail-only-with-email feature
  • Best For: After-hours lines, overflow numbers, dedicated voicemail lines

Tier 3: ThreadConnect Voice Direct with Wait Experience​

  • Callers hear greeting and hold music
  • Press * for options menu
  • Press 1 for callback request
  • Press 2 for voicemail
  • Retain queue position while recording
  • Email notification with recording + transcription
  • Implementation: callback-and-voicemail-with-email feature
  • Best For: Full-service lines with maximum caller flexibility

Feature Comparison​

FeatureBasicEnhanced (with Email)Auto-Route
Voicemail RecordingYesYesYes
Callback RequestYesYesNo
Email NotificationsNoYesYes
TranscriptionNoYesYes
Wait Experience MenuYesYesNo
Hold MusicYesYesNo
Queue Position RetentionYesYesN/A
Mailgun RequiredNoYesYes

Prerequisites​

Required Access​

  • Twilio Account with Flex enabled
  • Twilio CLI installed and configured
  • Access to Twilio Console
  • Mailgun account (for email features)
  • GitHub access to ThreadConnect repository

Required Information​

Before starting, gather:

Twilio Account:
- Account SID: AC________________________________
- Auth Token: ________________________________
- Workspace SID: WS________________________________
- Workflow SID: WW________________________________ (for task routing)

Phone Number:
- Number to configure: +1________________________________

Mailgun (if using email features):
- Mailgun Domain: ________________________________.connie.center
- Mailgun API Key (domain-specific): ________________________________
- Admin Email: ________________________________

Twilio CLI Profile Setup​

# Create profile for the target account
twilio profiles:create --account-sid AC... --auth-token ...

# List profiles
twilio profiles:list

# Switch to target account
twilio profiles:use [PROFILE_NAME]

# Verify active profile
twilio profiles:list # Check for asterisk indicating active profile

Mailgun Setup​

Skip this section if using callback-and-voicemail (basic) without email.

Step 1: Create Mailgun Domain​

  1. Log into Mailgun Dashboard: https://app.mailgun.com
  2. Go to Sending → Domains → Add New Domain
  3. Enter domain name following convention: [identifier].connie.center
    • For phone-number specific: 7025551234.connie.center
    • For shared voicemail: voicemail.connie.center
  4. Complete DNS verification (may take up to 48 hours)

Step 2: Get Domain Sending Key​

CRITICAL: Use domain-specific sending key, NOT your private API key

  1. Go to Sending → Domains → [Your Domain]
  2. Click Sending Keys tab
  3. Click Add Sending Key
  4. Name it descriptively (e.g., connie-voicemail-prod)
  5. Copy the key immediately (only shown once)

Key format: [32 hex chars]-[8 hex chars]-[8 hex chars]

Step 3: Test Mailgun API​

ALWAYS test before deployment:

curl -s -w "\nHTTP Status: %{http_code}\n" \
--user "api:[YOUR_MAILGUN_API_KEY]" \
https://api.mailgun.net/v3/[YOUR_DOMAIN]/messages \
-F from='Test <test@[YOUR_DOMAIN]>' \
-F to='[YOUR_ADMIN_EMAIL]' \
-F subject='Mailgun API Test' \
-F text='Testing Mailgun API credentials before deployment.'

Expected: HTTP 200 with Mailgun message ID If 401/403: Wrong API key (use domain-specific sending key)


Serverless Functions Deployment​

Step 1: Clone Repository​

git clone https://github.com/ConnieML/basecamp-v26.02.git
cd basecamp-v26.02/serverless-functions
npm install

Step 2: Configure Environment Variables​

Create/update .env file:

# Twilio Account
ACCOUNT_SID=AC________________________________
AUTH_TOKEN=________________________________

# Flex Configuration
TWILIO_FLEX_WORKSPACE_SID=WS________________________________
TWILIO_FLEX_CALLBACK_WORKFLOW_SID=WW________________________________

# Mailgun Configuration (required for email features)
ADMIN_EMAIL=alerts@[your-domain].connie.center
MAILGUN_DOMAIN=[your-domain].connie.center
MAILGUN_API_KEY=[your-domain-sending-key]

# Optional: Custom greeting (leave blank for default)
VOICEMAIL_GREETING=

Step 3: Deploy Functions​

# Using the deployment script (recommended)
./deploy.sh [account-name]

# Or manually
npm run deploy

Note the deployment domain (e.g., custom-flex-extensions-serverless-XXXX-dev.twil.io)


Studio Flow Configuration​

Option A: Tier 2 - Voicemail Auto-Route​

Use case: All calls go directly to voicemail

Create Studio Flow JSON (voicemail-auto-route-flow.json):

{
"description": "Connie Voice Direct with Voicemail (Auto-Route)",
"states": [
{
"name": "Trigger",
"type": "trigger",
"transitions": [
{"event": "incomingMessage"},
{"next": "redirect_to_voicemail", "event": "incomingCall"},
{"event": "incomingConversationMessage"},
{"event": "incomingRequest"},
{"event": "incomingParent"}
],
"properties": {
"offset": {"x": 0, "y": 0}
}
},
{
"name": "redirect_to_voicemail",
"type": "twiml-redirect",
"transitions": [
{"event": "return"},
{"event": "timeout"},
{"event": "fail"}
],
"properties": {
"offset": {"x": 0, "y": 200},
"method": "POST",
"url": "https://[DEPLOYMENT_DOMAIN]/features/voicemail-only-with-email/voicemail-greeting",
"timeout": "14400"
}
}
],
"initial_state": "Trigger",
"flags": {
"allow_concurrent_calls": true
}
}

Deploy:

twilio api:studio:v2:flows:create \
--friendly-name "Connie Voice Direct with Voicemail (Auto-Route)" \
--status published \
--definition "$(cat voicemail-auto-route-flow.json)"

Option B: Tier 3 - Wait Experience with Callback/Voicemail​

Use case: Full options menu with callback and voicemail

Replace:

  • [DEPLOYMENT_DOMAIN] with your serverless domain
  • [WORKFLOW_SID] with your TaskRouter workflow SID

Phone Number Configuration​

Via Twilio Console​

  1. Go to Phone Numbers → Manage → Active Numbers
  2. Click on your phone number
  3. Under Voice Configuration:
    • Configure With: Studio Flow
    • A Call Comes In: Select your Studio Flow
  4. Click Save Configuration

Via Twilio CLI​

# Get Flow SID
twilio api:studio:v2:flows:list | grep "Connie Voice"

# Update phone number
twilio api:core:incoming-phone-numbers:update \
--sid PN________________________________ \
--voice-url "https://webhooks.twilio.com/v1/Accounts/[ACCOUNT_SID]/Flows/[FLOW_SID]"

Testing Procedures​

Pre-Deployment Checklist​

  • Mailgun API test returns HTTP 200
  • Environment variables set in serverless
  • Functions deployed successfully
  • Studio Flow created and published
  • Phone number configured to use Studio Flow

Test Procedure​

  1. Call the configured number from an external phone
  2. For Tier 2 (Auto-Route):
    • Hear greeting
    • Leave voicemail (10-15 seconds with identifiable content)
    • Hang up or press *
  3. For Tier 3 (Wait Experience):
    • Hear greeting and hold music
    • Press * for options
    • Press 2 for voicemail
    • Leave voicemail
    • Hang up or press *

Verify Results​

Email Verification:

  • Email received at admin address
  • Audio recording attached (.wav file)
  • Transcription included in email body
  • Caller/called number correct
  • Timestamp accurate

Flex Task Verification:

  • Task appears in Flex queue
  • Task type shows "voicemail"
  • Recording URL accessible
  • Caller information correct

Troubleshooting​

Email Not Arriving​

SymptomLikely CauseSolution
401/403 errors in logsWrong Mailgun API keyUse domain-specific sending key, not private key
404 on first attemptRecording not readyNormal - email sends on transcription callback
Delayed delivery (1-6 hours)Mailgun/network congestionCheck spam folder, wait, or check Mailgun logs
No email at allADMIN_EMAIL not setVerify environment variable in serverless

"Option Not Available" Error​

SymptomLikely CauseSolution
After pressing *Missing workflow SIDSet TWILIO_FLEX_CALLBACK_WORKFLOW_SID env var
Intermittent failuresWorkflow not foundVerify workflow SID exists in TaskRouter

Task Not Created​

SymptomLikely CauseSolution
No task in FlexWorkspace SID wrongVerify TWILIO_FLEX_WORKSPACE_SID matches Flex config
404 errors in logsFunction path mismatchCheck Studio Flow waitUrl matches deployed function

Environment Variable Reference​

Required for All Features​

VariableDescriptionExample
ACCOUNT_SIDTwilio Account SIDAC...
AUTH_TOKENTwilio Auth Token...
TWILIO_FLEX_WORKSPACE_SIDFlex TaskRouter WorkspaceWS...

Required for Email Features​

VariableDescriptionExample
ADMIN_EMAILEmail recipient(s)alerts@voicemail.connie.center
MAILGUN_DOMAINMailgun sending domainvoicemail.connie.center
MAILGUN_API_KEYDomain-specific sending keyfcfa08fa...

Required for Wait Experience (Tier 3)​

VariableDescriptionExample
TWILIO_FLEX_CALLBACK_WORKFLOW_SIDTaskRouter Workflow for callbacksWW...

Quick Reference Commands​

Account Management​

twilio profiles:list                    # List all profiles
twilio profiles:use [NAME] # Switch account
twilio profiles:create # Create new profile

Serverless Operations​

npm run deploy                          # Deploy functions
twilio serverless:logs --tail # Stream function logs

Studio Flow Management​

twilio api:studio:v2:flows:list         # List all flows
twilio api:studio:v2:flows:executions:list --flow-sid [SID] --limit 5

TaskRouter Operations​

twilio api:taskrouter:v1:workspaces:list
twilio api:taskrouter:v1:workspaces:workflows:list --workspace-sid [WS_SID]
twilio api:taskrouter:v1:workspaces:tasks:list --workspace-sid [WS_SID] --limit 10

Mailgun Operations​

# Test API
curl -s --user "api:[KEY]" https://api.mailgun.net/v3/[DOMAIN]/messages \
-F from='Test <test@[DOMAIN]>' \
-F to='[EMAIL]' \
-F subject='Test' \
-F text='Test message'

# Check delivery events
curl -s --user "api:[KEY]" \
"https://api.mailgun.net/v3/[DOMAIN]/events?event=delivered&limit=5"

For questions or issues, contact ThreadConnect Engineering or escalate to CTO.