dacastro4 / laravel-gmail

Laravel wrapper for the Gmail API
MIT License
293 stars 135 forks source link

Gmail Pub/Sub API Integration for Real-Time Email Notifications in Laravel #285

Open umarzahid028 opened 1 month ago

umarzahid028 commented 1 month ago

Hey

I'm encountering an issue. I've set up topics and subscriptions, and everything works fine when I test internally. However, when I use the watch method in Laravel, I get the following error:

{
    "error": {
        "code": 403,
        "message": "Error sending test message to Cloud PubSub projects/test111/topics/gmail : User not authorized to perform this action.",
        "errors": [
            {
                "message": "Error sending test message to Cloud PubSub projects/test111/topics/gmail : User not authorized to perform this action.",
                "domain": "global",
                "reason": "forbidden"
            }
        ],
        "status": "PERMISSION_DENIED"
    }
}

My main goal is to receive emails in real-time when they arrive in the Gmail inbox. Previously, I used a cron job, which worked fine, but now I plan to use the Pub/Sub API for instant notifications. Has anyone implemented something similar? If so, could you guide me on how to achieve this setup?

Thanks Umar