-
Notifications
You must be signed in to change notification settings - Fork 84
Deep Links
This sdk documentation is deprecated and will not be updated. Check out our new docs at https://sdk.buildfire.com/docs/deep-links/
This is an object within the buildfire singleton that is responsible for receiving deep link data and compiling deep links for use.
a deep link is similar to a URL you use on the web. However, it has two major distinctions.
- the protocol is different the your standard http:// or https://
- and it doesn't trigger your browser to open up a page
It relies on applications installed on your device that assumes the responsibility of handing that custom protocol/schema. In this case, it would be your app. With a deep link and the app installed you can not only open the app with the link... you can drill down to a particular plugin. That functionality is taken care of by the BuildFire framework.
There are some times where you would want to drill down even further into a plugin. This is where the custom development comes in
A deeplink can also be registered to be used with action items allowing the user to navigate to your plugin passing data you have already registered.
this function is to register a deeplink into the appData.
Registered deeplinks can be selected in the Control Panel action item dialogs as highlighted below:
In this example the developer has registered a deeplink with the name "John Doe" so that when the action item is executed it would navigate to the plugin passing the data that identifies "John Doe" allowing the plugin to internally navigate to that person.
For more info about action items dialog on control side please refer to How-to-use-action-Items.
Arguments:
-
options: This object will hold the deeplink properties as follows:-
id: The ID of the deeplink record -
name: the name of the deeplink in action items dialog -
deeplinkData: the data object that will be sent when navigating to the plugin through the action item -
imageUrl: [optional] An image url to show next to the deeplink in action items dialog
-
-
callback: the function that will be executed when the insertion is finished
In this function, we will first look if the deeplink you want to register already exists; if the deeplink ID exists it will be updated, otherwise this function will insert a new deeplink
const options = {
id: "PERSON-431",
name: "John Doe",
deeplinkData: {personId: "PERSON-431"},
};
buildfire.deeplink.registerDeeplink(options, (err, result) => {
if(err) return console.log(err);
console.log('INSERTED/UPDATED DEEPLINK', result);
})
this function is to get a deeplink by the id, which developer provides
Arguments:
-
deeplinkId: The ID of the deeplink record -
callback: the function that will be executed after the process is done
buildfire.deeplink.getDeeplink("PERSON-431", function(err, result) {
if(err) return console.log(err);
if(result) {
console.log('RESULT', result);
} else {
console.log('NO RESULTS');
}
});
this function is to get all the deeplinks from the appData according to the plugin instance Id
Arguments:
-
options: This object will hold the data that will be used to search (This parameter isn't used for the time being you can send it as null) -
callback: The function that will be executed when the search process is done
buildfire.deeplink.getAllDeeplinks({}, (err, res) => {
if(err) return console.log(err);
if(res) {
console.log('ALL DEEPLINKS', res);
}
});
this function is to delete or unregister a deeplink from the appData
Arguments:
-
deeplinkId: The ID of the deeplink record -
callback: the function that will be executed after the deletion is done
buildfire.deeplink.unregisterDeeplink("PERSON-431", (err, result) => {
if(err) return console.log(err);
console.log('DELETED DEEPLINK', result);
});
this takes in an object and compiles a deep link with your needed data so that the user may use the link to send others directly into the widget and pass your needed data to your widget so you can use buildfire.deeplink.getData(callback) to retrieve your data and do whatever you need with it. This is ONLY used in the Controller.
Note: options are not used for the time being you can send it as null
buildfire.deeplink.setData({myWidgetData : 'data'} , null , function(err,result) {
alert(result);//The result will be like the following : appdc3app://plugin/ba4139dd-09c6-4121-aa4a-c72570af07fc-9997799406344?dld=%7B%22myWidgetData%22%3A%22data%22%7D
});
this takes in a callback function that you can call to retrieve your deeplink data if the app gets triggered from deeplink Url. This is ONLY used in the widget. Use the data to help you navigate deeply into your widget. data will be of type object
buildfire.deeplink.getData(function(data){
if(data) alert('deep link data: ' + data);// in case we used the above example to set the deep link data , the object will be : {myWidgetData : 'data'}
});
this will return the deep link URL for your plugin with the attached Deep Link Data from your side which you've already attach with buildfire.deeplink.setData(obj,callback)
buildfire.deeplink.template.get(function(err,result) {
alert(JSON.stringify(result));
// in case we used the above example to set the data
// the result will be : appdc3app://plugin/ba4139dd-09c6-4121-aa4a-c72570af07fc-9997799406344?dld=%7B%22myWidgetData%22%3A%22data%22%7D
// if there is no deep link data it will be : appdc3app://plugin/ba4139dd-09c6-4121-aa4a-c72570af07fc-9997799406344
});
this takes in an object or string and compiles a deep link so that the user may use the link to send others directly into the widget subsection (obsolete) use buildfire.template.get instead
alert ( buildfire.deeplink.createLink('section:7') );
see https://github.com/BuildFire/sdk/wiki/Share-Links-and-Deep-Linking
