Twilio API Phone Number Available

I work with the Twilio Available Phone Numbers API and try to list all available phones for Brazil. It works fine, but I can’t get the phone location from the answer, with city and state. If possible, he should get to the city using the regional code, but Brazil shares the city code with several cities in the same region. ZipCode is also not an option, because it is always empty for Brazilian phones)

When I search for a phone using the Twilio interface, I can see its location exactly the way I need it, so it should be available somewhere, but I cannot get this information from the API response.

Any hints of this?

+4
source share
1 answer

Twilio evangelist developer is here.

Using the search API you can get a lot of information about the number, but, unfortunately, this is not the place at the moment.

You can get the exact location in some rooms. I say “some numbers” because some will have information about latitude and longitude, which you can then use to pinpoint this location.

I just made the request myself, and one of the numbers returned this:

{
  "friendly_name": "+55513937XXXX",
  "phone_number": "+55513937XXXX",
  "lata": null,
  "rate_center": null,
  "latitude": "-16.516700",
  "longitude": "-39.350000",
  "region": "RS",
  "postal_code": null,
  "iso_country": "BR",
  "address_requirements": "none",
  "beta": false,
  "capabilities": {
    "voice": true,
    "SMS": false,
    "MMS": false
  }
}

This gave me a very accurate location , but as I said, it’s probably not something you can rely on completely, since we rely on information from carriers and they don’t always give us this.

, .

curl -G https://api.twilio.com/2010-04-01/Accounts/YOUR_TWILIO_SID/AvailablePhoneNumbers/BR/Local.json \
-d "Contains=5551*" \
-u 'YOUR_TWILIO_SID:YOUR_AUTH_TOKEN'

, .

+1

Source: https://habr.com/ru/post/1629673/


All Articles