Phone Number API
The Phone Number API allows you to manage phone numbers for your agents. You can list all phone numbers associated with your account, attach phone numbers to agents, and detach phone numbers from agents.
Note
Phone numbers must be purchased through the OmniDimension dashboard before they can be managed via the API.
List Phone Numbers
Parameters
page
int
Optional
Page number for pagination.
page_size
int
Optional
Number of items per page.
Example
1
2
3
4
5
6
7
8
9
10
import os
from omnidimension import Client
# Initialize the client
api_key = os.environ.get('OMNIDIM_API_KEY')
client = Client(api_key)
# List all phone numbers with pagination
response = client.phone_number.list(page=1, page_size=10)
print(response)Attach Phone Number to Agent
Parameters
phone_number_id
int
Required
ID of the phone number to attach.
agent_id
int
Required
ID of the agent to attach the phone number to.
Example
1
2
3
4
5
6
7
8
9
10
11
12
import os
from omnidimension import Client
# Initialize the client
api_key = os.environ.get('OMNIDIM_API_KEY')
client = Client(api_key)
# Attach a phone number to an agent
phone_number_id = 123 # Replace with your phone number ID
agent_id = 456 # Replace with your agent ID
response = client.phone_number.attach(phone_number_id, agent_id)
print(response)Note
Both phone_number_id and agent_id must be integers. The phone number must be owned by your account, and the agent must exist in your account.
Detach Phone Number
Parameters
phone_number_id
int
Required
ID of the phone number to detach.
Example
1
2
3
4
5
6
7
8
9
10
11
import os
from omnidimension import Client
# Initialize the client
api_key = os.environ.get('OMNIDIM_API_KEY')
client = Client(api_key)
# Detach a phone number from its associated agent
phone_number_id = 123 # Replace with your phone number ID
response = client.phone_number.detach(phone_number_id)
print(response)Note
The phone_number_id must be an integer and must correspond to a phone number owned by your account.
Import Twilio Number
Parameters
phone_number
string
Required
The Twilio phone number to import (including country code).
account_sid
string
Required
Your Twilio Account SID.
account_token
string
Required
Your Twilio Auth Token.
name
string
Optional
Optional custom name for the phone number.
Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import os
from omnidimension import Client
# Initialize the client
api_key = os.environ.get('OMNIDIM_API_KEY')
client = Client(api_key)
# Import an existing Twilio number
response = client.phone_number.import_twilio_number(
phone_number="+1234567890",
account_sid="AC1234567890abcdef1234567890abcdef",
account_token="your_twilio_auth_token",
name="My Twilio Number" # Optional
)
print(response)Note
The phone number must be in E.164 format (starting with +). Make sure the Twilio credentials have the necessary permissions to access the phone number.
Import Exotel Number
Parameters
exotel_phone_number
string
Required
The Exotel phone number to import.
exotel_api_key
string
Required
Your Exotel API key.
exotel_api_token
string
Required
Your Exotel API token.
exotel_subdomain
string
Required
Your Exotel subdomain.
exotel_account_sid
string
Required
Your Exotel Account SID.
exotel_app_id
string
Required
Your Exotel App ID.
name
string
Optional
Optional custom name for the phone number.
Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import os
from omnidimension import Client
# Initialize the client
api_key = os.environ.get('OMNIDIM_API_KEY')
client = Client(api_key)
# Import an existing Exotel number
response = client.phone_number.import_exotel_number(
exotel_phone_number="02261234567",
exotel_api_key="your_exotel_api_key",
exotel_api_token="your_exotel_api_token",
exotel_subdomain="your_subdomain",
exotel_account_sid="your_account_sid",
exotel_app_id="your_app_id",
name="My Exotel Number" # Optional
)
print(response)Note
All Exotel credentials are required for successful import. Make sure the provided credentials have access to the specified phone number.