Firebase notification records/log API - ios

I'm sending messages to several iOS Apps via
FCM by using their HTTP protocol API,
and I need a list of message records including the payload, sent time, and platform like what I could monitor in the Firebase Notification Console.
It seems that messages sent via HTTP API wouldn't be recorded and shown in the console (only those sent manually in the console would).
I haven't found any API documents related to those messaging events/log fetching.
Is there a way to fetch this kind of message information from FCM?

As of August 2018, stats for messages sent using the FCM API are now visible from the console. From the Cloud Messaging section, click on the Reports tab. From there, you will be able to filter by message type (notification, data, and all)
It would seem that the Impressions and Opens are still only available for messages sent using the console. But Sends for sure now counts the messages sent using the FCM API.
Reference: https://firebase.googleblog.com/2018/08/in-app-messaging-crashlytics.html
Update: The FCM Diagnostics page has been disabled since last year.
If you have a Play Dev Console account and if your app is in at least Alpha Testing, you can make use of the Diagnostics and Statistics page. However, if you're looking for an API, there is currently no API available for it.
Otherwise, I think most of the details you need (like the payload and time sent) can be logged from your app server alone.
And just to support what you already mentioned in your post, as stated by #FrankvanPuffelen here:
The Firebase Notifications charts only show analytics for messages that were sent using the Firebase Notifications panel.
There is currently no public API to send Notifications to audiences. The web interface in the console is the only way to send them.
There is currently no API to feed your own FCM messages into the Firebase Notifications analytics panels.

If you want to fetch data on push notification client side you could use the BigQuery exports of Analytics data.
Here is a list of events, as you can see there are several events on notifications, including notification_open and notification_send.
Unfortunately notification_send seems to be available only for Android apps. I don't know why since the Firebase GUI console Message Delivery Report does contain iOS sends as well.

Related

Showing Read At for Twilio Programmable chat

I'm using Programmable chat. I'm trying to show ReadAt meta data to users. I know when the user is getting the message on the frontend since I'm listening to messageAdded on the current Channel in the Twilio Javascript SDK. I'm storing the message by listening to Webhook on the preMessageSend to make sure that the message is saved in DB. When I get this message, the problem is I'm not getting the messageId which I'm getting on the Javascript SDK message. Can someone help me in understanding how to correlate both the messages?
According to the Twilio developer docs:
Pre-Event Webhooks will fire before an action has been committed to the Chat instance, blocking publication until a response is received. This gives your backend (or Function) the opportunity to intercept, modify, or reject any action across the instance, making these hooks useful for spam/language filtering, complex permission schemes, or other business logic. Pre-event webhooks are fired only for actions from the Chat SDK; the REST API actions will never fire them.
So I suspect the messageId is not created until after this webhook.

Is it possible to get Apple Push Notifications with Firestore?

Is it possible to implement APNS with Firebase Firestore?
I've managed to send a push notification to devices via Firebase Cloud Messaging from the web console but my app needs to have push notifications for changes in the database, such as when the user receive a like or a friend request.
Is there any workaround?
Thanks for pointing me in the right direction.
You need to use Firebase Cloud Functions with the FireStore triggers. The first link has your use case.
There are some great tutorial videos on Firebase's YouTube account. It even includes adding a Firestore Trigger.
You can also send device-to-device push notifications, which work great for 1-1 relationships (1-1 chat, for instance). To achieve that, you can leverage this endpoint https://fcm.googleapis.com/fcm/send.

CloudKit/Firebase: is it possible to send not only push when a record changes but also mail?

In my app I do need synchronization/communication between devices, therefore I need a serverside database. Whenever some special record changes, I need to send a push notification and/or an email.
It's an iOS-only app, so Cloudkit would be fine, but I don't think that it's possible to send an e-mail. Same fore Firebase. Am I overlooking something or are there very similar alternatives which are capable of both, sending push and mail?
Since March 2017 there's an integration between Google Cloud Functions and Firebase. This allows you to run JavaScript code on Google's servers in response to events that happen in Firebase. A node being written to the database is one such event, but there are many more use-cases.
Your use-case seems closest to this sample, which sends a welcome email when a user subscribes to some fictional newsletter.

Best way to implement push notifications with Firebase

