Does google workspace marketplace give any kind of notification of installation? - google-workspace-add-ons

When someone installs my application to their google workspace, does google send any kind of notification to my infrastructure - say via webhook?
Or am I responsible for the onboarding/first-run experience on my own, either via polling or upon the first time a user visits my application?

To my knowledge, Google doesn't notify you directly anywhere. To do this you have to use the licenseNotification.list API. With this you can get a list of installs/uninstalls of your app along with the user emails. A sample response would look like this:
{
"kind": "appsmarket#licenseNotification",
"id": <some-notification-id>,
"applicationId": <your-app-id>,
"customerId": "email#example.com",
"timestamp": <unix-timestamp>,
"provisions": [
{
"kind": "appsmarket#provisionNotification",
"editionId": "default_edition",
"seatCount": "1"
}
]
}
As you can see, it contains the email of the user and whether or not it was provisioned. It also returns a nextPageToken with the last notification id, so you can store it and send it in your next request as startToken and get results after the last notification you got. With this in mind, you could build some kind of Pub/Sub service to poll the API periodically and notify your app when you get new provisioned users.
Reference:
licenseNotification.list

Related

Microsoft graph api is sending multiple duplicate "created" notifications on a message resource

The exact POST I made to create exactly 1 subscription on 1 resource:
POST https://graph.microsoft.com/v1.0/subscriptions
Content-Type: application/json
{
"changeType": "created",
"notificationUrl": "https://myurl.com/endpoint",
"resource": "/me/mailfolders('inbox')/messages",
"expirationDateTime": "{{addMinutes(now; 4225)}}",
"clientState": "{{uuid}}"
}
Microsoft Graph notifications for changes in resource data Doc
What's weird is that sometimes it sends the same data to my URL 2 times, sometimes just 1, sometimes 3. I know they're duplicated because they're completely the same (I used a difftool).
I've read this, that, and this but I just couldn't understand why its possible to send out more than 1 webhook for a "created" notification. I'm responding with a 202 as soon as I get the POST and these duplicated POSTS are not even 1 second apart so not sure if I could store the "#odata.etag" and check if its already in a database as I use integromat to receive these change notifications.
So what gives? How can I make it so that I only receive 1 notification? Does it have something to do with how the mailbox is setup? Is storing the #odata.etag really the proper way to handle this? Really absurd if that's the case.
This might be due to the known issues in Change notifications:
For information:https://learn.microsoft.com/en-us/graph/known-issues#change-notifications

Send notification to everybody but user who triggered it?

I'm using Firebase Messaging to send out notifications to users of my iPhone app. My database is structured like this:
- Users
- user1
- user2
- Groups
- group1
- members
- user1
- user2
When a user joins a group they get subscribed to a topic corresponding to that group. I have a cloud function that listens for writes in that group, and sends a notification to the groups topic when a write happens:
exports.sendNotifs = functions.database
.ref('pets/{petId}/events/{eventId}').onWrite(event => {
const pet_Id = event.params.petId;
const payload = {
'notification': {
'title': `${toTitleCase(name)} just logged an event`,
'body': `${events[eventType]} for ${toTitleCase(petName)}`,
'sound': 'default',
}
};
admin.messaging().sendToTopic(pet_Id, payload);
});
However, this results in everybody getting a notification including the person who did the write that triggered the notification. I only want other people in the group to display a notification since the triggering user doesn't need to see one. I tried appending the sending user's uid as extra data of the notification and only displaying the notification if the recieving user's uid doesn't match the notification data's uid. This works when the application is in the foreground but not if its in the background, so if the user writes then closes the application before he receives the notification it'll display for him when he receives it, something I'm trying to avoid.
How can I make sure only other members of a group get a notification? Are messaging topics not good for this?
If you use Topics it's not possible to send to everyone except one.
If you are Ok sending to everyone, and then filtering on the client, you will need to use the data messages, and not notification messages, to avoid the problem with background/foreground you described.
https://firebase.google.com/docs/cloud-messaging/concept-options
i guess that the solution is:
each iOS client from group1 will subscribe to topic /topics/group1.selfUserId
the server already have the list with all users that are part of group1
the iOS client ask server to send notification to group1.members beside selfUserId (make a http post request)
server send gets all group1.members beside selfUserId and send notification to all /topics/group1.memberX
As already mentioned, you cannot exclude someone who has been registered to a Topic.
So what you can do is sending a message to a single device. So for example you have a group of ten persons, one person posts a message, you have to send nine single messages to the other nine persons of the group.
What you need to do is to store the registration token of every single user into your database and you have to take into account that registration tokens will change after some time.

Send push-notification every time website is updated

I want to make an application that sends out a push-notification every time a website is updated with new content. This website is updated 1-3 times every day. And it's contains a chronological feed, where each post had a datetime, video/image, title.
And I want the notification to contain this information, and link to the website(maybe via the app).
Now what method should I use to get this app going? How should I start, and proceed?
From your question's description, What I understood is this that you need to update your application whenever your website has new content.
This can be easily achieve using Remote/Push notification.
You can use Boolean type or String type which can be understand by app and web.
For example:
{
"aps": {
"alert": "Hello World",
"sound": "default"
"Content": {
"isNewContent": "1",
}
}
}
This is typical Custom notification object, you can send more details in that.
Here you see that in Content there is a parameter isNewCotent which has a value 1, this indicates that you have new content on web.
So now you can get call webservice to get new content from web server.
And If you dont know that how to implement Push Notification in iOS, you can check below tutorial, explained in detail.
Setting Up Push Notifications on iOS

