12345678910const numbers = await client.availablePhoneNumbers.list({ countryCode: "NG", type: "local", areaCode: "1", pageSize: 10, }); for (const n of numbers) { console.log(n.phone_number, n.region, n.locality, n.price); }
12345678const incoming = await client.incomingPhoneNumbers.create({ phoneNumber: "+23412000000", accountSid: "AC…", voiceUrl: "https://app.example.com/twiml/inbound", voiceMethod: "POST", }); console.log(incoming.sid); // PN…
123456const updated = await client.incomingPhoneNumbers.update("PN…", { voiceUrl: "https://app.example.com/twiml/inbound", voiceMethod: "POST", smsUrl: "https://app.example.com/sms/inbound", statusCallback: "https://app.example.com/calls/status", });
| Field | Purpose |
voiceUrl / voiceMethod | Inbound call handler (returns TwiML) |
statusCallbackUrl / statusCallbackMethod | Call status webhooks |
smsUrl / smsMethod | Inbound SMS handler |
messagingServiceId | Attach a messaging service for outbound SMS |
ringGroupId | Route inbound calls to a ring group |
123456await client.phoneNumberPlans.create({ accountSid: "AC…", phoneNumber: "+23412000000", amount: "5000", currency: "NGN", });
client.incomingPhoneNumbers.remove("PN…")client.incomingPhoneNumbers.list({ accountSid })active, available, released.