I am trying to create a workflow using Google Calendar, Pub/Sub Topics, and a Subscriber.
The process would be as follows:
when an event is created on a particular calendar on Google Calendar, the Calendar API adds the event metadata (start date/time, end date/time, etc.) to a topic.
The Pub/Sub subscription then calls the subscriber (a Google Cloud Function) and passes the topic data
The Google Cloud function executes while using the data it got from the topic (calendar event info)/
Part 2 and 3 seems to be the easy bit, I am able to create a topic (which has an endpoint) and I'm able to create the subscription which will have my Cloud Function's endpoint configured to be the subscription.
Part 1 is what I'm struggling to understand. Can anyone please tell me how to configure Google Calendar so when a certain calendar gets updated with a new event, the api sends that new event's info to the topic configured to the pub/sub topic?
Any help with this would be extremely appreciated!
Many Thanks,
Dean
According to Google Calendar API you can get event updates only through http(s) webhooks.
In your case you must have some http service that receives requests to webhook endpoint and publishes to Google PubSub channel.
Related
I have an API that's from a third party (for me and for gcp), I want to know if it is possible to set a pull that get data from the API into PUBSUB, or from a wrapper API that I can set in my environment.
Basic schema:
(third party API) -Pull-> PUBSUB -Cloud Function-> BigQuery
I think in the code of the third party api, you can use the Google Pub Sub client, pull the messages and acknowledge them if there is no error.
The Cloud Pub/Sub client libraries use streaming pull to receive messages instead of pull.
The link for Pub Sub Python client for example :
https://googleapis.dev/python/pubsub/latest/pubsub/subscriber/index.html#pulling-a-subscription-asynchronously
You can also check this topic : How to pull messages from a subscription with GCP Pub/Sub?
You can write a cloud function, either scheduled via Cloud Scheduler or HTTP-triggered, that pulls the data and publishes to PubSub. Your next Cloud Function can then be PubSub triggered to move the data from your PubSub message to BigQuery.
I am setting up alerting for GCP VMs. It works fine for email, but I'm trying to use the webhook option. It shows the incident was caught and the webhook triggered. But I don't see an alert on the receiving end. I don't know how to debug since GCP webhooks seems like a blackbox. Does anybody know where I can see the log for the actual webhook call? I'm not sure it is receiving an alert ID from the webhook call.
I'm using this document:
https://cloud.google.com/monitoring/alerts/using-channels-api#api-create-channels
Thanks!
Gary
You configure a webhook notification channel and expect to be notified when incidents occur, but you might not receive any notifications because of following reasons:
1.Private endpoint
You can't use webhooks for notifications unless the endpoint is public.
To resolve this situation, use Pub/Sub notifications combined with a pull subscription to that notification topic.
When you configure a Pub/Sub notification channel, incident notifications are sent to a Pub/Sub queue that has Identity and Access Management controls. Any service that can query for, or listen to, a Pub/Sub topic can consume these notifications. For example, applications running on App Engine, Cloud Run, or Compute Engine virtual machines can consume these notifications.
2.Public endpoint
To identify why the delivery failed, examine your Cloud Logging log entries for failure information.
For example, you can search for log entries for the notification channel resource by using the Logs Explorer, with a filter like the following:
resource.type="stackdriver_notification_channel"
NOTE : Also check whether you have been mentioned in the recipient list, if not mentioned you will not be able to see the alert on the receiving end.
Refer Troubleshooting Alerting policies for information.
I am relatively new to GCP platform. I need to create a system wherein my team gets notifications whenever an email is received from there client.
I have to create a system which is publishing messages in pubsub topic filtered by email id.
example : I want to publish only those message/emails in which "To" and "From" fields has "example#gmail.com"
I have referred the online documentations but could not find the workaround.
Is this possible using GCP?
If not is there any other service via which I can achieve the same ?
We are using Gmail as the email client
Thanks
What you can use, is Pub/Sub together with Cloud Functions, which enables to access Gmail programmatically. Your specific scenario could look as following:
User sets up Gmail push notifications: every time a new message arrives at inbox, Gmail will send a notification to Cloud Pub/Sub.
Cloud Pub/Sub delivers the new message notification to Google Cloud Functions.
Upon arrival of the new message notification, a Cloud Functions instance connects to Gmail and retrieves the new message.
Check who send the message, and perform specific actions.
Before setting up a Cloud Function to automatically read your emails, you must authorize its access to Gmail. Have a look for codelab scenario and see step by step how to perform specific actions and adjust the function for your needs. Additionally, you can take a look for official documentation here.
I have a pubsub topic name
projects/project_name/topics/Sandbox_PubSub
and I also have a subscription on that topic.
and then I have a cloud function name Sandbox_function which triggers with a publish on that topic.
I have a python code where I am publishing the data to this topic via a mosquitto broker
'/devices/device_id/events/Sandbox_PubSub'
Its working perfectly fine and I am receiving data in the cloud function as well as in the subscription.
Now I created another topic name
projects/project_name/topics/Pairing
and then subscription and another cloud function called Pairing_Function
Now when I publish my data on
'/devices/device_id/events/Pairing'
Instead of getting that data in Pairing_Function I am getting the data in Sandbox_Function as a subFolder Pairing and also in Sandbox_Subscription instead of Pairing subscription.
What i am doing wrong here? and how can i get data into different topics?
thanks a lot!
I found it that we need to define the topics in the registry too.
(see: IoT core -> Registry Edit -> Add more telemetry topics)
We need to redirect the subFolder to specific topics
I want to develop an app that allows the users of the app (sellers on Amazon), to send me a notification when they receive an order on Amazon (a notification containing informations about the order).
Is it possible?
Maybe only the seller can receive notifications about his account.
I think, if it's possible, I need a MWS and a AWS account.
In the documentation of MWS (https://docs.developer.amazonservices.com/en_US/notifications/Notifications_Overview.html), there is:
The Amazon MWS push notifications enable you to receive information
that is relevant to your business with Amazon without having to poll
the Amazon MWS service. Instead, the information is sent directly to
you when an event occurs to which you are subscribed. For more
information about how to subscribe to receive notifications, see
Subscriptions Overview in the Amazon MWS Subscriptions API section
reference.
Then, in the 'Subscriptions API' section:
The Amazon MWS Subscriptions API section enables you to subscribe to
receive notifications that are relevant to your business with Amazon.
With the operations in the Subscriptions API section, you can register
to receive important information from Amazon without having to poll
the Amazon MWS service. Instead, the information is sent directly to
you when an event occurs to which you are subscribed.
To receive notifications, you must first create and register a
Destination, such as an Amazon Simple Queue Service (Amazon SQS)
queue. Then, you create a Subscription for the NotificationType that
you want to receive, such as a notification when another Seller has
changed their offer for an item that you also sell. Finally, verify
that Amazon is able to send notifications to your Destination by
calling the SendTestNotificationToDestination operation.
Not at this time. The only notification options are AnyOfferChangedNotification, which sends an SQS message when any one of the top 20 offers for an ASIN changes, and FulfillmentOrderStatusNotification, which notifies you if there is a multi channel order status chance, and FeePromotionNotification.
This hasn't changed since I started using the AnyOfferChangedNotification several years ago.
One idea is to create an app that uses the Orders API periodically to check for orders, then you can have the app create the SQS message (or use another service altogether). This would then notify you of a new order.