[Firebase] Examples of Token,AppURL and TargetIdentifier()

[Firebase] Examples of Token,AppURL and TargetIdentifier()

  
Forge Component
(9)
Published on 24 Aug by OutSystems Labs
9 votes
Published on 24 Aug by OutSystems Labs

Hello,



I can't get this component to work..
Espacially the 3 required variables are so confusing.

Where do you get the token, AppUrl and targetIdentifier from?

The AppURL is the name of your project right?
The token is the api Key?
And the targetIdentifier() is the sender id?

I'm confused.. :/

Greetings,
Niels

Hi Niels,

Yes, the token and appurl are exactly what you said.
The targetidentifier is just an accelerator for your implementation, it can be whatever you want it to be. The purpose is to identify the sender. The simplest implementation is to use the UserId but it could be a PurchaseId for example.

Check our
ShoutSystems app for an example.
Feel free to ask more questions if you have doubts after taking a look at it.

Regards

Thanks!
What if there is no login required?

I tried to understand the ShoutSystems app, but I don't understand how we can actually test it?


Regards

Hi Niels,

Sorry for the late reply, somehow missed your answer with a question.
There is no problem if you have no login, you just have to find a way to identify things. Either it is a conversation, a package, a sale, etc... It will always have a unique id.

To test ShoutSystem you have to install it on a personal and use two browser windows to send and receive messages. One in incognito mode or two different browsers.

Regards

Francisco Afonso wrote:

Hi Niels,

Sorry for the late reply, somehow missed your answer with a question.
There is no problem if you have no login, you just have to find a way to identify things. Either it is a conversation, a package, a sale, etc... It will always have a unique id.

To test ShoutSystem you have to install it on a personal and use two browser windows to send and receive messages. One in incognito mode or two different browsers.

Regards

Hi Francisco,

Is there any documentation available on "ShoutSystem". Some overview documentation, on Firebase event triggered/what events triggered / how the message get sent in the chat app. Also how to setup the app. I am trying to integrate this chat app in one of my mobile app, but couldn't understand how the app works. Appreciate your help.

Thank you,

MN


Murthy Nemani wrote:

Francisco Afonso wrote:

Hi Niels,

Sorry for the late reply, somehow missed your answer with a question.
There is no problem if you have no login, you just have to find a way to identify things. Either it is a conversation, a package, a sale, etc... It will always have a unique id.

To test ShoutSystem you have to install it on a personal and use two browser windows to send and receive messages. One in incognito mode or two different browsers.

Regards

Hi Francisco,

Is there any documentation available on "ShoutSystem". Some overview documentation, on Firebase event triggered/what events triggered / how the message get sent in the chat app. Also how to setup the app. I am trying to integrate this chat app in one of my mobile app, but couldn't understand how the app works. Appreciate your help.

Thank you,

MN


I am able to figure this out.

Just to clear up the semantics of TargetIdentifier... from my experiments here it seems like - as long as an app is listening to the same TargetIdentifier - it will be notified, regardless of the device, correct?

Is there a way to "delete" a notification after you're done with it? (i.e. so listening to that TargetIdentifier no longer triggers a notification)?

Thanks,


Miguel

Hi Miguel,

That's exactly it!

Regarding the discard. Firebase will always notify you as long as you're listening to that notification, what you can do with our component is to handle the Ready event that provides you with a date time of its "readiness" and ignore all notifications that have a date time previous to that. You can also map that on a database on your application.

Regards

Thanks Francisco - I'll do what you suggested and just ignore notifications before the last time I handled them.

Just a quick followup question: I've got things working for Web... in Mobile, I presume the mechanic will be very similar (with events in the page) when the app is open. But when the app is closed does anything happen? Do you get an app icon notification? Is the app brought to the foreground?

Cheers!

Unfortunately you wont be notified of those messages because the component is based on a JavaScript SDK. If that is a blocker for your application I suggest searching for a Firebase cordova plugin or another real time plugin.

Regards

Hi again Francisco. I expected that to be the case, just wanted to double-check. Thanks for all the help! :)