A rich notification payload includes the values of the properties specified in the subscription request using $select.
I can $select Subject, but cant $select Body. I receive the following response (HTTP 400):
{
"error": {
"code": "ErrorUnsupportedQueryParameterSpecifiedInResourceURL",
"message": "$top, $skip, $orderby, $select=Body,UniqueBody and $expand other than SingleValueExtendedProperties,MultiValueExtendedProperties are not supported in subscription resource Url."
}
}
The documentation doesnt mention such a thing, am I missing something? Is there any other way to save a second API GET call and receive body as part of the notification payload?
Notifications are intended to inform you of a change (create, update, delete). They are not intended to deliver an object in its entirety. It is no different than a mobile push notification as it only includes enough information to make an actionable determination.
For example, after receiving a notification of a new message in the Inbox, your app would immediately make a call to https://graph.microsoft.com/users/{user}/messages/{id} to retrieve the complete message.
Related
I'm facing an issue correlating failed emails. I'm using Microsoft Graph Api. Below are the steps I have followed.
Created a draft mail with Prefer IdType="ImmutableId" in the header.
Sent the draft mail
For success scenarios, I have subscribed to Notifications ( webhook ) on the "Sent Items" folder. This is working fine. Here the ImmutableId in the notification is same as the Id in the response when I created a draft email.
For failure scenarios, I have created another Notification subscription with the resource value as below,
/users/abc.com/mailFolders/{mailFolderID}/messages?$filter=startsWith(subject,'Undeliverable'). Here i'm using a filter.
Problem = The Id which arrives in this failure notification is not the same ImmutableId. So i'm not able to correlate the sent mail to its failed notification. Somehow it looks like the ImmutableId is the not the same when subscribed using a filter/query.
ImmutableId refers to the underlying Exchange Store Object, in your send scenario the store object remains the same between drafts and sentItems (all that happens during send is the message is moved) but once a message is sent and even if that same message was received by the sending mailbox (when that message is received) Exchange will create a new Store Object for the received message with an new Id and these objects (the one in SendItems and the one in the inbox) won't be directly linked. The way to correlate them is usually you would use the internetMessageId which would be the same on all copies of the Message. For an undelivered message you would need to get that property by expanding the attached undelivered message eg
https://graph.microsoft.com/v1.0/me/messages/AA..=/attachments/AA.=/?$expand=microsoft.graph.itemattachment/item
The question pretty much says it. By "Directly" I mean without having to create anything (such as a web server) other than the app itself. As best as I can determine the answer is no. I'd be thrilled to learn otherwise.
Based from this documentation, you need to 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.
You also need to:
Register the domain of your receiving URL. For example, if you plan to use https://sampledomain.com/notifications as your receiving URL, you need to register https://sampledomain.com.
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 Drive API sends a notification message as a POST request to that URL.
I am using the Notifications APIs (Twilio Java SDK version 7.24.2). I've successfully sent the SMSes using the Notification API like:
private String sendMessageThroughNotificationService(String message, PhoneNumber receiverPhoneNumber){
Notification notification = Notification.creator(twilioNotificationSID)
.setBody(message)
.setToBinding(Promoter.listOfOne("{\"binding_type\":\"sms\", \"address\":\""+receiverPhoneNumber.toString()+"\"}"))
.create();
return notification.getSid();
}
Now, what should I do if I want to get the Notification's status through the SID of the notification that I am returning from the above method?
Does Twilio's Java Notification's API provide any way to find the Notification's status through its SID (if I don't want to use the register callback URL approach)?
Twilio developer evangelist here.
If you are only sending one notification at a time via SMS, then I recommend you just use the Messages API. That way the API will return the Message SID, which you can then use to look up the Message with the API and check its status.
There is no way to look up all the messages sent via Notify in order to check their statuses. The recommended method there is to register a StatusCallbackUrl to get updates on each status.
Let me know if that helps at all.
I'm using the AWS SNS SDK in the backend to dispatch remote notifications to my app, and I need to be able to set the notification identifier so that certain notifications replace previously delivered copies by default as described in the iOS developer docs:
If you use the same identifier when scheduling a new notification, the system removes the previously scheduled notification with that identifier and replaces it with the new one.
This is easy to do with local notifications, because they're scheduled in the app where you can set the notification identifier when scheduling the notification.
However, with remote notifications, I can't seem to find any way to set the notification identifier using the SNS SDK (in a Lambda written in .NET).
According to the API reference, SNS returns a response with a message ID (which is likely the notification identifier), but I can't see any way to set the identifier myself.
Does anyone know how to do so? Or does SNS simply not allow this?
You can customize payload, as described by AWS: https://docs.aws.amazon.com/sns/latest/dg/mobile-push-send-custommessage.html
When sending platform-specific payloads in messages using the Amazon SNS console, the data must be key-value pair strings and formatted as JSON with quotation marks escaped. The following example, including formatting and spaces for readability, shows a sample custom message for the GCM platform with key-value pair within the message body and formatted as JSON.
{ "GCM":"{
"data":{
"message":"Check out these awesome deals!",
"url":"www.amazon.com"
} }" }
You could add your id as a custom field.
EDIT: In case you need to add headers, you may want to proxy the request through a Lambda function: https://docs.aws.amazon.com/sns/latest/dg/sns-lambda.html
And this is a thread here showing how to add response headers using Lambda: Setting http response header from AWS lambda
It appears that AWS SNS simply doesn't allow the customization of notification identifiers altogether, nor does it allow the customization of HTTP headers sent to APNS.
The only viable solution for making remote push notifications replace themselves on arrival appears to be by using the Notification Service Extension to check delivered notifications whenever a new one arrives and replace any previous copies with the new version.
It appears to work consistently, and you have the option of either setting a custom payload property or the thread-id property in the notification JSON in order to then check it on-device before delivering each notification.
I am creating an iOS application in which user orders an item, when the order ready, the vendor is supposed to inform the user via push notification.
My question is, is it possible to send push notification from one device to another?
For this purpose I want to use FCM. I read that they allow two sorts of messages.
Downstream, messages from server to device.
Upstream, messages from device to server.
Will upstream messages serve the purpose according to my requirement? If so, how am I supposed to implement them?
Let's say you were using Firebase, so for every registered users there is an ssociated device token id save into some collection right. (Registering flow)
Let's say you were using cloud functions (a vague definition would be function that are running into serverless architecture, and they get executed when there are called)
so you'd call this function from your app via HTTP with Post Method
logic:
- extract that http request
- who is sending the message (uid, message)
- who needs to receive that message (someone)
- query that someone's device token id and save it to recipient_device_token_id
- construct to push notification payload (message)
- send push notification for recipients using its recipient_device_token_id
- end the http response
Voila, I am sure there is other way of doing it, but this extracting all the logic from your app to the cloud.