Fetch e-mail and user
# support
d
Hey, do you know how I can fetch the user name and e-mail so the Assistant greets me dinamically ? I tried with a tool but couldn't get him to do it. Also tried in the Assistant's instructions but couldn't get it.
v
To greet users dynamically with their name and email, use dynamic variables in your assistant's prompt and set their values via your server. For example, in your prompt:
Copy code
text
Hello {{customerName}}! Your email is {{customerEmail}}.
Then, in your server endpoint, respond like this:
Copy code
js
res.json({
  assistantId: "your-assistant-id",
  assistantOverrides: {
    variableValues: {
      customerName: user.name,
      customerEmail: user.email
    }
  }
});
This will let the assistant greet each caller with their specific name and email automatically. Sources: - [Personalization with user information](https://docs.vapi.ai/assistants/personalization) - [Variables](https://docs.vapi.ai/assistants/dynamic-variables)
d
How can I put that in my server endpoint ? Can you give me a step by step on that ?
c
Hi Darpinch.Calisthenics, 1. Add variables in your assistant's instructions using
{{variable_name}}
syntax:
Copy code
"Hello {{customerName}}! Your email is {{customerEmail}}"
2. Set up your server endpoint to return these variables when a call comes in:
Copy code
app.post("/api/assistant-selector", async (req, res) => {  if (req.body.message?.type === "assistant-request") {    const phoneNumber = req.body.call.from.phoneNumber;    const customer = await crmAPI.getCustomerByPhone(phoneNumber);    res.json({      assistantId: "your_assistant_id",      assistantOverrides: {        variableValues: {          customerName: customer.name,          customerEmail: customer.email        }      }    });  }});
You'll need to: 1. Configure your phone number to use your server endpoint 2. Implement customer lookup logic on your server 3. Return the customer data within 7.5 seconds The data will be automatically inserted into your assistant's conversation.
2 Views