Follow email Print print

Deep Link: How to Build and Encode URL with Custom Data and Call Back URL

The purpose of this document is to provide a step-by-step process for building out a deep link that contains custom parameters. This document is complimentary to Deep Linking: Add Custom Values for Reporting and a Call Back URL.

 

We’ll use the following deep link as an example for this document:

gospotcheck://companies/{id}/missions/{id}/places/{id}/mission_responses/?start=true&customer_data={"visit_id":"678345","task_id":"abc123"}&completion_trigger={"action_type":"url_redirect","value":"com.salesforce.salesforce1://https://mxteam--devtest.my.salesforce.com/apex/Pagename","mx_options":["status","mx_user_id"]}

 

Help_Desk_Build_Link_pic_1.png

 

Terminology used in this document

Base URL / Path: gospotcheck://companies/{id}/missions/{id}/places/{id}/mission_responses/?start=true

Keys:customer_data=, completion_trigger=

Values: Anything encapsulated by curly brackets ( { } )

 

Step 1: Build Out Each Query Parameter in JSON

Build out each query parameter separately.

From the example above, we would build out the customer_data and the completion_trigger values in JSON.

 

Step 2: Validate the JSON within the Query Parameter

Any values associated with the customer_data and completion_trigger keys need to be properly formatted JSON. If they are not, the MarketX system will not accept the values.

You can validate that the JSON is correctly formatted with any online JSON formatting tool

Recommendations:

  • Remove any new lines and / or empty spaces to help reduce the number of overall characters

From the example above, we are validating that

{"visit_id":"678345","task_id":"abc123"}

and

{"action_type":"url_redirect","value":"com.salesforce.salesforce1://https://mxteam--devtest.my.salesforce.com/apex/Pagename","mx_options":["status","mx_user_id"]}

are properly formatted JSON. The remainder of the URL stays the same.

If the JSON is not properly formatted, the MarketX system will not store the values.

 

Step 3: Encode Each Query Parameter Separately

Once the JSON is validated for each Query Parameter, it will need to be encoded. You can use any online tool, including this one https://www.urlencoder.org/) .

You will encode everything within, and including, the curly brackets around each JSON object.

From the example above, we are encoding the following:

{"visit_id":"678345","task_id":"abc123”}

and, separately;

{"action_type":"url_redirect","value":"com.salesforce.salesforce1://https://mxteam--devtest.my.salesforce.com/apex/Pagename","mx_options":["status","mx_user_id"]}

Help_Desk_Build_Link_pic_2.png

 

Do NOT encode the base url / path or query parameters separators (“?”,”&”, etc.). If any keys contains non alphanumeric or reserved characters, it must be encoded as well. All JSON values of the keys need to be encoded.

 

Step 5: Build the Fully Encoded Deep Link

You are now ready to build out the full deep link.

Start with the base URL / path:

gospotcheck://companies/{id}/missions/{id}/places/{id}/mission_responses/?start=true

 

You will then add your first Query Parameter. In our example this is the customer_data key:

gospotcheck://companies/{id}/missions/{id}/places/{id}/mission_responses/?start=true&
customer_data=

 

Add the associated encoded values after the key:

gospotcheck://companies/{id}/missions/{id}/places/{id}/mission_responses/?start=true&customer_data=%7B%22visit_id%22%3A%22678345%22%2C%22task_id%22%3A%22abc123%E2%80%9D%7D

 

Add your second Query Parameter. In our example this is the completion_trigger key:

gospotcheck://companies/{id}/missions/{id}/places/{id}/mission_responses/?start=true&customer_data=%7B%22visit_id%22%3A%22678345%22%2C%22task_id%22%3A%22abc123%E2%80%9D%7D&completion_trigger=

 

Add the associated encoded values after the key:

gospotcheck://companies/{id}/missions/{id}/places/{id}/mission_responses/?start=true&customer_data=%7B%22visit_id%22%3A%22678345%22%2C%22task_id%22%3A%22abc123%E2%80%9D%7D&completion_trigger=%7B%22action_type%22%3A%22url_redirect%22%2C%22value%22%3A%22com.salesforce.salesforce1%3A%2F%2Fhttps%3A%2F%2Fmxteam--devtest.my.salesforce.com%2Fapex%2FPagename%22%2C%22mx_options%22%3A%5B%22status%22%2C%22mx_user_id%22%5D%7D

 

You now have a completed, encoded deep link! This link is what you will embed wherever the deep link is triggered.

 

 

 

star
Have more questions? Submit a request