laravel-notification-channels / twilio

Twilio notifications channel for Laravel

Home Page:https://laravel-notification-channels.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

3rd party Twilio provider, multiple accounts

clod986 opened this issue · 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?

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?

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

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

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?

commented

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.