I'm using the Gmail API + Google Pub/Sub API to deliver Push notifications to my Node server running on an EC2 instance, for every time I receive an email on a watch()ed inbox. I add the domain of my server to the Push section of console.developers.google.com, and then for the Pub/Sub API, I create a subscription and add the Push Endpoint URL. The endpoint looks something like this: https://example.com/receive.
What I'd like to do is to test this locally.
How do I make Google send push notifications to my localhost server? When I test, I'd like notifications for new emails to be sent to http://localhost:8080/receive. I was thinking of perhaps using ngrok to expose localhost - the problem though is that I would have to manually upload a proof for Google (that I own the domain) every time the ngrok URL changed, which is a huge headache.
Does there exist some nicer way of receiving the new email notification on my localhost server?
One option is to pay $5/month to ngrok and get a custom subdomain. Another option is to emulate HTTP POST requests for those notifications by yourself. It's doable by curl as follows:
$ curl -i --data @push_notification.json http://localhost:8080/receive
You need to have a local file 'push_notification.json' with the same content as the gmail push notification.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With