Skip to content

Share Links and Deep Linking

o5faruk edited this page May 2, 2021 · 11 revisions

⚠️⚠️⚠️

This sdk documentation is deprecated and will not be updated. Check out our new docs at https://sdk.buildfire.com/docs/share-links-and-deep-linking/

⚠️⚠️⚠️

Overview

Provide a way to reference a plugin inside the application and navigate the user directly to that plugin with specific data that allow the plugin developers to change the plugin view or behavior depends on this data ( example: showing a video).

buildfire.deeplink.generateUrl(options,callback)

This function helps the developers to generate a shortened URL which points to the original URL which has been provided with meta tags that control how URLs are displayed when shared on social media (Facebook, Whatsup, Slack...etc)

arguments

  • options (Object): This property will give the plugin developers the functionality to customize the Open Graph meta tags that control how URLs are displayed when shared on social media and also to provide the needed data which will be sent back to the plugin once the user opened the share link.

    • title (string)
      • The title of the share link and if it's not provided the name of the app will be used by default.
    • keywords (number)
      • The keywords of the share link and if it's not provided the name, description of the app will be used by default.
    • imageUrl (string)
      • The image of the share link and if it's not provided the app icon will be used which will be stored in the branding section of the Control Panel of the app.
    • description (string)
      • The description of share link and if it's not provided the app description will be used which will be stored in the publishing information section of the control panel of the app.
    • data (object)
    • extraMetaTags (array of objects)
  • callback(err, result) required: function will be invoked after the link has been generated and return back the generated URL.

    • result (object)
      • url (string) generated URL

Note: To share the generated URL in the native sharing window of your mobile device please follow this wiki.

Example

// You can generate the share link either from the widget side or from the controller side of your plugin
let link = {};
link.title = "share link title";
link.type = "website";
link.description = "This is an example of buildfire share link";
link.imageUrl = "HTTP://buildfire.com/exampleImage.png";
link.extraMetaTags = [
	{ "property": "og:site_name", content: "YouTube" },
	{ "property": "og:video:url", content: "https://www.youtube.com/embed/9Q-4sZF0_CE" }
];

link.data = {
	"videoId": "9Q-4sZF0_CE"
};

buildfire.deeplink.generateUrl(link, function (err, result) {
	if (err) {
		console.error(err)
	} else {
                 // output : {"url":"https://buildfire.com/shortlinks/f6fd5ca6-c093-11ea-b714-067610557690"}
		console.log(result);
	}
});


// You can read the provided link data from the widget side of your plugin and change the behavior as needed depends on this data.
buildfire.deeplink.getData(function (result) {
	if (result) {
                // output : {"videoId":"9Q-4sZF0_CE"}
		console.log(JSON.stringify(result)); 
	}
});
Clone this wiki locally