How it works

The Business Logic (Plain English)
This automated "Traffic Cop" ensures that every new candidate is routed to the correct consultant immediately, preventing ownership disputes and ensuring a fair spread of fresh leads.

The Watchdog (Scheduler): The workflow runs every 15 minutes to check for new candidates entering your Mercury system.

The Historian (Mercury - Placements & Activities): Before assigning the candidate, the agent checks their history. It asks: "Have we successfully placed this person before?" and "Has anyone spoken to them recently?"

The Team Lead (Mercury - System Users): It pulls a live list of your consultants in the relevant sector team.

The Judge (OpenAI): This is the brain. It analyzes the data found in step 2.

Scenario A (Re-allocation): If the candidate was placed by John previously, or John spoke to them last week, the AI selects John. This protects relationship continuity.

Scenario B (Round Robin): If the candidate is brand new (no history), the AI looks at the team list and assigns them to the next person in line, ensuring fair distribution of new leads.

The Assigner (Mercury - Update): Finally, it updates the candidate's record in Mercury, setting the "Owner" field to the selected consultant automatically.

Built Using

x
Scheduler trigger
→ quake_wait
Schedule: Every 15m - Checks for new candidates created in Mercury in the last 15 minutes.
x
Mercury action
→ get__api_v1_contacts
Get New Candidates - Retrieves the latest batch of candidate records from Mercury.
x
Mercury action
→ get__api_v1_candidates_{id}_placements
Check Placements - Checks if we have placed this candidate before to find the original owner.
x
Mercury action
→ get__api_v1_contacts_{contactId}_activities
Check Activities - Reviews recent call/email history to see if a consultant is already engaging.
x
Mercury action
→ get__api_v1_systemusers
Get Team List - Fetches the list of active consultants to perform the Round Robin if needed.
x
OpenAI action
→ openai_generate_json
Decide Owner (AI) - AI Logic: If history exists -> Assign Previous Owner. If new -> Assign Round Robin.
x
Mercury action
→ patch__api_v1_contacts_{contactId}
Update Owner - Writes the selected Consultant ID back to the Candidate record in Mercury.