https://retellai.com/?utm_source=discord&utm_medium=seo logo
Could you please walk me through, step by step, ho...
# ❓・ai-evy-support
d
@AI Evy Could you please walk me through, step by step, how to set up an inbound agent that answers incoming calls, captures the caller’s phone number, and sends it to a webhook? The agent should then wait for a response from the CRM and use that data as custom variables in its prompt. Also, where exactly is this webhook configured?
a
Thanks for tagging me @dropsofsteel. I'll look through relevant sources and get back to you shortly.
### Answer To set up an inbound agent that captures the caller's phone number and uses CRM data as custom variables, follow these steps: ## Step 1: Create Your Agent First, create an agent in the Retell dashboard and bind it to your phone number [(1) ]() . ## Step 2: Configure the Inbound Webhook The webhook is configured at the phone number level in your Retell dashboard [(2) ]() . Navigate to your phone number settings and enable the "Inbound Webhook" feature . ## Step 3: Build Your Webhook Endpoint Create a POST endpoint that will receive the inbound call data. Retell will send you this payload :
Copy code
json
{
  "event": "call_inbound",
  "call_inbound": {
    "agent_id": "agent_12345",
    "agent_version": 1,
    "from_number": "+12137771234",
    "to_number": "+12137771235"
  }
}
The
from_number
field contains the caller's phone number . ## Step 4: Query Your CRM and Return Dynamic Variables Your webhook should query your CRM using the
from_number
, then return a JSON response with the CRM data as dynamic variables :
Copy code
json
{
  "call_inbound": {
    "dynamic_variables": {
      "customer_name": "John Doe",
      "account_status": "active"
    },
    "metadata": {
      "random_id": "12345"
    }
  }
}
## Step 5: Use Dynamic Variables in Your Agent Prompt In your agent's prompt, reference the dynamic variables using the
{{variable_name}}
syntax [(3) ]() . For example: "Hello
{{customer_name}}
, thanks for calling!" The agent will wait for your webhook response (with a 10-second timeout) before connecting the call [(2) ]() . If the webhook doesn't respond successfully within 10 seconds, it will retry up to 3 times . Important Notes: - All dynamic variable values must be strings [(3) ]() - The webhook must return a successful status code (2xx) [(2) ]() - You can also override the agent ID or version in the webhook response if needed
​ To learn more, see the sources I considered: [[1] Receive calls](https://docs.retellai.com/deploy/inbound-call) [[2] Inbound webhook](https://docs.retellai.com/features/inbound-call-webhook) [[3] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.