https://retellai.com/?utm_source=discord&utm_medium=seo logo
I changed the agent for a phone number but a previ...
# ❓・ai-evy-support
m
@AI Evy I changed the agent for a phone number but a previous agent keeps on being used. I used n8n to call the number for the use of outbound purposes. I am confused becasuae the agent version that I have assigned is not being used. Please help.
a
Thanks for tagging me @mctrades. I'll look through relevant sources and get back to you shortly.
This will show you the current
outbound_agent_id
and
outbound_agent_version
assigned to your phone number . If you need to update the agent assignment, use the Update Phone Number API with the correct
outbound_agent_id
and
outbound_agent_version
[(1) ]() . The version parameter is important - if not provided, it will default to the latest version . Based on a Discord discussion about outbound call APIs, there may be additional considerations when using external tools like n8n for triggering outbound calls [(5) ]() . The API structure mentioned includes specifying the
agent_id
in the call creation request . If you're still experiencing issues after verifying the phone number configuration, you might want to check if your n8n workflow is overriding the agent ID in the outbound call request itself, as this could bypass the phone number's default agent assignment.
### Answer [(1) ]() , [(2) ]() , [(3) ]() , [(4) ]() , [(5) ]() : When you update a phone number's agent assignment, you need to ensure both the
outbound_agent_id
and
outbound_agent_version
are properly set [(1) ]() . The phone number will automatically use the specified agent when conducting outbound calls . To verify your current configuration, first check what agent is actually assigned to your phone number using the Get Phone Number API [(2) ]() :
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const phoneNumberResponse = await client.phoneNumber.retrieve('+14157774444') ;
console.log(phoneNumberResponse.inbound_agent_id) ;
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
m
how andwhere do i install the Get Phone Number API
a
Thanks for the follow-up, @mctrades. I'll get back to you soon.
m
@AI Evy how andwhere do i install the Get Phone Number API
a
​ To learn more, see the sources I considered: [[1] Get Phone Number](https://docs.retellai.com/api-references/get-phone-number) ​
### Answer The Get Phone Number API doesn't require a separate installation - it's part of the Retell SDK [(1) ]() . You need to install the Retell SDK first, then use the phone number retrieval method . Here's how to use it with JavaScript:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const phoneNumberResponse = await client.phoneNumber.retrieve('+14157774444') ;
console.log(phoneNumberResponse.inbound_agent_id) ;
To use this API: 1. Install the Retell SDK in your project (the exact installation method depends on your environment - typically
npm install retell-sdk
for Node.js projects) 2. Import the Retell client and initialize it with your API key 3. Use the
client.phoneNumber.retrieve()
method with the phone number in E.164 format The API requires authentication using your API key in the format "Bearer YOUR_API_KEY" . You can find your API key in the Retell dashboard . This will return details about the phone number including the assigned agents, versions, area code, nickname, and webhook URL .
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.