I have created 2 subscriptions (teams/allMessages and chats/allMessages) and both have correct notification endpoint (received validation and acknowledged it). I am not receiving any notification if a message was sent on teams. Is there a page to know if the request is enqueued but not delivered or if there is an outage which is causing a delay for receiving the change notification. How do we usually debug such an issue?
Subscription registration:
{
"changeType": "created,updated",
"notificationUrl": "https://...amazonaws.com/api/notification/teams",
"resource": "chats/allMessages",
"clientState": "12c189af-16ed-41f9-9742-7c9f0fa2e22e",
"expirationDateTime": "2020-07-16T22:01:33.639215Z",
"includeResourceData": true,
"lifecycleNotificationUrl": "...",
"encryptionCertificateId": "84474ac9-eb09-41c3-b83e-396ffdc96a22",
"encryptionCertificate": "..."
}
The service had a temporary issue and notifications got delayed for a couple of hours. Whenever this sort of issue happens you should open a support ticket to get the issue investigated.
Related
I am using Microsoft webhook change notifications to listen to new emails in user's mailbox. The notifications are subscribed as follows:
{
"changeType": "created",
"notificationUrl": "{our-internal-api-endpoint}",
"resource": "/me/messages",
"expirationDateTime": "{expiry-time}",
"clientState": "SecretClientState"
}
As per documentation, the maximum expirationDateTime that can be used for message resource is currentDateTime + 4230 minutes. I have noticed that if I create a subscription using a small expiry time e.g., 60 minutes, I immediately receive a reauthorizationRequired lifecycle notification. Now as per reauthorizationRequired notification's documentation, there are multiple reasons that can can cause this notification and one of them is: "The subscription expires before you renew it".
I suspect that because the subscription is about to expire in short time, Microsoft sends me this notification to signal that I should renew it soon which is why I don't get this notification when I create the subscription with a longer expiry time (i.e. 4230 minutes) and only for lower expiry times like 60 minutes.
Can someone please confirm this behavior because the exact time interval at which Microsoft sends this notification before the subscription expires is not discussed in the documentation.
I hope my response isn't coming too late. I can back up what you've noticed: You can safely assume that this is in fact the reason for the reauthorizationRequired Event being triggered. I assume, this is (for now) the only reason you may have to renew your subscription as opposed to simply reauthorizing it. Further more, I suspect this, to being subject to change, perhaps even being supported with a new type of lifecycleEvent in the future.
My Inbox folder has the following structure:
Inbox
>>Subfolder1
>>Subfolder2
..
>>SubfolderN
I expected that when I subscribe notifications will be received for all messages, including messages in the subfolders of the Inbox:
{
"changeType": "created",
"notificationUrl": "https://webhookurl",
"resource": "/users/{id}/mailFolders('Inbox')/messages",
"expirationDateTime": "2020-04-03T11:00:00.0000000Z",
"clientState": "SecretClientState"
}
But notifications come only for the parent Inbox folder.
How can I specify in a subscription to receive notifications for subfolders too?
In order to receive notification for all messages, you should use the resource path: /users/{id}/messages. This should provide notification for all messages in a user's mailbox.
I'm using FCM (Firebase cloud messaging) to receive push notifications.
Everything is working for me.
But from my server side they will send notifications continuously to my app with time as body up to some time.
Now I have to push notification only once where the time I am getting from server reaches current time.
Before current time and after current time notifications should not be shown.
I don't have any idea how to do this.
Can any one explain if is there any way to get this.
You can customize you notification arrival schedule by implementing cron jobs on your server.
And if you are using any API to push notification to any device just get the success message or delivered message after calling.
I have created an endpoint on a PHP server that takes an autoId referring to a notifications/$autoId in my realtime database. The sender of the notification writes the notification data to the database and if successful sends a POST request to http://myserver.com/notifications/$autoId/send.
This seems authentication-less however no one will know the notification id being sent apart from the user who created it and the user who receives it. On the server side, when the message successfully sends using FCM, we can set {"sent": true} to prevent it from being sent more than once. When the notification is received by the user, we set {"received": true}.
{
"notifications": {
"$autoId": {
"sent": false,
"received": "false",
"userInfo": {
"notificationId": "$autoId",
"toId": "$toUid",
"fromId": "$fromUid"
}
}
}
}
I have a question.For iOS,Can we send both "data" and "notification" in the payload?I was getting the notification when only "notification" was sent to the GCM.When I added both,I am not getting any notification.My question is,What should be the payload if I want to get update on both iOS and android devices?
current payload :
{
"to":"/topics/testTopic",
"content_available":true,
"priority":"high",
"notification": {
"body":"Test Message",
"title":"test"
},
"data": {
"title": "Title.D Mixed JSON",
"body": "Content.D Mixed JSON",
"productId" : "1"
}
}
Your payload is fine, there is no reason that you should not be getting it. But there are some differences between those two.
Difference between "notification" and "data" is documented in official documentation: https://developers.google.com/cloud-messaging/concept-options
Use notifications when you want GCM to handle displaying a notification on your client app’s behalf. Use data messages when you want your app to handle the display or process the messages on your Android client app, or if you want to send messages to iOS devices when there is a direct GCM connection
So, for you hybrid messages that you want to send it is important to know if your app is in the background or in the foreground:
When in the background, apps receive the notification payload in the notification tray, and only handle the data payload when the user taps on the notification.
When in the foreground, your app receives a bundle with both payloads available.
Another reason for not receiving push notifications is that you have not assigned delivery priority. There are two options normal and high.
High
High priority. GCM attempts to deliver high priority messages immediately, allowing the GCM service to wake a sleeping device when possible and open a network connection to your app server
Normal
Normal priority. This is the default priority for message delivery. Normal priority messages won't open network connections on a sleeping device, and their delivery may be delayed to conserve battery
Try to set "priority" : "high" right before "notification" in your payload.
It's not Allowed to duplicate the content of "notification" and "data", you can read the data inside the "notification" when the user tap on the notification, the following JSON should work with you.
{
"to":"/topics/testTopic",
"content_available":true,
"priority":"high",
"notification": {
"body":"Test Message",
"title":"test"
},
"data": {
"productId" : "1"
}
}
I am using GCM in iOS for receiving notifications, the client app connects to GCM, receives registration token and successfully subscribe to topic but still fails to receive any notification.
The payload I am sending is
{"to": "/topics/test", "notification": {"body" : "Test"}}
to
http://android.googleapis.com/gcm/send
the response I receive from the server is
{ "message_id": 5517207416953280202 }
but still no notifications, can someone please point me to the right direction?