According to this document
I can send push notification to 'installations' using channels or query.
But how can I send notification to concrete installations/devices by their installationId?
For example I have 20 device and have their installationId and I want to send push to those 20 devices.
Thanks.
In your circumstance you dont want to restrict fields by including a parameter. In other words, since you want to send a push notification to all users then you don't include any parameters. So in short, simply create an unbiased push payload with a title and description and then execute it for whatever deviceType you specify or need
Related
I studied the Laraval.s notifications. I can not realize how to send bulk notifications to the specific users. I know their ids.
Should I use private channel or broadcast?
in laravel there are two way to send notificatons
$user=User::find(1) ;
$users=User::all() ;
$user->notify(new InvoicePaid($invoice))
// or
Notification::send($users,new InvoicePaid($invoice))
so both ways send only one notification but we can send it to single or multiple users.
if you need to send multiple notifications to multiple users you should use loops:
$notifications=[new InvoicePaid($invoice) ]
foreach($notifications as $notification)
{
Notification::send($users,$notification)
}
also there is a better way to handle this.you can use event and it is better to use event to send notification or perform other task after a specific action. for example define a event as userRegisterd. then you can assign one or more listener to this event like sendNewUserNotification , congratulationsNotification.
in each listener notify the users
I am creating a Node/Express Webapp that would mirror a user's calendar. It would get a notification for every change in the users calendar, and would update the DB with the latest of that user's calendar.
Lets assume that we want to monitor john.doe#gmail.com. Kindly tell me if this is the best (and only) way to do it:
Set up for Push notification - While doing so, we provide (amongst other fields):
token - A plain-text that would be echoed back. This is where I can put something like 'calOwner=john.doe#gmail.com'
id - A UUID channel id
Upon every change, my webhook will get a push notification that would contain:
token : calOwner=john.doe#gmail.com
id : the channelId - I dont understand if this field alone can be used to trace this notification message back to john.doe#gmail.com
Now that I know john.doe#gmail.com has changed, I would do a list with a synchToken. This will return me the change in john's calendar since last synch
What baffles me here is that the seemingly important fields channelId and resourceId (which appears as x-goog-resource-id in the push notification header) are useless, and the only field that ties the push message to list is an optional plain-text field token .
Kindly tell me if this is the only way to track a user's calendar.
UPDATE
Thanks #KENdi for the answer.
My struggle was with the point that simply looking at a push notification message, there is no way to trace it back to john.doe#gmail.com . I now understand why such is the case, that a push notification does not contain the calendarId, but the resourceId instead (which, in plain terms is the event object). It is so because an event can be associated with multiple calendars, and hence multiple calendarIds. Hence, it is the subscriber's responsibility to maintain association of the channel to the calendarId that he had used to create the channel at the first place.
Yes, you are correct, you need the calendar push notification, to notify you about all the changes happened in the Google Calendar.
The purpose of X-Goog-Resource-ID is an opaque value that identifies the watched resource. And this ID is stable across API versions.
Check this SO question to know more about the purpose of X-Goog-Resource-Id.
We're moving from Mandrill to SparkPost. We figured that SparkPost's transmission is the closest thing to Mandrill's send-template message call.
Mandrill responded to those calls with a list of ids and statuses for each email. On the other hand SparkPost returns a single id and summary statistics (number of emails that were sent and number of emails that failed). Is there some way to get those ids and statuses out of the transmission response or at all?
you can get the message IDs for messages sent using the tranmissions API two ways:
Query the message events API, which allows you to filter by recipients, template IDs, campaign IDs, and other values
Use webhooks - messages are sent to your endpoint in batches, and each object in the batch contains the message ID
Which method you choose really depends on your use case. It's essentially poll (message events) vs. push (webhooks). There is no way to get the IDs when you send the transmission because they are sent asynchronously.
Querying message events API, while a viable option, would needlessly complicate our simple solution. On the other hand we very much want to use Webhooks, but not knowing which message they relate to would be troublesome...
The missing link was putting our own id in rcpt_meta. Most of the webhooks we care about do contain rcpt_meta, so we can substitute message_id with that.
I'm stacked too in this problem..
using rcpt_meta solution would be perfect if substitution would work on rcpt_meta but it's not the case.
So, in case of sending a campaign, I cannot specify all recipients inline but have to make a single API call for every message, wich is bad for - say - 10/100k recipients!
But now, all transmission_id are unique for every SINGLE recipient, so I have the missing key and rcpt_meta is not needed anymore.
so the key to be used when receiving a webhook is composed:
transmission_id **AND** rcpt_to
I have a schema that looks something like:
Installation <user, etc>
User <id, contact info, etc>
activities <fromUser, toUser, type[follow, like, share]>
...
I want to occasionally fire off a push notification to someone's followers. I can get the follows for someone like so:
var followsQuery = new Parse.Query("activity");
followsQuery.equalTo("toUser", user.id);
followsQuery.equalTo("type", "follow");
.. and iterate through the follows and call Parse.Push.send for each of them, but I don't think this is the best way to go about doing this, and I'm worried about this timing out for people with large number of followers.
How do I form the pushQuery so as to form a join with the user and activities tables?
You can create a channel for each user called "follow_[objectId]" where [objectId] is that user's objectId. Whenever a user follows someone, add that someone's follow channel to the user's push channels. Then, whenever you want to send a push notification to someone's followers, just push to their follow channel. Their followers should be subscribed to that channel and get the push.
This can be problematic if a user follows many people. When they login, the app would have to query for all the people they follow, and subscribe to all those channels, which could take a while.
I've been playing with Parse for a while and It's pretty neat! Sadly I just encountered an issue that I can't seem to get resolved.
As soon as an object ("Alert") is saved to my database I would like to send a push notification. The object saved contains a field called neighbourhoodName which is a string. I would like to send everyone a push notification subscribed to this neighberhoudName. (This ain't the problem, hold on! :-P).
My Alert object also holds a GeoPoint and I would like to send every user in a specific radius a push notification. As you might figure a user could be subscribed to a neighbourhood (for example 'Hellas') and also be currently in the neighbourhood of 'Hellas'. This means he/she will receive two notifications.. this is not what I want.
So I thought; lets use Parse.Query.or. Send a push notification if the user is subscribed to the correct channel OR is in the current radius of the Alert. Sadly, Parse.Query.or can't be used with GeoPoints.
How can I tackle this problem?
Thanks a lot!
I found there to be some issues when using [query whereKey:nearGeoPoint:withinMiles:]. Using [query withinGeobox:] is much more flexible.