Real-time Push notifications with Firebase - notifications

I recently signed up to use Firebase and I can't seem to figure out how to push notifications to specific users.
For my use, I guess you can think of it like Facebook. Whenever a user does something, say posts an interesting article for their friends to read, I want all of the user's friends to be notified of that event. So, using Firebase, how would one make it possible to notify only their friends and not everyone? My database stores the conenctions.
Perhaps there is a way to have each user be a node in the Firebase database and each time a notification is sent, The user will constantly check his node, and if something appears, pulls it and then delete it.
The examples on Firebase seems to be sort of basic. I wish there was a user-specific push notification example.

Now Firebase supports Push Notification. 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.

There's a good explanation of how you can send notifications to specific users here:
How to send an alert message to a special online user with firebase
Basically you need to have each user observe a unique path, and then write data updates to the appropriate path.

Related

Is there possibility to forward content from WhatsApp to our application using business api?

Is it possible to use the WhatsApp business API to communicate with users and also allow them to forward content from WhatsApp directly to our application. For example enabling Web-hooks for different WhatsApp channels to receive the messages from those channels. If yes, can someone guide me how can we implement this feature? and how can we authorize those channels with our WA business account
Finding sources/documentation for developing needed feature
Whatsapp API allows you to Broadcast messages to Unlimited Users, automate notifications, integrate Chatbots, provide Live Chat on Multiple devices and many more functions. Install the WhatsApp Business API Client and then Install your API client. Once your client is working, you can update your application settings. Start using the client, Register your phone number with an API call to /account and send a test message with a call to /messages . let me know if u find this helpful.
Yes, it is possible. The WhatsApp Business Platform allows medium and large businesses to communicate with their customers at scale. Using their APIs, businesses can connect thousands of agents and bots to interact with customers programmatically and manually. Additionally, the APIs can be integrated with numerous backend systems, such as CRM and marketing platforms
Here is the link for the documentation: https://developers.facebook.com/docs/whatsapp/overview
Link for different types of webhooks:
https://developers.facebook.com/docs/whatsapp/webhooks
There are multiple ways given in the documentation. But keep in mind, do read the documentation carefully, they have their updated and the previous version so use them as per your requirements.

How to integrate Google business messaging through API

Problems:
I am unable to enable Business Messages API, Because "Business Messages API" is not showing API list, While i am going to enable the API through the
https://console.cloud.google.com/apis/dashboard
I want to use auth token, while hitting the API, but the document is saying use the service.json for the credentials. i am following these doc. I am using "Google\Client()" with Laravel application.
https://developers.google.com/business-communications/business-messages/guides/how-to/agents?method=api
I am following these steps:
Login with google business account in the Dashboard
App taking multiple permissions as I have attached the permissions list and taking the auth token.
Open the chat box for the Business.
So please guide me, where i am going wrong. What is correct way to implement this.
Requirement:
I want to create a custom chat box for google businesses, Where business owner will login into the web app and He can easily manage the multiple business chats in one dashboard.
As per your given information, you have to be a partner of Google. As per google documentation, you need to be a partner of google and then you can create the agent and can send and receive messages. You can integrate the business messages API by following this documentation:
https://developers.google.com/business-communications/business-messages/guides
In this process, you need to be a partner of Google. The complete process is given on the link. If you follow this link, then you can use their built-in libraries easily and can send messages easily.
So far the permission for API, it might not be found for you because you might have to take permission for the particular project that is registered on google and then you will see the business messages API and you can enable it and use it. The reason as per the basic step:
https://developers.google.com/my-business/content/basic-setup
Sometimes, you have to submit the request form to take the API access for particular APIs. Or Share how are you using that API.
If you do not find a form for business messages API then you can ask for the information from bm-support#google.com. they mostly respond on a working day.

Implementing Whatsapp Business APIs using gupshup.io platform

gupshup.io provides a way to utilise whatsapp business by exposing a single api interface. I am exploring it. But the documentation is poor.
I wonder how the entire conversation can be tied together. Is there any session that is initiated when the message exchange begins? The official site suggests to use Stack Overflow as forum and hence the question.
For every new client (business phone number) a new WhatsApp Business API client (docker containers) is started. This is uniquely tied to the databases. Just like everything stored in your phone WhatsApp app is stored in the databases, the docker containers are tied closely to the database to create a unique session for you and store the messages.
The documentation at WhatsApp Official Documentation can give you more information.
Login to gupshup.io WhatsApp dashboard
Click ‘+’ Icon to create a App and select the type of app: Access API
You will see a Sandbox:
Set up a callback URL where you can receive incoming messages from your users and for outgoing messages to user, use the sandbox API.

How to send test push notification with custom data from firebase console?

How do we send a test push notification to my android emulator with custom data? I have FCM Token and it should directly come up on my emulator only... I don't want to send a notification to all the app users.
Is there any way to do this from firebase cloud messageing so, I can test with my data.
Yes, Sure you can test it through printing the device token
FCM.getFCMToken().then(token => {
console.log(token)
});
Then take the token and go to the cloud messaging section and you just set the FCM token in test message like the picture below:
Update
the new Firebase interface does not provides a direct way to test cloud messaging with data at the moment. However you have two options: either you create a certain subject and subscribe to it like the following code
FCM.subscribeToTopic("/topics/testTopic");
and then in the target section you can target topic testTopic (This may require time to confirm a new subject)
Or you can do this programming using Firebase admin, you can follow this tutorial:
https://medium.com/android-school/test-fcm-notification-with-postman-f91ba08aacc3
Hopefully this answer your question

Is Firebase Cloud Messaging suitable for messaging apps?

We're writing an app like LINE, and need notification service for each single message in a chat group when app is in background.
We try to use Firebase Cloud Messaging for this feature, but I can't see a reasonable implementation.
Topic subscribing is too slow for "create a topic for each chat group" since it takes hours to create one. Device group messaging is designed for devices owned by a single user. Using sending to a single device feature for each receiver and each message does not seem to be practical since the server loading is too heavy.
Is there a good way to use FCM making such app, or do I need to find another service? Thanks.