Push Notification that triggers data sync and displays specific view

I enabled push notifications in my whitelabel app and wish to send a push notification that when clicked opens the app to a specific view with the latest data available. The view in question is called Top Picks. The deep link expression I was planning to use when broadcasting the notification is below. Is it correct?

CONCATENATE("#view=Top Picks#at=", ENCODEURL(NOW()))

Thanks.

No. When a Push Notification is sent and presented, it has no context of WHICH app it is for. it is just presenting information. However, you can build your Deep Link expression to specify the specific app.

You should be using the LINKTO…() navigation Deep Links. These have internal functionality used in building the navigation URL and they all provide a parameter to specify the app to go to.

Support for LINKTO…() functions
https://www.appsheet.com/Support?q=LINKTO&hPP=10&idx=help&p=0&is_v=1

Thank you for your response. I was following the guide here -> https://help.appsheet.com/en/articles/1023058-app-column-type-deep-link

And it says that the “at” parameter can used with a push notification to force a sync. The example they give is “CONCATENATE(“MyApp-123#at=”, ENCODEURL(NOW())) will navigate to app “MyApp-123”, force a sync, and display its default starting view.”

So I don’t understand why this can’t be manipulated to go to view and force a sync instead of to an app.

You didn’t specify your complete end goal in the original post.

Using the CONCATENATE() method was the pre-cursor to the LINKTO…() functions. You can still use that method to manually create the URL.

When using the LINKTO…() functions, AppSheet will be maintaining how those URL’s are constructed and returned with no additional attention needed on the developer side - meaning if something critical changes that affects the URL’s, a developer would need to re-enter the app and change every location they created the Deep Links manually.

So, I would advise to use the LINKTO…() functions whenever possible.

You can still add parameters to the URL’s constructed with the LINKTO…() functions. In your case, I believe you can construct the link used in your Push Notification as:

CONCATENATE(LINKTOVIEW("view name", "app id"),"#at=", ENCODEURL(NOW()) )

I hope this helps!

1 Like

#at= should be &at= (&, not #).

2 Likes

Good to know. Just for my education, when is the “#” symbol used in the URL? Is it only at the START of the parameter list?

The format of a (mostly) full URL:

https://{site}/{path}?{options}#{special}

at is an option. Options are formatted like this:

{option1}={value1}&{option2}={value2}&...&{optionN}={valueN}
3 Likes

So just to confirm that this:

CONCATENATE("#view=Top Picks&at=", ENCODEURL(NOW()))

will work where I have replaced the #at= with &at=

Or do I need to apply the correction to what WillowMobileSystems suggested i.e.:

CONCATENATE(LINKTOVIEW("view name", "app id"),"&at=", ENCODEURL(NOW()))

I recommend using LINKTOVIEW() as @WillowMobileSystems suggested.

CONCATENATE(LINKTOVIEW("view name", "app id"), "&at=", ENCODEURL(NOW()))
4 Likes

@Dilanjan_Fernando Is this working for you?
Because I always have to add an +1 at the end, as mentioned here:

So this would be:
CONCATENATE(LINKTOVIEW("view name", "app id"), "&at=", ENCODEURL(NOW()+1))

2 Likes

@Fabian I’m still yet to test it because I’m trying to avoid sending notifications more than once every 2 weeks to my users. I’ll probably test your method first since it is working you because I don’t want to risk sending a notification that leads users to old data.

1 Like

@Fabian I entered CONCATENATE(LINKTOVIEW("Top Picks", "QLDSeniorsDiscounts-1222696"), "&at=", ENCODEURL(NOW())+1) but got the error “Arithmetic expression ‘(ENCODEURL(NOW())+1)’ has inputs of an invalid type ‘Unknown’”

So I sent a push notification with CONCATENATE(LINKTOVIEW("Top Picks", "QLDSeniorsDiscounts-1222696"), "&at=", ENCODEURL(NOW()+1)) instead and I received the notification but it didn’t take me to the Top Picks view nor did it force a sync.

@Dilanjan_Fernando I took a look on my App and I saw, that I’m Manually Constructing Deep Links as you can read at the end of this article:

This Deep Link should work for you:
CONCATENATE(“QLDSeniorsDiscounts-1222696#view=Top Picks&at=”,ENCODEURL(NOW() + 1))

3 Likes

Thank you, I will try the new deep link in a couple of weeks time.

You used:

(ENCODEURL(NOW())+1)

It should be:

(ENCODEURL(NOW()+1))

Notice where the parentheses are.

4 Likes

I used (ENCODEURL(NOW()+1)) when I sent out the notification but that hadn’t forced an app sync or taken the user to the specified app view.

The "&at=" & ENCODEURL(NOW() + 1) trick only works to force a sync when used to navigate to a view within the app. Used with a link external to the app really has little or no effect. A user who is not in the app and clicks on a link into the app will automatically get the latest data available.

Please post a screenshot of your notification workflow configuration that includes the entire Notification Content section.

4 Likes

Based on this post, I played around with some Push Notifications I have in my app. I eventually want the capability described here anyway.


Using the Deep Link property in the Notify Workflow, I was able to navigate to another app AND I was also able to force a Sync in that app. Forcing a Sync is important for use cases were a new record has been added and the recipient might already have the app open.

I first applied an expression below to test navigating to another app (and actually tried a couple views to be certain I wasn’t just getting a default view):

LINKTOVIEW("Log Table", "IssueSample-526414")

Obviously you will need to update with your view name and your app-id.

Next I was able to force a Sync by applying @Steve 's suggested trick by updating the Deep Link expression to this:

‘CONCATENATE(LINKTOVIEW(“Log Table”, “IssueSample-526414”), “&at=”,ENCODEURL(NOW() + 1))’

I also played with opening a specific row in the current app, etc. All seem to work very well.

I hope this helps someone!!!

7 Likes

Outstanding!

1 Like

@WillowMobileSystems Thank you very much John. Posts like this have to be bookmarked :slight_smile:

3 Likes