Twilio Studio Api - how to associate a Flow with a Number
This is absolutely possible and can be done via the incomingPhoneNumbers
Object. You would set the voiceURL property to the "webhook" URL of the studio flow.
// Install the C# / .NET helper library from twilio.com/docs/csharp/install
using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account;
class Program
{
static void Main(string[] args)
{
// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");
TwilioClient.Init(accountSid, authToken);
var incomingPhoneNumber = IncomingPhoneNumberResource.Update(
voiceUrl: new Uri("https://www.your-new-voice-url.com/example"),
pathSid: "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
);
Console.WriteLine(incomingPhoneNumber.FriendlyName);
}
}
See also the documentation.