List my phone number inventory inside Twilio flex

故事扮演 提交于 2021-01-29 17:50:33

问题


I need to show a list of my purchased phone numbers inside my flex app in order to let the agent choose which number to call from.

I've been checking both REST and flex/manager docs and I can't find a resource that let me request the list of purchased numbers.

Edit after an answer: There's this REST API endpoint which may look like what I need: https://www.twilio.com/docs/phone-numbers/global-catalog/api/active-numbers

curl -G https://preview.twilio.com/Numbers/ActiveNumbers/PNyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy.json \
    -u '<ACCOUNT_SID:AUTH_TOKEN>'

But as I see it, it needs the phone number id as a parameter in the URL? (PNyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy)

I've tried to request the root resource: https://preview.twilio.com/Numbers/ActiveNumbers/ but the I get an error: The requested resource /Numbers/ActiveNumbers was not found

Some help would be much appreciated


回答1:


List all IncomingPhoneNumber resources for your account

curl -X GET 'https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.json?PageSize=20' \
-u ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token

Source: https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource




回答2:


You can do this with Active Numbers API. The API is still in the developer preview (August, 2020).

$ curl -G https://preview.twilio.com/Numbers/ActiveNumbers/PNyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy.json \
    -u '<ACCOUNT_SID:AUTH_TOKEN>'

The API returns the set of active telephone numbers along with their capabilities

[{
    "phone_number": "+18559728742",
    "url": "https://preview.twilio.com/Numbers/ActiveNumbers/PNyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
    "capabilities": {
        "voice": {
            "inbound_connectivity": true,
            "outbound_connectivity": true,
            "e911": false,
            "fax": true,
            "calls_per_second": 20,
            "concurrent_calls_limit": 40,
            "long_record_length": 30,
            "inbound_called_dtmf": true,
            "inbound_caller_dtmf": true,
            "sip_trunking": true,
            "inbound_caller_id_preservation": "international",
            "inbound_reachability": "global"
        },
        "sms": {
            ....
]


来源:https://stackoverflow.com/questions/63296967/list-my-phone-number-inventory-inside-twilio-flex

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!