What I am trying to do is basically to automatize the FCM service, so I don't need to create the messages and schedule its action from the firebase messaging panel, but instead use SQL database will create that instance or schedule that notification automatically to be send at a certain hour. (Example: a delivery man ends its shift and a Store procedure register the hour so the supervisor knows the status of the route via the notification, something like the amazon delivery tracking works to notify the status of your delivery). What I want to know is if there is any way to integrate SQL to create those messages so firebase can send them. And if there is a way, how it works.
I would write a trigger in my backend service so that when certain a database table/column changed or some query is executed, it will trigger an HTTP request to send a FCM message.
https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages/send
Related
In Twilio, after we register a webhook URL in an active number, we'll be able to get event notifications whenever events occour in the registered number depending on the type of webhook we registered (Voice/SMS).
The registration of the webhook can be achieved via REST API. Similarly is there any API to stop the webhook notification? Else how should we handle this?
The same API, incomingPhoneResource, would be used do the same. You should be able to create, read, update and delete the configured webhooks for voice and SMS phone number configurations this way.
What I want is to send an automated push notification to users once a day, and have found a way to do this with automated notifications with OneSignal. The problem is that it asks for a title/message to input on their console, but what I wanted was to have a backend (haven't chosen yet, probably Firebase) with some strings, and each day a string will be randomly chosen and that will be automatically pushed to all of my users. Is there a way to do this with OneSignal, and if not with some other push notification service?
Can I accomplish this with the OneSignal API, or should I write some custom script and host it somewhere (like cron) that sends these using API calls?
thanks
I have created an app which uses firebase real-time database and storage. My app allows users to message each other, but I am not sure how to notify the user when they have received a new message. I store all of the messages in one node called messages. I then store the message relationships in a different node called "user-messages". How do I monitor the "user-messages" node to alert the user with a notification that they have a new message? I am familiar with observing event types and such, i.e.: .Value and .ChildAdded, but I am not sure how to trigger an event to send the user a notification.
edit: gave a little more clairity.
So I accidently did not see that Firebase can use Google Cloud Messaging which seems to be able to do what I want. For future reference firebase has put the IOS setup here :Firebase Cloud Messaging SetUp
Like you mentioned, you can use child_added event to monitor whenever a new message is added to user-messages and firebase will call your event handler whenever a new child is added.
ref.child('user-messages').on('child_added', (snapshot) => {
// Read the message and send notification here
})
You may want to update the user-message as well after it has been handled so that you don't end up sending duplicate notifications when your app restarts.
What I did was set up an XMPP server with Ejabbered in order to conduct notifications. Hope the following helps.
https://firebase.google.com/docs/cloud-messaging/xmpp-server-ref
https://firebase.google.com/docs/cloud-messaging/server#implementing-the-xmpp-connection-server-protocol
I need to update my users for things that happened around their current location while the app is in the background.
To my understanding:
If my server sends a Push Notification to a client, the client would immediately show that message.
I can set up the app so that there is a specific location, with a given radius could fire a message.
So what I want to understand if it is even possible to update my users about things that are new in their locations.
I was thinking of two possible solutions, I am not sure they are possible.
One, I guess if the Push Notifications would allow a function to run prior to its display,
deciding if the message should appear.
For example: something happened in area x,y - The server initiates a message to all devices. Only the devices within range of x,y and a radius z, would show the message to the users.
Maybe the Regional Monitoring service can send a message to my server and my server can then decide if to send a Push Notification back to the client...
For example
The user has entered a defined location, determined by the app. The app sends a message to the server. The server decides if a message is due.
Any ideas? is that even possible?
Filtering push notifications by topic is something you need to do on the server side, not the client side. Apple specifically states not to send messages to users that aren't relevant and you won't be able to block them when the app isn't running. Additionally, if you are using a service to manage your push notifications you don't want to pay for messages that aren't relevant.
So when you register a device into your database, you should register what topics that person is subscribing to (ie. save a list of topics that user is eligible to receive). Then when the event is triggered that generates the push notification only send to devices that are registered to that topic. I believe a number of push platforms have this capability already built in. On UrbanAirship and Azure Notification Hubs you can use their tags feature. Or you can develop it yourself if you do your own push server.
Take a look at Parse. They have this kind of functionality baked right in, just send the push to clients that match a geoPoint query.
I'm trying to figure out how to create a push notification server for a twitter app. I'd like to be able to set up push notification for mentions, stars, follows, etc etc. This is all possible with the API, as Tweetbot does it. If someone could point me in the direction of creating the actual server part of handing the storing of the usernames and pushing the messages out, that would be great. If there is a tutorial on how to do this that would be grand! I'd like to be able to do this through ruby but any method is completely fine.
Thanks
The way I built my push server was like this:
1) Symfony 2 web framework to build an admin portal to manage my entities (Symfony2 is similar to Ruby)
2) A Node.js server that allows me to maintain a persistent connection to Apple's push notification server. (This Node.js beast is epic I tell ya)
3) Node.js will make a HTTP Post request to my Symfony server asking it for new notifications
4) My Symfony server will receive the response from my Node.js server, finds all the new notifications that needs to be sent and returns JSON formatted list of notifications that needs to be sent, the notification contains the message to be sent and an array of unique push tokens (also selectively of the token environment - development vs production) that is to receive the push notification
5) Finally, my Node.js server receives the JSON data, parses the JSON and sends the notification binary stream to Apple's PNS server through TLS socket stream, asynchronously for high performance throughput :D
This method has allowed me to separate PHP Symfony server to manage my data without interfering with my Node.js push server that is abstracted from any data-related logic. The Node.js push server just needs to know the message that needs to be sent and the array of tokens to send it to. At the same time, I can extend and enhance my notification entities such as token groups (allows me to quickly fetch a bunch of token just by choosing a group e.g. members, friends and if you like, enemies :D), notification date (so the notification can be sent at a future date rather than immediately) and more.
Hope that helps.