twilio icon indicating copy to clipboard operation
twilio copied to clipboard

3rd party Twilio provider, multiple accounts

Open clod986 opened this issue 4 years ago • 5 comments

I would like to use this package to run multiple Twilio accounts on my website; each account is managed by one of my users. Basically I'm looking into becoming a 3rd party provider for Twilio.

How can I achieve this if the configuration gets pulled from a static .env file?

I guess I have to find a way to bypass the general booting in the TwilioProvider class

$this->app->bind(TwilioConfig::class, function () {
    return new TwilioConfig($this->app['config']['twilio-notification-channel']);
});

and rebuild the TwilioConfig for each TwilioMessage I'll be sending. Is this correct? How can I achieve this?

clod986 avatar Apr 29 '20 08:04 clod986

I am also looking to do this but with subaccounts, which also have their own SID and Auth Token. It looks like in the toTwilio method, I can do return (new TwilioSmsMessage())->applicationSid($mySid)) to provide an SID dynamically, but I don't see a way of providing the Auth Token. Anyone know if there's a good way to do this?

bbeng89 avatar Jul 02 '20 18:07 bbeng89

Would be happy to accept a PR that allows you to set the auth creds on a message basis 👍

atymic avatar Oct 04 '20 23:10 atymic

Hi. Any possible future release with this feature? PRs for this still welcome?

athphane avatar Feb 10 '22 18:02 athphane

Same here, would like to use subaccounts on the same Laravel app but can't find the way to provide the auth token as it's loaded from the twill provider. Any ideas?

danielcharrua avatar Jun 16 '22 09:06 danielcharrua

If you're still interested in an approach for per-user config then let me know as there's a fairly straight forward way of doing it.

lrljoe avatar May 29 '23 19:05 lrljoe