Reputation: 301
I have a main account and several subaccounts for my clients. I want to make a main studio flow in the main account that can start studio flows in the subaccounts. When I start the main flow, it will have a "from" number, and I want to use that number to know which subaccount flow to start. Is there a way to make this work?
Upvotes: 0
Views: 106
Reputation: 31
In the way you are describing your use case, it is not possible to execute a flow in your subaccount, it is because the "From" parameter must be a phone number in your account, in this case in your parent account.
You can create a workaround using our custom parameters when you execute the flow, it can be like this:
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = require('twilio')(accountSid, authToken);
client.studio.v2.flows('FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
.executions
.create({parameters: {
phone: '+15558674444'
}, to: '+15558675310', from: '+15017122661'})
.then(execution => console.log(execution.sid));
Please notice that this is a Javascript example, if you are using a different language, you can find more information in this reference https://www.twilio.com/docs/studio/rest-api/v2/execution, or open a ticket with Twilio support.
After that, you can use connect call to widget (https://www.twilio.com/docs/studio/widget-library/connect-call) to transfer the call to your subaccount (to use connect call to, you need to execute Make Outgoing Call widget before). You can access the subaccount's phone number with flow.data.MY_CUSTOM_VARIABLE, in my example it would be flow.data.phone.
Upvotes: 0