DEV Community

KartikJha
KartikJha

Posted on • Edited on

No space on google cloud :(

If you are like me and don’t fuss about your email much but have a lot of newsletter subscriptions then you probably ran into this problem.

No space left on google cloud storage dashboard

So if you are not feeling lucky (and don’t wanna buy additional storage) and have not organized your inbox much. Then you are in luck as I ran into this same problem and have created a simple script that should take care of those unwanted senders.

Link to script

To use the script you need to get your bearer auth token from google workspace

  1. Log in to google workspace developer dashboard

  2. Go to https://developers.google.com/gmail/api/reference/rest/v1/users.messages/list

  3. Copy bearer auth token from the list request headers, look for https://content-gmail.googleapis.com/gmail/v1/users in network tab.

Network tab screenshot of network call

Now assign this auth token here, update senders based on your requirements here. I have already added some based on my requirements.

All set you are ready to go, just type

touch text.txt
node delete_messages_from_senders.js
Enter fullscreen mode Exit fullscreen mode

It will delete all the messages from listed senders and will update the text.txt file with number of messages per sender.

Happy deleting emails!

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (0)

Cloudinary image

Optimize, customize, deliver, manage and analyze your images.

Remove background in all your web images at the same time, use outpainting to expand images with matching content, remove objects via open-set object detection and fill, recolor, crop, resize... Discover these and hundreds more ways to manage your web images and videos on a scale.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay