Purchase Phone Number & Assign Voice Agent

After this step, this number would be good for inbound.

Check out Create Phone Number API Reference for all the parameters you can use.

  • Phone numbers can be re-used. Find numbers previously purchased here.
  • The agent_id parameter is the assigned agent to pickup the phone when users call this number, aka inbound.
const phoneNumberResponse = await retell.phoneNumber.create({
  agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD', // replace with the agent id you want to assign
});
console.log(phoneNumberResponse);

Make Outbound Call

Check out Create Phone Call API Reference for all the parameters you can use.

  • from_number is the number you purchased earlier. You can replace it with a static string.
  • to_number is the user phone number.
const registerCallResponse = await retell.call.create({
  from_number: '+14157774444', // replace with the number you purchased
  to_number: '+12137774445',  // replace with the number you want to call
});
console.log(registerCallResponse);

Update the Voice Agent Bound to A Number

Check out Update Phone Number API Reference for all the parameters you can use to update the inbound agent who picks up the phone.

Get Call Detail

  • API: You can use Get Call API to get information like transcript, recording, latency tracking, etc.
  • Webhook: You can also setup webhooks to receive real time updates when call is initiated, ends, and analyzed. Read more at Call Webhook Guide.