Add deep links

Deep linking allows you to specify query parameters in your app's URL and load data based on those parameters. This is handy for restoring state if the app is refreshed, or for users to share links.

As an example, say you have an app with a view that lists events and another view that shows the details of a single event. As a user navigates from the list of events to a specific event, you can populate the URL parameters with the ID of that event. The resulting URL would look as follows: https://thirty50.appfarm.app/onboard-events/event?id=624704724506ff7e268ae2b9.

You can then configure your app, using the On App Load event handler, to load the event with the specified ID and display that to the user. This way, if they refresh the app, or send the URL to a friend, the app knows which event to show.

Follow these steps to create a URL parameter and build the logic for a deep link. You can create as many URL parameters as you need.

Create a URL parameter

  1. In App Data, go to URL Parameters

  2. Click Add Property and provide:

    1. A Key, which is the name of the parameter ("id" in the above example)

    2. A Data Type. If you want to reference a specific object, choose the appropriate Object Class ("Event" in the above example).

Populate the URL parameter on navigation

In the action that navigates to the view you wish to implement the parameter on, you should have:

  • A Set Selection action node that selects the object you wish to display.

  • A Navigate action node that navigates to the detail view.

To populate the URL parameter when the user navigates to the detail view:

  1. Edit the Navigate action node and set the value of the URL parameter using the selected object.

Load data on refresh using On App Load

For your app to load data based on URL parameters, you need to configure an action that runs when the app itself is loaded.

  1. Create or edit the action attached to the On App Load event handler in App Settings.

  2. Add an If action node that checks if your URL parameter has a value

  3. Add a Set Selection action node to run if the condition is true, with a filter to select the object based on the value of the URL parameter.

Now, your app should populate the URL parameter as the user navigates and load the specified data when the app is refreshed.

Last updated