laravel-notification-channels / twilio

Twilio notifications channel for Laravel
https://laravel-notification-channels.com
227 stars 36 forks source link

"[HTTP 401] Unable to create record: Authenticate" #133

Open LyndonMcjohnson opened 2 years ago

LyndonMcjohnson commented 2 years ago

What am I doing wrong here?

.env:

TWILIO_SID=[Valid SID]
TWILIO_AUTH_TOKEN=[Valid Token]
TWILIO_NUMBER=[Valid Number]
TWILIO_APPLICATION_SID=[Valid App SID]
TWILIO_API_KEY=[Valid API Key]
TWILIO_API_SECRET=[Valid API Secret]
TWILIO_ACCOUNT_SID=[Valid Account SID]

Notification Class:

public function via($notifiable)
{
    return ['mail', 'database', TwilioChannel::class];
}

public function toTwilio($notifiable)
{
    return (new TwilioMmsMessage())
    ->content('Your service request for ' . $this->subscription->service->name . ' has been updated to the ' . $this->subscription->status . ' status')
    ->mediaUrl(route('services'));
}

Controller:

$subscription->client->notify((new ServiceUpdated($subscription))->afterCommit());
AlsonicTech commented 2 years ago

Did you fixed this? I think is related to notifications that are sent into queues maybe?

LyndonMcjohnson commented 2 years ago

No, I scratched it.

edgrosvenor commented 2 years ago

The problem is that this package expects the account SID to be used as the method of authentication rather than an API key. This PR would fix it for you: https://github.com/laravel-notification-channels/twilio/pull/135