nielsnl
2 days ago

Twitter Notification Channel with ShouldQueue

Posted 2 days ago by nielsnl

I have a bunch of notifications that send e-mails and use ShouldQueue to do so in the background. For example:

class InvoiceCreatedNotification extends Notification implements ShouldQueue
{

    use Queueable;

    protected $invoice;
etc..

Now I'm trying to send Twitter DIrectMessages in these same notifications and run into this error:

NotificationChannels\Twitter\Exceptions\CouldNotSendNotification ยท Couldn't post notification. Response: Invalid or expired token.

You would think there's something wrong with how I setup the twitter channel credentials. (Using the .env file as per instructions.) But when I remove the ShouldQueue from the notification, the DirectMessage works as expected:

class InvoiceCreatedNotification extends Notification
{

    use Queueable;

    protected $invoice;
etc..

There's something about ShouldQueue that messes up the credentials for the Twitter Channel. But I'm not sure where to start. Is anyone using the Twitter Channel DirectMessage successfully in a ShouldQueue Notification?

Please sign in or create an account to participate in this conversation.