Closed seeppp closed 2 days ago
Twilio offers an endpoint to lookup phone numbers. https://www.twilio.com/docs/lookup/quickstart
A new method lookup(number:) in the Twilio module will use the Twilio Endpoint to lookup the given phone number.
lookup(number:)
import Twilio func routes(_ app: Application) throws { app.get("lookup") { req -> EventLoopFuture<LookupResponse> in let phoneNumber = "+18316100806" return req.twilio.lookup(phoneNumber) } }
If successful, the LoopupResponse will look like this:
LoopupResponse
{ "countryCode": "US", "nationalFormat": "(831) 610-0806", "carrier": { "name": "Twilio - Inteliquent - SMS-Sybase365/MMS-SVR", "type": "voip" }, "phoneNumber": "+18316100806" }
The carrier.type can either be voip, mobile or landline. Which is very handy to check if a number can receive SMS.
carrier.type
voip
mobile
landline
Twilio offers an endpoint to lookup phone numbers. https://www.twilio.com/docs/lookup/quickstart
A new method
lookup(number:)
in the Twilio module will use the Twilio Endpoint to lookup the given phone number.If successful, the
LoopupResponse
will look like this:The
carrier.type
can either bevoip
,mobile
orlandline
. Which is very handy to check if a number can receive SMS.