I am an iPhone app coder, and I'm using Firebase as my backend server. Firebase doesn't support Push Notifications, so I've been trying to figure out how to include them in my app. I've read this question: How to send an alert message to a special online user with firebase but it seems like more of a work-around than an actual solution.
Is there an answer on how to do this? Are there third parties or APIs that might seemlessly implement this functionality?
One solution I have tried is to use Zapier to connect Firebase to Pushover.
At this point, I've been able to observe events in the app that I'm coding and then get notifications in a pushover app on my iphone. However, ideally, I'd like to receive the notifications in my app, not in the pushover app, because I don't want users to need to have pushover in order to use my app and because I want users to receive their own distinct notifications, not notifications for everyone.
Does anyone have suggestions on how I should handle this issue?
Thanks for the help!
EDIT
This isn't a duplicate of this question: Does firebase handle push notifications? because I know Firebase doesn't directly handle push notifications. I'm looking for the best indirect way of handling push notifications with Firebase.
Now Google rebranded GCM to Firebase Cloud Messaging and it now offers this cross platform service. Firebase also offers notifications.
These are the differences between these two services:
Firebase Cloud Messaging provides a complete set of messaging
capabilities through its client SDKs and HTTP and XMPP server
protocols. For deployments with more complex messaging requirements,
FCM is the right choice.
Firebase Notifications is a lightweight, serverless messaging solution
built on Firebase Cloud Messaging. With a user-friendly graphical
console and reduced coding requirements, Firebase Notifications lets
users easily send messages to reengage and retain users, foster app
growth, and support marketing campaigns.
If you want a more detailed comparison. Read this.
If you want device to device push messages and not just server to device, the only solution I found was OneSignal. I was able to add basic device to device push message support for my app in about an hour and it is currently free.
Both Batch and Firebase only support server to device push messages, not what you want for a chat app
There are a couple of options: (well, more than a couple but here's two)
Parse handles push notifications very very well - they have that down pat and it's super simple. However, you may have issues with users and accounts - depending on what your app does.
You mentioned Pushover. We worked their API a while back but not through Zapier. If I remember correctly, I believe you can simply register your app, send an HTTPS: request to their server and then the notifications are sent from/to your app.
Also, you may want to evaluate how you are using push as it's possible you can roll a notification-like event just into the app itself.
Here's the answer I got from the Firebase team:
Firebase currently does not have push notification feature. You can use Firebase Queue and GCM to implement push notification in your app. Queues can be used in your Firebase app to organize workers or perform background work like generating thumbnails of images, filtering message contents and censoring data, or fanning data out to multiple locations in your Firebase database. Google Cloud Messaging (GCM) is a free service that enables developers to send messages between servers and client apps and it is available in both iOS and Android.
You can push an object with some data to the /queue/tasks location in your Firebase using any Firebase client or the REST API. Workers listening at that location will automatically pick up and process the job. From that, your workers can make a GCM push notification.
(end of message from Firebase team)
~~~~~~~~~
Here's my analysis:
It seems like there are a few solutions, but the two best ones are:
1) Use FirebaseQueue with Google Cloud Messaging.
2) Leverage the Push Notification functionality in Parse within the Firebase app.
I'm not sure which is better. Parse seems more proven, but Firebase Queue is more-easily integrated into the app (ie. it's nice have everything on Firebase and not having to set up a Parse app)
Anyways, I hope this thread helps out other people!
Just realized that they've come out this:
Batch
Firebase now has Notifications inbuilt.
https://firebase.google.com/docs/notifications/
I had the same problem and managed to figure out a solution a while back. I have detailed my solution in the following posts https://stackoverflow.com/a/44192515/7048719 and https://stackoverflow.com/a/42240984/7048719
You have to create a firebase data service class and use a shared instance to hold the observers in memory when the app goes into background. From there it is just a matter doing what you wish.

Send XMPP message element multiple destinations (Facebook Chat API)

I'm using Facebook Chat API in an iOS app. I already can send a message successfully to a Facebook friend. Now I'm wondering if a can send the same message to multiple recipients.
I don't know if it's technically possible or there's any limitation about that.
I know that I can create N messages for N users and send one by one. But depending on the number of Facebook friends that the user can select, it can take a long time until all the messages are delivered. If this is the only case, should I open one different thread for each message that is going to be sent with the XMPP stream?
I appreciate any resolution or clue for this question.
There's an XMPP extension XEP-0033: Extended Stanza Addressing which supports multicasting messages to multiple recipients. The extension has progressed to draft status, however few XMPP servers or clients support it. I doubt Facebook Chat does, and couldn't find any mention in the XMPPFramework source.
I don't think there's a better way than sending the same message to multiple recipients. Some servers may require you to pause between sending lots of identical messages, and I wouldn't be surprised if that were true of Facebook Chat.
Multi-User Chat is another way to accomplish this with XMPP, but unfortunately Facebook Chat doesn't support MUC.

Resources