Unable to receive Google reports api push notifications - google-admin-sdk

We have an application where in we need to notify a URL whenever a new user is created in the Google Apps Domain. The notifying url is https://projectId.appspot.com/userWatcher. Have verified the domain in the app engine console as https://projectId.appspot.com even then unuable to receive the push notification messages to the notifying URL. Kindly help me out

To use push notification make sure you do this things:
Register the domain of your receiving URL.
For example, if you plan to use https://example.com/notifications as your receiving URL, you need to register https://example.com.
Set up your receiving URL, or "Webhook" callback receiver.
This is an HTTPS server that handles the API notification messages that are triggered when a resource changes.
Set up a notification channel for each resource endpoint you want to watch.
A channel specifies routing information for notification messages. As part of the channel setup, you identify the specific URL where you want to receive notifications. Whenever a channel's resource changes, the Reports API sends a notification message as a POST request to that URL.
For more information check this page.

Related

Azure event hub sending duplicate events

I am using azure event hub to receive notification on arrival of messages in inbox.
When I send an email without attachment I receive only one notification from event hub.
When I send an email with attachment I receive two notifications.
I have activated "Defender with Safe Attachments Dynamic Delivery" for my azure tenant.
Please advise me why is this happening.
How did you register that? Are you using Event Hub or Event grid? You can't register the Event Hub direct to listen to Exchange\Outlook. You need either event grid or something to tap into the Graph Api, listen to events like email sending and send it to Azure Event hub
Also when a message has an attachment, to get both message body and attachment, it will invoke Graph API twice:
1 for the body: https://graph.microsoft.com/v1.0/me/messages
and
1 for the attachments: https://graph.microsoft.com/v1.0/me/messages/{id}/attachments

Notify Django Channels websocket from Rest Framework action

My app uses Django Rest Framework for the API. I wanted to add live notifications/status to it.
The flow would be
User loads page then makes a get API request to load data
Websocket connects on page load and subscribes to 'notifications' channel that's in ServerNotifConsumer
User clicks a button which sends a POST request to API that does some db stuff that would return success or failure info. Returns status 202 Accepted immediately then processes command.
Return info via websocket to all subscribed clients
Is there a way from within the DRF viewset action to send anything to the websocket consumer? Or would the best way to go about this be to rewrite the API endpoint to only receive via websocket? (rather not do)

How can I debug my SNS subscription?

I have created a basic SNS topic. It's a HTTP (and HTTPS) request a an endpoint on my web server. The web server is not on AWS.
The endpoint the SNS subscription points to sends me an email containing all of the headers of the request. Even if the headers are empty and email will be sent. A request of any kind will result in an email.
The endpoint will process the request regardless of the HTTP verb used (GET, POST, etc).
If I visit the endpoint in my browser, I receive an email. When I try to request a confirmation within the AWS control panel, I get nothing.
I thought this could be down to me using a Let's Encrypt SSL, but I have also tried using a HTTP endpoint, rather than HTTPS, but get the same issue.
How can I debug this? Is there any way of seeing why the request is failing?
When I need to debug http web hooks and such like this, I use this tool:
https://ngrok.com/
to setup a public endpoint that points to my local web server, that I am running in my development environment, so I can see the request come in, and depending on the language (usually .net for me), I can step thru the code as the request is received in my debugger. You'll need to temporarily point your sns topic to this endpoint.
This won't help if you are not getting the request at all, but if there is any question that the request is coming in, but its not being processed correctly, this may help.

Bosun notification URL in subscription

I have fiware-bosun running. I’m trying to create a new rule to send me an email when memory usage is higher than 95% but when I try to subscribe the server to this rule I do not know which notification URL should I have to write in the subscription.
Can you help me?
FIWARE Bosun is a generic enabler instance which acts as a REST notification service, so it is expected to have another REST service that implements the actions.
In your case, you need a REST service expecting a POST request.
The request will be similar to this one:
{"action": "notifyEmail",
"serverId": "00000000000001",
"email": "youremail#host.com",
"description": "Memory usage is higher than 95%"}
ServerId is the OpenStack Id of the server from which you want to check the corresponding rules. Notification URL must be the url of this REST service which is waiting the message to process and send the corresponding email. This service must be implemented by the user.

implementing stackoverflow's notification system with django

I've seen questions like Notify panel similar to stackoverflow's. It talks about the client side of the implementation.
I'm looking for the information about the server part and the networking part (how client get notified real time)
A user scenario might look like this:
something happens for user-a
server creates a message for user-a in DB (for persistance) : I'm using django-activity-stream for this
server sends (new or last 10) messages to user-a's browser (when user-a logs in or when event happens)
browser displays the message (Notify panel similar to stackoverflow's part)
if user acknowledges the message(clicking the inbox in SO), all the unseen messages are marked as read and recorded in server
I have questions on the following steps.
(3) Not sure but https://github.com/stephenmcd/django-socketio could be used.
(4) The answer to the question says client has the json data received from server.
Does server send messages to user for every request?
Does client check local storage(I'm new-to-web, what's a good local storage for this purpose?) and request the json data if he doesn't have them in the local storage?
(5) How should I implement this seen and unseen? django-activity-stream doesn't have notion of them.
This can easily be implemented by using django-channels.Because you need websockets to have a two way client server communication.
Showing notifications is a two way communication. Server notifies the client that a new notification available. The client shows this notification to the user, and then when a user interacts with the notification, the client notifies the server that notification was read, so the next time user loads a page, only unread notifications are shown.
There are some steps involved.
Your server needs to be able to support websocket communication. django-channel converts the application to ASGI.
Create a websocket consumer that can send and receive messages to a websocket.
When user opens the application, the client creates a websocket connection channel to the server.
Whenever a new notification needs to be sent, the server will send the message to the channel.
On receiving the message, the client renders the notification on the webpage using Javascript. Like showing the new message icon, appending the new message to the list of messages, etc.
Now, one part is done. Your user has been notified. Coming to the second part.
User sees the bell icon or whatever, and click on it, he sees the notification details (this was rendered by the js, when client received a message).
User clicks on the notification/bell icon. At this time, the client will send a notification back to the server, so that server can update what all notifications were read.
I created an app that updates the client when a new message is to be shown. Github link.
You can also refer to a similar question: https://stackoverflow.com/a/55656848/4186008