Uros Jovanovic
09/25/2025, 1:51 PMVapi Support Bot
09/25/2025, 1:52 PMjs
app.post("/api/assistant-selector", async (req, res) => {
if (req.body.message?.type === "assistant-request") {
const phoneNumber = req.body.call.from.phoneNumber;
const previousCall = await db.findOutboundCallByNumber(phoneNumber);
if (previousCall) {
return res.json({ assistantId: "your_assistant_id" });
}
return res.json({ error: "No previous call found." });
}
});
This ensures returning callers are routed to the correct assistant context automatically.
Source:
- [Personalization with user information](https://docs.vapi.ai/assistants/personalization)Uros Jovanovic
09/25/2025, 1:57 PMChiranjeet Mishra
09/29/2025, 4:02 PM