About "Deeplinking"
A deeplink allows you to start the Cargosnap mobile app from another app or website in a specific workflow, using a hyperlink.
We allow various parameters to be passed to the app, thus getting it into a desired state. A usual use case woud be to add data to or run a specific workfrom for a specific file.
The easy way: use open.cargosnap.com
See our documentation here, how to leverage our facility to open a deeplink, just by creating a URL with parameters you undoubtly have at your finger tips.
Programatically Create a deeplink
So. Here you are, feeling courageous? Let's make this deeplink! (its actually also pretty easy!)
The deeplink is a BASE64 string of a set of parameters, captured in the form of a JSON object. Basically it looks like this:
{
"top": "[Wt]",
"topState": {
"reference": "[A]"
},
"bottom": "[Wb]",
"bottomState": {
"id": "[B]"
},
"minimizeOnFinish": "[C]",
"teamId": "[D]"
}
You need to replace the square bracket placeholders with values for the corresponding component:
top = [Wt] (string, required): Reference to a top-widget. Possible values: keyboard, barcode, timestamp, number.
topState.reference = [A] (string, optional): your reference to pre-fill the top widget value with. This is where the reference will be filed under.
bottom = [Wb] (string, required): Reference to a bottom-widget. This should say "workflows". Some other options are possible, but we consider those deprecated now.
bottomState.id = [B] (string, required if Wb == "workflows"). Starts this specific workflow. This id can be found by selecting the specific workflow (Global Settings -> Workflows) and taking the reference ID from the URL.
minimizeonfinish = [C] (bool, optional, default=false): if you want Cargosnap to close after completing the workflow (so the app calling Cargosnap can take over again). Note this feature is only available on Android devices (on iOS, users need to terminate/switch manually).
teamId = [D] (string, optional) As your device may be registered under multiple accounts, it is a good practise to include the specific teams scope the device works under. You can find the team id in the platform.
Example.
Let's start a workflow (123) for your file (2345), in a specific account (9) and exit after completion. The object of such a 'typical' use case would be:
{
"top": "barcode",
"topState": {
"reference": "2345"
},
"bottom": "workflows",
"bottomState": {
"id": "123"
},
"teamId": "9",
"minimizeOnFinish": true
}
Put it to use
The following JS snippet will produce the object and create the callable local / offline deeplink (by BASE64-ing the payload). This code block uses the values from the example above.
var object = {};
object.top = 'barcode';
object.topState = { reference: "1234"};
object.bottom = 'workflows';
object.bottomState = { id: "23" };
object.teamId = "9";
object.minimizeOnFinish = true;
var state = btoa(JSON.stringify(object));
url = 'cargosnap://open/' + state;
That's it. Click the link that results from this code on a device with Cargosnap installed & registered and you should be good to start that inspection!