Migrating Parse Push to AWS

I am having an issue with Parse Push on AWS. We have the adapter configured per these specifications and can seem to broadcast to one specific user (don't know how or why that user) using the curl method, but I am confused how (or if) I can use this to send user to user push notifications. For example, "X liked Y's Z" Where X is the liker, Y is the liked and Z is the object being liked.
in parse you have multiple options to send push notifications.
Push notifications can be sent to one or more users by providing a query with all the installations that you like to send the push to. You can also send push notifications for specific channel that the user subscribed to, this is very good for marketing or maybe if your app have different type of users (for example: sellers, buyers etc.)
The reason that a push is being sent to installations and not to users is because that one users can have multiple installations (e.g. iphone,ipad,other device etc.)
like i said there are multiple options to send push but i recommend to send a push using one of the following approaches:
From cloud code - you can create cloud code function that will be triggered by the client and this cloud code function will first create a query of all the installations that you need to send the push to and will execute the function that will actually send the push. This cloud code function can receive multiple parameters that can contain any data that needs to be processed before you sending the push, such data can be array of users, channel name and more.
the following cloud code snippets show how to send a push for all users who successfully subscribed and have device token:
Parse.Cloud.afterSave("SendPush", function(request) {
var query = new Parse.Query(Parse.Installation);
query.exists("deviceToken");
var payload = {
alert: "after save push"
};
Parse.Push.send({
data: payload,
where: query
}, {
useMasterKey: true
})
.then(function() {
response.success("Push Sent!");
}, function(error) {
response.error("Error while trying to send push " + error.message);
});
});
and then from your iOS SDK you call this cloud code function in the following way:
NSDictionary * parameters = # {}; // put parameters if required
[PFCloud callFunctionInBackground: #"SendPush"
withParameters: parameters block: ^ (id _Nullable object, NSError * _Nullable error) {
// callback result
}
];
From iOS SDK - if you don't want to send your push from cloud code you can do it directly from your iOS. I think it's better to do it in cloud code because in cloud code you write ones and then you can trigger this function from any SDK and also from the REST API.
In Parse docs you can find a lot of examples on how to send push from iOS SDK all the examples can be found here:
http://parseplatform.github.io/docs/ios/guide/#push-notifications
but like i said the best is to do it with cloud code.
Answer is similar if you're using AWS services without Parse. A better architecture is where the mobile device invokes business logic in the cloud (i.e., in an AWS Lambda function) and that code sends the push notifications. This allows you to build a more secure solution because you can control content and control who can send to whom (i.e., you must be on someone's friend list to send) within your business logic. If you open permissions to publish directly from the device, then you make system vulnerable to attacks where someone uses the app's credentials and publishes harmful content (potentially to all your app's users).
Example of sending push notification from an AWS Lambda function...
Can you send SNS push notification from lambda function in Amazon AWS?

Mandrill api log says message is sent, but I don't receive it, and it doesn't show in activity

Using a production key on Mandrill I am attempting to send an email. Previously this has worked without issue. However now, despite receiving a successful response from the API, visible in the api log, no email is being sent, and nothing is present in the outbound activity log.
If I check the api log for the message which appeared to fail it displays:
[
{
"email": [email_address],
"status": "sent",
"_id": [id],
"reject_reason": null
}
]
Replacing the id in the content view of a sent email, with the id from a failed one displays a correctly formatted email:
e.g. https://mandrillapp.com/activity/content?id=20151214_[put_the_id_here]
Is this a bug? What is causing it? Where can I see more information about what happened? How can I monitor if this happens again in the future? How can I prevent it from happening in the future?
I have been in contact with Mandrill support regarding the issue, which they described as 'very strange indeed'. Deleting the API key and generating a new one fixed the issue, but there is no explanation as to why this is they case, how to detect the problem, or how to stop it from happening again in the future.
The messages in question were never actually sent by Mandrill, and displayed no SMTP events, despite reporting as sent by their API
Something else to check is to make sure you're using a working API key instead of a test one. As the name suggests, test keys are designed to work just like a regular key, so the feedback to your program will be identical, but the messages won't actually be sent.
You can see if this is the problem by going to the Mandrill settings and looking at the list of API keys. Test keys have a very clear This is a test key message listed.
This probably won't be an issue if you generated the key yourself, but if you inherited this project it's worth taking a look.
I have faced a similar issue like this last week. The "sent" status only indicates that Mandrill sent it. But reception of the email message is confirmed only if there is a SMTP event corresponding to it with code starting with 2, (example 250 etc), in the info api response, like the following:
"smtp_events": [
{
"ts": 1442448422,
"type": "sent",
"diag": "250 SmtpThread-4622542-14682902148#ps-they-19.uk.miplecast.lan Received OK",
"source_ip": "505.207.171.171",
"destination_ip": "705.139.255.221",
"size": 29501
}
check this link for more info.
https://mandrill.zendesk.com/hc/en-us/articles/205582697-How-to-Confirm-If-an-Email-Was-Actually-Delivered
the issue could be on the recipient server as well, due which delivery could be delayed. In our experience last week, the message was delivered 4 hours after being Sent. we were not able to establish the reason yet why, this delay happened.
HTH,

Resources