Personal Messaging
Hello everyone, I am publishing an extension here after a lot of time i.e Personal Messaging. This extension allows you to manage your personal user messaging with Onesignal and FCM. When you have to implement personal user notifications then you have to go through a long process of storing and retriving the user ids and user tokens. This extension helps you to make it very easy. How? This extension uses your firebase database to store your FCM and onesignal tokens with a corresponding user name or any other id and make the notification sending with that corresponding id very easily and the extension do it own. You just have to intialize it with your firebase URL and then you can register any user with onesingal player id or FCM token then later on you can send push notification personally to specific multiple or singal users with then user id that you have used to store the tokens with the extension. This really make your job and can manage notifications very easily. I mean, just imaging sending notification to user by just his unique name or external user id.
Let see its blocks and documentation.
All Blocks
Documentation
This event raises when any error occurred.
This event raises when your user has been registered in firebase.
This event raises when you fetch the onesignal player id of an user from database.
This event raises when you fetch the FCM token of an user from database.
This event raises when you send a notification and it response comes.
Initialize the Messaging with firebase URL. Your all user’s tokens will be stored in this given database URL. The same will be used for fetching the user tokens.
This block registers or stores an user’s token in the database. You can give both types of token to it but if you are not using both FCM and Onesignal then your can leave the other param empty. Where userId is unique id of your user that will be used to send notification. For ex, if you have a user with username then you can use its username to store tokens and later you can use the same username to send notifications to them.
Fetch the FCM token from user id that you have stored.
Fetch the Onesignal palyer id that you have stored.
Send the notification to the users with Onesignal API. You can use this block to send notifications to a list of users. Just give the user ids that you have used above to store the token then it will fetch them from the firebase and send them notification. You do not require REST API key for sending notification to specific player id but App ID is needed.
Send the notification to the user with FCM server. You will require server key for sending notifications.
How to Use
Let see a quick usage of the extension so you can understand how easily it is to set up this extension.
Your first step is to initialize the messaging with your firebase. And then you can register the user with player id or FCM token. You should use RegisterUser block only once in app or user when you have to update the tokens as it is useless to store the same thing again and again.
Note : FirebaseDB component must be dragged on a screen, since this extension works with Firebase and to reduce the extension size I have not compiled the firebase lib in the extension.
After the registeration success, you can test it by sending the notification to user ids. Extension will fetch the player id own from the firebase and send the notification own. That make the extension very usable cause it make our work very easy and short.
Firebase Structure
Your all users will be listed down like this and you can fetch these tokens own or with extension.
Screenshots
Download
com.sumit.personalmessaging.aix (24.5 KB)
This extension does not work for FCM anymore.
Credit
Thanks @Shreyash for the super power full Rush .
Like the extension if you like it
Suggestion and issue are welcome
Thanks you
Sumit